1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-06 12:00:08 +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 stream = require('stream')
var util = require('util')
var syrup = require('syrup') var syrup = require('syrup')
var request = require('request') var request = require('request')
@ -8,6 +7,7 @@ var Promise = require('bluebird')
var logger = require('../../../util/logger') var logger = require('../../../util/logger')
var wire = require('../../../wire') var wire = require('../../../wire')
var wireutil = require('../../../wire/util') var wireutil = require('../../../wire/util')
var promiseutil = require('../../../util/promiseutil')
module.exports = syrup.serial() module.exports = syrup.serial()
.dependency(require('../support/adb')) .dependency(require('../support/adb'))
@ -58,8 +58,8 @@ module.exports = syrup.serial()
// Progress 0% to 70% // Progress 0% to 70%
sendProgress( sendProgress(
'pushing_app' 'pushing_app'
, 70 * Math.max(0, Math.min( , 50 * Math.max(0, Math.min(
70 50
, stats.bytesTransferred / contentLength , stats.bytesTransferred / contentLength
)) ))
) )
@ -90,9 +90,22 @@ module.exports = syrup.serial()
sendProgress('pushing_app', 0) sendProgress('pushing_app', 0)
pushApp() pushApp()
.then(function(apk) { .then(function(apk) {
// Progress 80% var start = 50
sendProgress('installing_app', 80) , end = 90
return adb.installRemote(options.serial, apk) , 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) .timeout(30000)
.then(function() { .then(function() {