Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 MARIONETTE_TIMEOUT = 60000;
6 SpecialPowers.addPermission("mobileconnection", true, document);
8 // Permission changes can't change existing Navigator.prototype
9 // objects, so grab our objects from a new Navigator
10 let ifr = document.createElement("iframe");
11 let connection;
12 ifr.onload = function() {
13 connection = ifr.contentWindow.navigator.mozMobileConnections[0];
15 ok(connection instanceof ifr.contentWindow.MozMobileConnection,
16 "connection is instanceof " + connection.constructor);
18 setTimeout(testChangeCallBarringPasswordWithFailure, 0);
19 };
20 document.body.appendChild(ifr);
22 function testChangeCallBarringPasswordWithFailure() {
23 // Incorrect parameters, expect onerror callback.
24 let options = [
25 {pin: null, newPin: '0000'},
26 {pin: '0000', newPin: null},
27 {pin: null, newPin: null},
28 {pin: '000', newPin: '0000'},
29 {pin: '00000', newPin: '1111'},
30 {pin: 'abcd', newPin: 'efgh'},
31 ];
33 function do_test() {
34 for (let i = 0; i < options.length; i++) {
35 let request = connection.changeCallBarringPassword(options[i]);
37 request.onsuccess = function() {
38 ok(false, 'Unexpected result.');
39 setTimeout(cleanUp , 0);
40 };
42 request.onerror = function() {
43 ok(request.error.name === 'InvalidPassword', 'InvalidPassword');
44 if (i >= options.length) {
45 setTimeout(testChangeCallBarringPasswordWithSuccess, 0);
46 }
47 };
48 }
49 }
51 do_test();
52 }
54 function testChangeCallBarringPasswordWithSuccess() {
55 // TODO: Bug 906603 - B2G RIL: Support Change Call Barring Password on
56 // Emulator.
57 setTimeout(cleanUp , 0);
58 }
60 function cleanUp() {
61 SpecialPowers.removePermission("mobileconnection", document);
62 finish();
63 }