more cleanup including selendroid update

This commit is contained in:
Jonathan Lipps
2013-10-22 11:29:14 -07:00
parent bac7b069fa
commit 8e5a0bb1f9
3 changed files with 12 additions and 10 deletions

View File

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

View File

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

View File

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