mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
7576dae8e6
--HG-- rename : dom/network/interfaces/nsIDOMMobileConnection.idl => dom/mobileconnection/interfaces/nsIDOMMobileConnection.idl rename : dom/network/interfaces/nsIMobileConnectionProvider.idl => dom/mobileconnection/interfaces/nsIMobileConnectionProvider.idl rename : dom/network/tests/marionette/manifest.ini => dom/mobileconnection/tests/marionette/manifest.ini rename : dom/network/tests/marionette/test_call_barring_change_password.js => dom/mobileconnection/tests/marionette/test_call_barring_change_password.js rename : dom/network/tests/marionette/test_call_barring_get_option.js => dom/mobileconnection/tests/marionette/test_call_barring_get_option.js rename : dom/network/tests/marionette/test_call_barring_set_error.js => dom/mobileconnection/tests/marionette/test_call_barring_set_error.js rename : dom/network/tests/marionette/test_mobile_connections_array_uninitialized.js => dom/mobileconnection/tests/marionette/test_mobile_connections_array_uninitialized.js rename : dom/network/tests/marionette/test_mobile_data_connection.js => dom/mobileconnection/tests/marionette/test_mobile_data_connection.js rename : dom/network/tests/marionette/test_mobile_data_location.js => dom/mobileconnection/tests/marionette/test_mobile_data_location.js rename : dom/network/tests/marionette/test_mobile_data_state.js => dom/mobileconnection/tests/marionette/test_mobile_data_state.js rename : dom/network/tests/marionette/test_mobile_icc_change.js => dom/mobileconnection/tests/marionette/test_mobile_icc_change.js rename : dom/network/tests/marionette/test_mobile_last_known_network.js => dom/mobileconnection/tests/marionette/test_mobile_last_known_network.js rename : dom/network/tests/marionette/test_mobile_mmi.js => dom/mobileconnection/tests/marionette/test_mobile_mmi.js rename : dom/network/tests/marionette/test_mobile_networks.js => dom/mobileconnection/tests/marionette/test_mobile_networks.js rename : dom/network/tests/marionette/test_mobile_operator_names.js => dom/mobileconnection/tests/marionette/test_mobile_operator_names.js rename : dom/network/tests/marionette/test_mobile_preferred_network_type.js => dom/mobileconnection/tests/marionette/test_mobile_preferred_network_type.js rename : dom/network/tests/marionette/test_mobile_preferred_network_type_by_setting.js => dom/mobileconnection/tests/marionette/test_mobile_preferred_network_type_by_setting.js rename : dom/network/tests/marionette/test_mobile_roaming_preference.js => dom/mobileconnection/tests/marionette/test_mobile_roaming_preference.js rename : dom/network/tests/marionette/test_mobile_set_radio.js => dom/mobileconnection/tests/marionette/test_mobile_set_radio.js rename : dom/network/tests/marionette/test_mobile_voice_state.js => dom/mobileconnection/tests/marionette/test_mobile_voice_state.js
85 lines
1.9 KiB
JavaScript
85 lines
1.9 KiB
JavaScript
/* Any copyright is dedicated to the Public Domain.
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
MARIONETTE_TIMEOUT = 30000;
|
|
|
|
SpecialPowers.addPermission("mobileconnection", true, document);
|
|
|
|
// Permission changes can't change existing Navigator.prototype
|
|
// objects, so grab our objects from a new Navigator
|
|
let ifr = document.createElement("iframe");
|
|
let connection;
|
|
ifr.onload = function() {
|
|
connection = ifr.contentWindow.navigator.mozMobileConnections[0];
|
|
ok(connection instanceof ifr.contentWindow.MozMobileConnection,
|
|
"connection is instanceof " + connection.constructor);
|
|
|
|
// The emulator's hard coded iccid value.
|
|
// See it here {B2G_HOME}/external/qemu/telephony/sim_card.c.
|
|
is(connection.iccId, 89014103211118510720);
|
|
|
|
runNextTest();
|
|
};
|
|
document.body.appendChild(ifr);
|
|
|
|
function waitForIccChange(callback) {
|
|
connection.addEventListener("iccchange", function handler() {
|
|
connection.removeEventListener("iccchange", handler);
|
|
callback();
|
|
});
|
|
}
|
|
|
|
function setRadioEnabled(enabled) {
|
|
let request = connection.setRadioEnabled(enabled);
|
|
|
|
request.onsuccess = function onsuccess() {
|
|
log('setRadioEnabled: ' + enabled);
|
|
};
|
|
|
|
request.onerror = function onerror() {
|
|
ok(false, "setRadioEnabled should be ok");
|
|
};
|
|
}
|
|
|
|
function testIccChangeOnRadioPowerOff() {
|
|
// Turn off radio
|
|
setRadioEnabled(false);
|
|
|
|
waitForIccChange(function() {
|
|
is(connection.iccId, null);
|
|
runNextTest();
|
|
});
|
|
}
|
|
|
|
function testIccChangeOnRadioPowerOn() {
|
|
// Turn on radio
|
|
setRadioEnabled(true);
|
|
|
|
waitForIccChange(function() {
|
|
// The emulator's hard coded iccid value.
|
|
is(connection.iccId, 89014103211118510720);
|
|
runNextTest();
|
|
});
|
|
}
|
|
|
|
let tests = [
|
|
testIccChangeOnRadioPowerOff,
|
|
testIccChangeOnRadioPowerOn
|
|
];
|
|
|
|
function runNextTest() {
|
|
let test = tests.shift();
|
|
if (!test) {
|
|
cleanUp();
|
|
return;
|
|
}
|
|
|
|
test();
|
|
}
|
|
|
|
function cleanUp() {
|
|
SpecialPowers.removePermission("mobileconnection", document);
|
|
|
|
finish();
|
|
}
|