1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-06 03:50:04 +02:00

Merge branch 'develop' of ghe.amb.ca.local:stf/stf into develop

This commit is contained in:
Gunther Brunner 2014-04-04 18:03:50 +09:00
commit ee96da85da

View file

@ -1,5 +1,4 @@
var stream = require('stream')
var util = require('util')
var syrup = require('syrup')
var request = require('request')
@ -8,6 +7,7 @@ var Promise = require('bluebird')
var logger = require('../../../util/logger')
var wire = require('../../../wire')
var wireutil = require('../../../wire/util')
var promiseutil = require('../../../util/promiseutil')
module.exports = syrup.serial()
.dependency(require('../support/adb'))
@ -58,8 +58,8 @@ module.exports = syrup.serial()
// Progress 0% to 70%
sendProgress(
'pushing_app'
, 70 * Math.max(0, Math.min(
70
, 50 * Math.max(0, Math.min(
50
, stats.bytesTransferred / contentLength
))
)
@ -90,9 +90,22 @@ module.exports = syrup.serial()
sendProgress('pushing_app', 0)
pushApp()
.then(function(apk) {
// Progress 80%
sendProgress('installing_app', 80)
return adb.installRemote(options.serial, apk)
var start = 50
, end = 90
, guesstimate = start
sendProgress('installing_app', guesstimate)
return promiseutil.periodicNotify(
adb.installRemote(options.serial, apk)
, 1000
)
.progressed(function() {
guesstimate = Math.min(
end
, guesstimate + 5 * (end - guesstimate) / (end - start)
)
sendProgress('installing_app', guesstimate)
})
})
.timeout(30000)
.then(function() {