mirror of
https://github.com/openstf/stf
synced 2025-10-04 18:29:17 +02:00
Expose input services.
This commit is contained in:
parent
eb332ff36a
commit
b50ec6b4b0
4 changed files with 168 additions and 14 deletions
|
@ -259,8 +259,10 @@ module.exports = function(options) {
|
|||
return monkey.connectStream(conn)
|
||||
})
|
||||
.then(function(monkey) {
|
||||
services.monkey =
|
||||
vitals.register('device:remote:monkey:monkey', monkey)
|
||||
services.monkey = vitals.register(
|
||||
'device:remote:monkey:monkey'
|
||||
, Promise.promisifyAll(monkey)
|
||||
)
|
||||
})
|
||||
})
|
||||
.then(function() {
|
||||
|
@ -289,8 +291,10 @@ module.exports = function(options) {
|
|||
return monkey.connectStream(conn)
|
||||
})
|
||||
.then(function(monkey) {
|
||||
services.input =
|
||||
vitals.register('device:remote:input:monkey', monkey)
|
||||
services.input = vitals.register(
|
||||
'device:remote:input:monkey'
|
||||
, Promise.promisifyAll(monkey)
|
||||
)
|
||||
})
|
||||
})
|
||||
.then(function() {
|
||||
|
@ -349,6 +353,30 @@ module.exports = function(options) {
|
|||
}
|
||||
channels.keepalive(channel)
|
||||
})
|
||||
.on(wire.TouchDownMessage, function(channel, message) {
|
||||
services.input.touchDownAsync(message.x, message.y)
|
||||
})
|
||||
.on(wire.TouchMoveMessage, function(channel, message) {
|
||||
services.input.touchMoveAsync(message.x, message.y)
|
||||
})
|
||||
.on(wire.TouchUpMessage, function(channel, message) {
|
||||
services.input.touchUpAsync(message.x, message.y)
|
||||
})
|
||||
.on(wire.TapMessage, function(channel, message) {
|
||||
services.input.tapAsync(message.x, message.y)
|
||||
})
|
||||
.on(wire.TypeMessage, function(channel, message) {
|
||||
services.input.typeAsync(message.text)
|
||||
})
|
||||
.on(wire.KeyDownMessage, function(channel, message) {
|
||||
services.input.keyDownAsync(message.key)
|
||||
})
|
||||
.on(wire.KeyUpMessage, function(channel, message) {
|
||||
services.input.keyUpAsync(message.key)
|
||||
})
|
||||
.on(wire.KeyPressMessage, function(channel, message) {
|
||||
services.input.pressAsync(message.key)
|
||||
})
|
||||
.on(wire.ShellCommandMessage, function(channel, message) {
|
||||
log.info('Running shell command "%s"', message.command.join(' '))
|
||||
adb.shellAsync(options.serial, message.command)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue