Skip to content

Commit

Permalink
Support full-reset for selendroid
Browse files Browse the repository at this point in the history
Replay commit ad9c73a
  • Loading branch information
mobiware committed Jan 16, 2014
1 parent ecc0f6a commit 82434a5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 17 deletions.
16 changes: 16 additions & 0 deletions lib/devices/android/android-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,22 @@ androidCommon.remoteApkExists = function(cb) {
});
}.bind(this));
};
androidCommon.uninstallApp = function(cb) {
var next = function() {
this.adb.uninstallApk(this.appPackage, function(err) {
if (err) return cb(err);
cb(null);
}.bind(this));
}.bind(this);

if (this.skipUninstall) {
logger.debug("Not uninstalling app since server not started with " +
"--full-reset");
cb();
} else {
next();
}
};

androidCommon.installApp = function(cb) {
if (this.apkPath === null) {
Expand Down
16 changes: 0 additions & 16 deletions lib/devices/android/android.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,22 +256,6 @@ Android.prototype.requestXmlCompression = function(cb) {
}
};

Android.prototype.uninstallApp = function(cb) {
var next = function() {
this.adb.uninstallApk(this.appPackage, function(err) {
if (err) return cb(err);
cb(null);
}.bind(this));
}.bind(this);

if (this.skipUninstall) {
logger.debug("Not uninstalling app since server not started with " +
"--full-reset");
cb();
} else {
next();
}
};

Android.prototype.stop = function(cb) {
this.shuttingDown = true;
Expand Down
5 changes: 4 additions & 1 deletion lib/devices/android/selendroid.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var ADB = require('./adb.js')
var Selendroid = function(opts) {
this.opts = opts;
this.opts.devicePort = 8080;
this.skipUninstall = opts.fastReset || !opts.reset;
this.opts.systemPort = opts.systemPort;
this.avdName = opts.avdName || null;
this.appWaitActivity = opts.appWaitActivity;
Expand All @@ -41,6 +42,7 @@ var Selendroid = function(opts) {
, 'keyevent'
, 'currentActivity'
, 'installApp'
, 'uninstallApp'
, 'removeApp'
, 'closeApp'
, 'isAppInstalled'
Expand Down Expand Up @@ -112,12 +114,13 @@ Selendroid.prototype.start = function(cb) {
conditionalInsertManifest,
this.checkSelendroidCerts.bind(this),
conditionalInstallSelendroid,
this.uninstallApp.bind(this),
this.installApp.bind(this),
this.forwardPort.bind(this),
this.pushUnlock.bind(this),
this.unlockScreen.bind(this),
this.pushSelendroid.bind(this),
this.waitForServer.bind(this),
this.waitForServer.bind(this)
], function(err) {
if (err) return cb(err);
this.createSession(cb);
Expand Down

0 comments on commit 82434a5

Please sign in to comment.