mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-19 08:33:24 +02:00
Add display information to device identity.
This commit is contained in:
@@ -5,6 +5,7 @@ var Promise = require('bluebird')
|
||||
var zmq = require('zmq')
|
||||
var adbkit = require('adbkit')
|
||||
var monkey = require('adbkit-monkey')
|
||||
var request = Promise.promisifyAll(require('request'))
|
||||
|
||||
var logger = require('../util/logger')
|
||||
var wire = require('../wire')
|
||||
@@ -18,6 +19,7 @@ var ChannelManager = require('../wire/channelmanager')
|
||||
module.exports = function(options) {
|
||||
var log = logger.createLogger('device')
|
||||
var identity = Object.create(null)
|
||||
var display = Object.create(null)
|
||||
var vendor = Object.create(null)
|
||||
var solo = wireutil.makePrivateChannel()
|
||||
var channels = new ChannelManager()
|
||||
@@ -151,6 +153,31 @@ module.exports = function(options) {
|
||||
log.info(chunk)
|
||||
})
|
||||
})
|
||||
.then(function() {
|
||||
return devutil.waitForPort(adb, options.serial, port)
|
||||
})
|
||||
.then(function(conn) {
|
||||
conn.end()
|
||||
var ours = options.ports.pop()
|
||||
return adb.forwardAsync(
|
||||
options.serial
|
||||
, util.format('tcp:%d', ours)
|
||||
, util.format('tcp:%d', port)
|
||||
)
|
||||
.then(function() {
|
||||
return request.getAsync({
|
||||
url: util.format(
|
||||
'http://127.0.0.1:%d/api/v1/displays/0'
|
||||
, ours
|
||||
)
|
||||
, json: true
|
||||
})
|
||||
})
|
||||
.then(function(args) {
|
||||
assert.ok('id' in args[1], 'Invalid response from HTTP API')
|
||||
identity.display = args[1]
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
.then(function() {
|
||||
|
||||
Reference in New Issue
Block a user