mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 995844: retrieve mozMobileConnection from 'workingFrame' in mobileconnect marionette tests. r=echen
This commit is contained in:
parent
fc2b50e7a1
commit
0cad46c745
@ -74,6 +74,8 @@ function wrapDomRequestAsPromise(aRequest) {
|
|||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let workingFrame;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get mozSettings value specified by @aKey.
|
* Get mozSettings value specified by @aKey.
|
||||||
*
|
*
|
||||||
@ -93,7 +95,8 @@ function wrapDomRequestAsPromise(aRequest) {
|
|||||||
* @return A deferred promise.
|
* @return A deferred promise.
|
||||||
*/
|
*/
|
||||||
function getSettings(aKey, aAllowError) {
|
function getSettings(aKey, aAllowError) {
|
||||||
let request = navigator.mozSettings.createLock().get(aKey);
|
let request =
|
||||||
|
workingFrame.contentWindow.navigator.mozSettings.createLock().get(aKey);
|
||||||
return wrapDomRequestAsPromise(request)
|
return wrapDomRequestAsPromise(request)
|
||||||
.then(function resolve(aEvent) {
|
.then(function resolve(aEvent) {
|
||||||
ok(true, "getSettings(" + aKey + ") - success");
|
ok(true, "getSettings(" + aKey + ") - success");
|
||||||
@ -120,7 +123,8 @@ function getSettings(aKey, aAllowError) {
|
|||||||
* @return A deferred promise.
|
* @return A deferred promise.
|
||||||
*/
|
*/
|
||||||
function setSettings(aSettings, aAllowError) {
|
function setSettings(aSettings, aAllowError) {
|
||||||
let request = navigator.mozSettings.createLock().set(aSettings);
|
let request =
|
||||||
|
workingFrame.contentWindow.navigator.mozSettings.createLock().set(aSettings);
|
||||||
return wrapDomRequestAsPromise(request)
|
return wrapDomRequestAsPromise(request)
|
||||||
.then(function resolve() {
|
.then(function resolve() {
|
||||||
ok(true, "setSettings(" + JSON.stringify(aSettings) + ")");
|
ok(true, "setSettings(" + JSON.stringify(aSettings) + ")");
|
||||||
@ -195,7 +199,6 @@ function setDataApnSettings(aApnSettings, aAllowError) {
|
|||||||
return setSettings1(SETTINGS_KEY_DATA_APN_SETTINGS, aApnSettings, aAllowError);
|
return setSettings1(SETTINGS_KEY_DATA_APN_SETTINGS, aApnSettings, aAllowError);
|
||||||
}
|
}
|
||||||
|
|
||||||
let workingFrame;
|
|
||||||
let mobileConnection;
|
let mobileConnection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -282,7 +285,8 @@ function waitForManagerEvent(aEventName, aServiceId) {
|
|||||||
|
|
||||||
let mobileConn = mobileConnection;
|
let mobileConn = mobileConnection;
|
||||||
if (aServiceId !== undefined) {
|
if (aServiceId !== undefined) {
|
||||||
mobileConn = navigator.mozMobileConnections[aServiceId];
|
mobileConn =
|
||||||
|
workingFrame.contentWindow.navigator.mozMobileConnections[aServiceId];
|
||||||
}
|
}
|
||||||
|
|
||||||
mobileConn.addEventListener(aEventName, function onevent(aEvent) {
|
mobileConn.addEventListener(aEventName, function onevent(aEvent) {
|
||||||
@ -407,7 +411,8 @@ function setDataEnabledAndWait(aEnabled, aServiceId) {
|
|||||||
Promise.all(promises).then(function keepWaiting() {
|
Promise.all(promises).then(function keepWaiting() {
|
||||||
let mobileConn = mobileConnection;
|
let mobileConn = mobileConnection;
|
||||||
if (aServiceId !== undefined) {
|
if (aServiceId !== undefined) {
|
||||||
mobileConn = navigator.mozMobileConnections[aServiceId];
|
mobileConn =
|
||||||
|
workingFrame.contentWindow.navigator.mozMobileConnections[aServiceId];
|
||||||
}
|
}
|
||||||
// To ignore some transient states, we only resolve that deferred promise
|
// To ignore some transient states, we only resolve that deferred promise
|
||||||
// when the |connected| state equals to the expected one and never rejects.
|
// when the |connected| state equals to the expected one and never rejects.
|
||||||
@ -467,7 +472,8 @@ function setEmulatorRoamingAndWait(aRoaming, aServiceId) {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
let mobileConn = mobileConnection;
|
let mobileConn = mobileConnection;
|
||||||
if (aServiceId !== undefined) {
|
if (aServiceId !== undefined) {
|
||||||
mobileConn = navigator.mozMobileConnections[aServiceId];
|
mobileConn =
|
||||||
|
workingFrame.contentWindow.navigator.mozMobileConnections[aServiceId];
|
||||||
}
|
}
|
||||||
is(mobileConn[aWhich].roaming, aRoaming,
|
is(mobileConn[aWhich].roaming, aRoaming,
|
||||||
aWhich + ".roaming")
|
aWhich + ".roaming")
|
||||||
|
@ -6,8 +6,8 @@ MARIONETTE_HEAD_JS = "head.js";
|
|||||||
|
|
||||||
const SETTINGS_KEY_DATA_DEFAULT_ID = "ril.data.defaultServiceId";
|
const SETTINGS_KEY_DATA_DEFAULT_ID = "ril.data.defaultServiceId";
|
||||||
|
|
||||||
let connections = window.navigator.mozMobileConnections;
|
let connections;
|
||||||
let numOfRadioInterfaces = getNumOfRadioInterfaces();
|
let numOfRadioInterfaces;
|
||||||
let currentDataDefaultId = 0;
|
let currentDataDefaultId = 0;
|
||||||
|
|
||||||
function muxModem(id) {
|
function muxModem(id) {
|
||||||
@ -142,6 +142,9 @@ function testDisableData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
startDSDSTestCommon(function() {
|
startDSDSTestCommon(function() {
|
||||||
|
connections = workingFrame.contentWindow.navigator.mozMobileConnections;
|
||||||
|
numOfRadioInterfaces = getNumOfRadioInterfaces();
|
||||||
|
|
||||||
return testEnableData()
|
return testEnableData()
|
||||||
.then(testSwitchDefaultDataToSimTwo)
|
.then(testSwitchDefaultDataToSimTwo)
|
||||||
.then(testDisableDataRoamingWhileRoaming)
|
.then(testDisableDataRoamingWhileRoaming)
|
||||||
|
@ -8,6 +8,6 @@ startTestCommon(function() {
|
|||||||
let connections =
|
let connections =
|
||||||
workingFrame.contentWindow.navigator.mozMobileConnections;
|
workingFrame.contentWindow.navigator.mozMobileConnections;
|
||||||
|
|
||||||
let num = SpecialPowers.getIntPref("ril.numRadioInterfaces");
|
let num = getNumOfRadioInterfaces();
|
||||||
is(connections.length, num, "ril.numRadioInterfaces");
|
is(connections.length, num, "ril.numRadioInterfaces");
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user