From f8e2909ed274f01723dd5d2fca76fa916db40904 Mon Sep 17 00:00:00 2001 From: Chi Thu Le Date: Fri, 8 Nov 2013 20:39:37 +0100 Subject: [PATCH] Moved getCurrentActivity to android-common.js --- lib/devices/android/android-common.js | 14 ++++++++++++++ lib/devices/android/android-controller.js | 15 --------------- lib/devices/android/selendroid.js | 15 --------------- 3 files changed, 14 insertions(+), 30 deletions(-) diff --git a/lib/devices/android/android-common.js b/lib/devices/android/android-common.js index 9bbf1012f..3e9029766 100644 --- a/lib/devices/android/android-common.js +++ b/lib/devices/android/android-common.js @@ -283,5 +283,19 @@ androidCommon.getLogTypes = function(cb) { }); }; +androidCommon.getCurrentActivity = function(cb) { + this.adb.getFocusedPackageAndActivity(function(err, curPackage, activity) { + if (err) { + return cb(null, { + status: status.codes.UnknownError.code + , value: err.message + }); + } + cb(null, { + status: status.codes.Success.code + , value: activity + }); + }); +}; module.exports = androidCommon; diff --git a/lib/devices/android/android-controller.js b/lib/devices/android/android-controller.js index afa82a642..a85b76f8a 100644 --- a/lib/devices/android/android-controller.js +++ b/lib/devices/android/android-controller.js @@ -608,21 +608,6 @@ androidController.deleteCookies = function(cb) { cb(new NotYetImplementedError(), null); }; -androidController.getCurrentActivity = function(cb) { - this.adb.getFocusedPackageAndActivity(function(err, curPackage, activity) { - if (err) { - return cb(null, { - status: status.codes.UnknownError.code - , value: err.message - }); - } - cb(null, { - status: status.codes.Success.code - , value: activity - }); - }); -}; - androidController.fastReset = function(cb) { async.series([ function(cb) { this.adb.stopAndClear(this.appPackage, cb); }.bind(this), diff --git a/lib/devices/android/selendroid.js b/lib/devices/android/selendroid.js index 4feb7df99..bd93bf756 100644 --- a/lib/devices/android/selendroid.js +++ b/lib/devices/android/selendroid.js @@ -270,21 +270,6 @@ Selendroid.prototype.insertSelendroidManifest = function(serverPath, cb) { ], cb); }; -Selendroid.prototype.getCurrentActivity = function(cb) { - this.adb.getFocusedPackageAndActivity(function(err, curPackage, activity) { - if (err) { - return cb(null, { - status: status.codes.UnknownError.code - , value: err.message - }); - } - cb(null, { - status: status.codes.Success.code - , value: activity - }); - }); -}; - Selendroid.prototype = _.extend(Selendroid.prototype, androidCommon); module.exports = function(opts) {