mirror of
https://github.com/openstf/stf
synced 2025-10-06 03:50:04 +02:00
Add sample of openBrowser() usage. Unfortunately it doesn't work because the radio buttons are acting weird.
This commit is contained in:
parent
0dfc502e80
commit
ced84f0f66
4 changed files with 24 additions and 4 deletions
|
@ -38,6 +38,13 @@ module.exports = syrup.serial()
|
||||||
})
|
})
|
||||||
|
|
||||||
router.on(wire.BrowserOpenMessage, function(channel, message) {
|
router.on(wire.BrowserOpenMessage, function(channel, message) {
|
||||||
|
if (message.browser) {
|
||||||
|
log.info('Opening "%s" in "%s"', message.url, message.browser)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
log.info('Opening "%s"', message.url)
|
||||||
|
}
|
||||||
|
|
||||||
var reply = wireutil.reply(options.serial)
|
var reply = wireutil.reply(options.serial)
|
||||||
adb.startActivity(options.serial, {
|
adb.startActivity(options.serial, {
|
||||||
action: 'android.intent.action.VIEW'
|
action: 'android.intent.action.VIEW'
|
||||||
|
|
|
@ -198,10 +198,10 @@ module.exports = function ControlServiceFactory(
|
||||||
return sendTwoWay('logcat.stop')
|
return sendTwoWay('logcat.stop')
|
||||||
}
|
}
|
||||||
|
|
||||||
this.openBrowser = function(browser, url) {
|
this.openBrowser = function(url, browser) {
|
||||||
return sendTwoWay('browser.open', {
|
return sendTwoWay('browser.open', {
|
||||||
url: url
|
url: url
|
||||||
, browser: browser.id
|
, browser: browser ? browser.id : null
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
module.exports = function NavigationCtrl($scope) {
|
module.exports = function NavigationCtrl($scope) {
|
||||||
|
$scope.activeBrowser = null
|
||||||
|
|
||||||
|
$scope.openURL = function() {
|
||||||
|
return $scope.control.openBrowser(
|
||||||
|
$scope.textURL
|
||||||
|
, $scope.activeBrowser
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.widget-container.fluid-height.stf-navigation
|
.widget-container.fluid-height.stf-navigation(ng-controller='NavigationCtrl')
|
||||||
.heading
|
.heading
|
||||||
i.fa.fa-globe
|
i.fa.fa-globe
|
||||||
span(translate) Navigation
|
span(translate) Navigation
|
||||||
|
@ -8,6 +8,12 @@
|
||||||
i.fa.fa-step-backward.pull-right(ng-click='back()', title='{{"Go Back"|translate}}', ng-if='$root.browser == "webview"')
|
i.fa.fa-step-backward.pull-right(ng-click='back()', title='{{"Go Back"|translate}}', ng-if='$root.browser == "webview"')
|
||||||
.widget-content.padded
|
.widget-content.padded
|
||||||
form
|
form
|
||||||
|
ul
|
||||||
|
li(ng-repeat='browser in device.browser.apps')
|
||||||
|
label
|
||||||
|
input(type='radio', ng-model='activeBrowser', ng-value='browser')
|
||||||
|
span {{ browser.type }}
|
||||||
|
|
||||||
.input-group
|
.input-group
|
||||||
input(type='text', placeholder='http://...', autocomplete='off', ng-model='textURL',
|
input(type='text', placeholder='http://...', autocomplete='off', ng-model='textURL',
|
||||||
typeahead='url for url in urlHistory | filter:$viewValue').form-control
|
typeahead='url for url in urlHistory | filter:$viewValue').form-control
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue