diff --git a/lib/devices/android/chrome.js b/lib/devices/android/chrome.js index ca0bf1cd1..94d2221f0 100644 --- a/lib/devices/android/chrome.js +++ b/lib/devices/android/chrome.js @@ -177,7 +177,7 @@ ChromeAndroid.prototype.onClose = function(code, signal) { } async.series([ this.adb.getConnectedDevices.bind(this.adb), - this.adb.stopApp.bind(this.adb) + function(cb) { this.adb.forceStop(this.appPackage, cb); }.bind(this) ], function(err) { if (err) logger.error(err.message); if (this.exitCb !== null) { diff --git a/lib/devices/android/selendroid.js b/lib/devices/android/selendroid.js index b2883170a..343b7d5f8 100644 --- a/lib/devices/android/selendroid.js +++ b/lib/devices/android/selendroid.js @@ -69,7 +69,7 @@ Selendroid.prototype.start = function(cb) { if (!modServerExists) { logger.info("Rebuilt selendroid server does not exist, inserting " + "modified manifest"); - this.insertSelendroidManifest(this.apkPath, cb); + this.insertSelendroidManifest(this.serverApk, cb); } else { logger.info("Rebuilt selendroid server already exists, no need to " + "rebuild it with a new manifest"); @@ -106,7 +106,7 @@ Selendroid.prototype.start = function(cb) { ], function(err) { if (err) return cb(err); this.createSession(cb); - }); + }.bind(this)); }; Selendroid.prototype.pushSelendroid = function(cb) { @@ -235,7 +235,7 @@ Selendroid.prototype.deleteSession = function(cb) { this.proxyTo(url, 'DELETE', null, function(err, res) { if (err) return cb(err); if (res.statusCode !== 200) return cb(new Error("Status was not 200")); - this.adb.stopApp(cb); + this.adb.forceStop(this.appPackage, cb); }.bind(this)); }; diff --git a/test/functional/android/device-state.js b/test/functional/android/device-state.js index 6ebc66a1c..79533f8d5 100644 --- a/test/functional/android/device-state.js +++ b/test/functional/android/device-state.js @@ -1,13 +1,14 @@ /*global describe:true, it:true, beforeEach:true */ "use strict"; -var deviceState = require('../../../lib/devices/android/device-state.js') - , should = require('should') +var should = require('should') , childProcess = require('child_process') , it = require("../../helpers/driverblock.js").it + , android = require('../../../lib/devices/android/android.js') , ADB = require('../../../lib/devices/android/adb'); describe('Android Device State module', function() { + var deviceState = new ADB({}); beforeEach(function(done) { // ensure a device or emu is connected childProcess.exec("adb devices", function(err, stdout) { @@ -27,7 +28,7 @@ describe('Android Device State module', function() { childProcess.exec('adb shell input keyevent 26', function(err) { should.not.exist(err); - deviceState.isScreenLocked('adb', function(err, isLocked) { + deviceState.isScreenLocked(function(err, isLocked) { should.not.exist(err); isLocked.should.equal(true); done(); @@ -37,13 +38,14 @@ describe('Android Device State module', function() { }); it('should return false is screen is unlocked', function(done) { // Push unlock.apk first - var adb = new ADB(); - adb.pushUnlock(function(err) { + var androidObj = android({}); + androidObj.adb = deviceState; + androidObj.pushUnlock(function(err) { should.not.exist(err); childProcess.exec('adb shell am start -n io.appium.unlock/.Unlock', function(err) { should.not.exist(err); setTimeout(function() { - deviceState.isScreenLocked('adb', function(err, isLocked) { + deviceState.isScreenLocked(function(err, isLocked) { should.not.exist(err); isLocked.should.equal(false); done();