1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-05 10:39:25 +02:00

Port to new adbkit.

This commit is contained in:
Simo Kinnunen 2014-03-12 12:42:10 +09:00
parent ca401d7b9c
commit d90d450400
4 changed files with 38 additions and 32 deletions

View file

@ -30,7 +30,7 @@ util.inherits(IncompatibleVersionError, Error)
inputAgent.IncompatibleVersionError = IncompatibleVersionError
inputAgent.getInstalledPath = function(adb, serial) {
return adb.shellAsync(serial, util.format("pm path '%s'", pkg))
return adb.shell(serial, util.format("pm path '%s'", pkg))
.then(function(out) {
return streamutil.findLine(out, (/^package:/))
.then(function(line) {
@ -42,7 +42,7 @@ inputAgent.getInstalledPath = function(adb, serial) {
inputAgent.ensureInstalled = function(adb, serial) {
return inputAgent.getInstalledPath(adb, serial)
.then(function(installedPath) {
return adb.shellAsync(serial, util.format(
return adb.shell(serial, util.format(
"export CLASSPATH='%s';"
+ ' exec app_process /system/bin'
+ ' jp.co.cyberagent.stf.input.agent.InputAgent --version'
@ -63,7 +63,7 @@ inputAgent.ensureInstalled = function(adb, serial) {
})
})
.catch(function() {
return adb.installAsync(serial, apk)
return adb.install(serial, apk)
.then(function() {
return inputAgent.getInstalledPath(adb, serial)
})
@ -73,7 +73,7 @@ inputAgent.ensureInstalled = function(adb, serial) {
inputAgent.openAgent = function(adb, serial) {
return inputAgent.ensureInstalled(adb, serial)
.then(function(installedPath) {
return adb.shellAsync(serial, util.format(
return adb.shell(serial, util.format(
"export CLASSPATH='%s';"
+ ' exec app_process /system/bin'
+ ' jp.co.cyberagent.stf.input.agent.InputAgent'
@ -87,7 +87,7 @@ inputAgent.openService = function(adb, serial) {
.then(function() {
var intent =
'-a jp.co.cyberagent.stf.input.agent.InputService.ACTION_START'
return adb.shellAsync(serial, util.format(
return adb.shell(serial, util.format(
'am startservice --user 0 %s || am startservice %s'
, intent
, intent
@ -97,7 +97,7 @@ inputAgent.openService = function(adb, serial) {
inputAgent.stopService = function(adb, serial) {
var intent = '-a jp.co.cyberagent.stf.input.agent.InputService.ACTION_STOP'
return adb.shellAsync(serial, util.format(
return adb.shell(serial, util.format(
'am startservice --user 0 %s || am startservice %s'
, intent
, intent