mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 959499 - Use wifimanager for on-device mochitests. r=ahal
This commit is contained in:
parent
cd7f1b939a
commit
493f01e370
@ -4,6 +4,13 @@
|
||||
|
||||
let outOfProcess = __marionetteParams[0]
|
||||
let mochitestUrl = __marionetteParams[1]
|
||||
let onDevice = __marionetteParams[2]
|
||||
let wifiSettings = __marionetteParams[3]
|
||||
let prefs = Components.classes["@mozilla.org/preferences-service;1"].
|
||||
getService(Components.interfaces.nsIPrefBranch)
|
||||
|
||||
if (wifiSettings)
|
||||
wifiSettings = JSON.parse(wifiSettings);
|
||||
|
||||
const CHILD_SCRIPT = "chrome://specialpowers/content/specialpowers.js";
|
||||
const CHILD_SCRIPT_API = "chrome://specialpowers/content/specialpowersAPI.js";
|
||||
@ -77,4 +84,29 @@ if (outOfProcess) {
|
||||
specialPowersObserver._isFrameScriptLoaded = true;
|
||||
}
|
||||
|
||||
container.src = mochitestUrl;
|
||||
|
||||
if (onDevice) {
|
||||
let manager = navigator.mozWifiManager;
|
||||
let con = manager.connection;
|
||||
if(wifiSettings) {
|
||||
if (manager.enabled) {
|
||||
manager.associate(wifiSettings);
|
||||
} else {
|
||||
manager.onenabled = function () {
|
||||
manager.associate(wifiSettings);
|
||||
};
|
||||
}
|
||||
}
|
||||
else if (con.status == 'connected') {
|
||||
container.src = mochitestUrl;
|
||||
}
|
||||
|
||||
manager.onstatuschange = function (event) {
|
||||
if (event.status == 'connected') {
|
||||
prefs.setIntPref("network.proxy.type", 2);
|
||||
container.src = mochitestUrl;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
container.src = mochitestUrl;
|
||||
}
|
||||
|
@ -12,7 +12,6 @@
|
||||
"power":{},
|
||||
"webapps-manage":{},
|
||||
"mobileconnection":{},
|
||||
"mozBluetooth":{},
|
||||
"bluetooth":{},
|
||||
"telephony":{},
|
||||
"voicemail":{},
|
||||
@ -22,7 +21,6 @@
|
||||
"camera":{},
|
||||
"geolocation":{},
|
||||
"wifi-manage":{},
|
||||
"wifi":{},
|
||||
"desktop-notification":{},
|
||||
"idle":{},
|
||||
"network-events":{},
|
||||
|
@ -571,6 +571,13 @@ class B2GOptions(MochitestOptions):
|
||||
"help": "Architecture of emulator to use: x86 or arm",
|
||||
"default": None,
|
||||
}],
|
||||
[["--wifi"],
|
||||
{ "action": "store",
|
||||
"type": "string",
|
||||
"dest": "wifi",
|
||||
"help": "Devine wifi configuration for on device mochitest",
|
||||
"default": False,
|
||||
}],
|
||||
[["--sdcard"],
|
||||
{ "action": "store",
|
||||
"type": "string",
|
||||
|
@ -113,6 +113,8 @@ class B2GMochitest(MochitestUtilsMixin):
|
||||
self.startWebServer(options)
|
||||
self.startWebSocketServer(options, None)
|
||||
self.buildURLOptions(options, {'MOZ_HIDE_RESULTS_TABLE': '1'})
|
||||
self.test_script_args.append(not options.emulator)
|
||||
self.test_script_args.append(options.wifi)
|
||||
|
||||
if options.debugger or not options.autorun:
|
||||
timeout = None
|
||||
|
Loading…
Reference in New Issue
Block a user