mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-19 08:53:30 +02:00
Merge branch 'develop' of ghe.amb.ca.local:stf/stf into develop
This commit is contained in:
@@ -239,7 +239,7 @@ module.exports = function(options) {
|
||||
.then(function(port) {
|
||||
var log = logger.createLogger('device:inputAgent')
|
||||
return promiseutil.periodicNotify(
|
||||
inputAgent.open(adb, options.serial)
|
||||
inputAgent.openAgent(adb, options.serial)
|
||||
, 1000
|
||||
)
|
||||
.progressed(function() {
|
||||
@@ -264,18 +264,44 @@ module.exports = function(options) {
|
||||
)
|
||||
})
|
||||
})
|
||||
.then(function(apk) {
|
||||
log.info('Launching InputService')
|
||||
return inputAgent.stopService(adb, options.serial)
|
||||
.then(function() {
|
||||
return devutil.waitForPortToFree(adb, options.serial, 1100)
|
||||
})
|
||||
.then(function(port) {
|
||||
var log = logger.createLogger('device:inputService')
|
||||
return inputAgent.openService(adb, options.serial)
|
||||
.then(function() {
|
||||
return promiseutil.periodicNotify(
|
||||
devutil.waitForPort(adb, options.serial, port)
|
||||
, 1000
|
||||
)
|
||||
.progressed(function() {
|
||||
log.info('Waiting for InputService')
|
||||
})
|
||||
})
|
||||
})
|
||||
.then(function(conn) {
|
||||
services.inputServiceSocket = vitals.register(
|
||||
'device:inputService:socket'
|
||||
, conn
|
||||
)
|
||||
})
|
||||
})
|
||||
.then(function() {
|
||||
log.info('Launching input service')
|
||||
log.info('Launching TouchService')
|
||||
return devutil.ensureUnusedPort(adb, options.serial, 2820)
|
||||
.then(function(port) {
|
||||
var log = logger.createLogger('device:remote:input')
|
||||
var log = logger.createLogger('device:remote:touch')
|
||||
return adb.shellAsync(options.serial, [
|
||||
vendor.bin.dest
|
||||
, '--lib', vendor.lib.dest
|
||||
, '--listen-input', port
|
||||
])
|
||||
.then(function(out) {
|
||||
vitals.register('device:remote:input:shell', out)
|
||||
vitals.register('device:remote:touch:shell', out)
|
||||
out.pipe(split())
|
||||
.on('data', function(chunk) {
|
||||
log.info(chunk)
|
||||
@@ -290,8 +316,8 @@ module.exports = function(options) {
|
||||
return monkey.connectStream(conn)
|
||||
})
|
||||
.then(function(monkey) {
|
||||
services.input = vitals.register(
|
||||
'device:remote:input:monkey'
|
||||
services.touch = vitals.register(
|
||||
'device:remote:touch:monkey'
|
||||
, Promise.promisifyAll(monkey)
|
||||
)
|
||||
})
|
||||
@@ -404,25 +430,25 @@ module.exports = function(options) {
|
||||
}
|
||||
})
|
||||
.on(wire.TouchDownMessage, function(channel, message) {
|
||||
services.input.touchDownAsync(message.x, message.y)
|
||||
services.touch.touchDownAsync(message.x, message.y)
|
||||
.catch(function(err) {
|
||||
log.error('touchDown failed', err.stack)
|
||||
})
|
||||
})
|
||||
.on(wire.TouchMoveMessage, function(channel, message) {
|
||||
services.input.touchMoveAsync(message.x, message.y)
|
||||
services.touch.touchMoveAsync(message.x, message.y)
|
||||
.catch(function(err) {
|
||||
log.error('touchMove failed', err.stack)
|
||||
})
|
||||
})
|
||||
.on(wire.TouchUpMessage, function(channel, message) {
|
||||
services.input.touchUpAsync(message.x, message.y)
|
||||
services.touch.touchUpAsync(message.x, message.y)
|
||||
.catch(function(err) {
|
||||
log.error('touchUp failed', err.stack)
|
||||
})
|
||||
})
|
||||
.on(wire.TapMessage, function(channel, message) {
|
||||
services.input.tapAsync(message.x, message.y)
|
||||
services.touch.tapAsync(message.x, message.y)
|
||||
.catch(function(err) {
|
||||
log.error('tap failed', err.stack)
|
||||
})
|
||||
@@ -593,6 +619,8 @@ module.exports = function(options) {
|
||||
))
|
||||
])
|
||||
services.logcat.on('entry', logcatListener)
|
||||
inputAgent.acquireWakeLock(services.inputServiceSocket)
|
||||
inputAgent.unlock(services.inputServiceSocket)
|
||||
owner = newOwner
|
||||
}
|
||||
|
||||
@@ -609,6 +637,8 @@ module.exports = function(options) {
|
||||
))
|
||||
])
|
||||
services.logcat.removeListener('entry', logcatListener)
|
||||
inputAgent.releaseWakeLock(services.inputServiceSocket)
|
||||
inputAgent.lock(services.inputServiceSocket)
|
||||
owner = null
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user