Support full-reset for selendroid

Replay commit ad9c73a3c4
This commit is contained in:
Romain Criton
2014-01-16 16:49:33 +00:00
parent ecc0f6aee2
commit 82434a5efe
3 changed files with 20 additions and 17 deletions

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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;
@@ -41,6 +42,7 @@ var Selendroid = function(opts) {
, 'keyevent'
, 'currentActivity'
, 'installApp'
, 'uninstallApp'
, 'removeApp'
, 'closeApp'
, 'isAppInstalled'
@@ -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);