diff --git a/dom/mobileconnection/MobileConnection.cpp b/dom/mobileconnection/MobileConnection.cpp index c69fa2940e0b..a88d1e05699a 100644 --- a/dom/mobileconnection/MobileConnection.cpp +++ b/dom/mobileconnection/MobileConnection.cpp @@ -300,7 +300,7 @@ bool MobileConnection::IsValidCallBarringProgram(int32_t aProgram) { return aProgram >= nsIMobileConnection::CALL_BARRING_PROGRAM_ALL_OUTGOING && - aProgram <= nsIMobileConnection::CALL_BARRING_PROGRAM_INCOMING_ROAMING; + aProgram <= nsIMobileConnection::CALL_BARRING_PROGRAM_INCOMING_SERVICE; } bool diff --git a/dom/mobileconnection/interfaces/nsIMobileConnectionService.idl b/dom/mobileconnection/interfaces/nsIMobileConnectionService.idl index c92e9ec05753..da8647d7597f 100644 --- a/dom/mobileconnection/interfaces/nsIMobileConnectionService.idl +++ b/dom/mobileconnection/interfaces/nsIMobileConnectionService.idl @@ -163,7 +163,7 @@ already_AddRefed NS_CreateMobileConnectionService(); %} -[scriptable, uuid(b9845f09-7cbb-46d0-b713-773d80844e0d)] +[scriptable, uuid(59a6d450-144b-47f9-8f4a-2132331e9e05)] interface nsIMobileConnection : nsISupports { /* @@ -214,6 +214,9 @@ interface nsIMobileConnection : nsISupports const long CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL_EXCEPT_HOME = 2; const long CALL_BARRING_PROGRAM_ALL_INCOMING = 3; const long CALL_BARRING_PROGRAM_INCOMING_ROAMING = 4; + const long CALL_BARRING_PROGRAM_ALL_SERVICE = 5; + const long CALL_BARRING_PROGRAM_OUTGOING_SERVICE = 6; + const long CALL_BARRING_PROGRAM_INCOMING_SERVICE = 7; /** * Calling line identification restriction constants. diff --git a/dom/mobileconnection/tests/marionette/manifest.ini b/dom/mobileconnection/tests/marionette/manifest.ini index 6b21b095be8e..0b54151df213 100644 --- a/dom/mobileconnection/tests/marionette/manifest.ini +++ b/dom/mobileconnection/tests/marionette/manifest.ini @@ -16,7 +16,7 @@ qemu = true [test_mobile_data_state.js] [test_mobile_roaming_preference.js] [test_call_barring_basic_operations.js] -[test_call_barring_get_option.js] +[test_call_barring_get_error.js] [test_call_barring_set_error.js] [test_call_barring_change_password.js] [test_mobile_set_radio.js] diff --git a/dom/mobileconnection/tests/marionette/test_call_barring_basic_operations.js b/dom/mobileconnection/tests/marionette/test_call_barring_basic_operations.js index c103d04d7b0b..4457cfa8f5e5 100644 --- a/dom/mobileconnection/tests/marionette/test_call_barring_basic_operations.js +++ b/dom/mobileconnection/tests/marionette/test_call_barring_basic_operations.js @@ -1,5 +1,5 @@ /* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ + * http://creativecommons.org/publicdomain/zero/1.0/ */ MARIONETTE_TIMEOUT = 60000; MARIONETTE_HEAD_JS = "head.js"; @@ -90,18 +90,41 @@ function testAllPrograms(aPrograms) { }, Promise.resolve()); } +function testUnsupportedPrograms() { + // Emulator now doesn't support these three programs. + let unsupportedPrograms = + [MozMobileConnection.CALL_BARRING_PROGRAM_ALL_SERVICE, + MozMobileConnection.CALL_BARRING_PROGRAM_OUTGOING_SERVICE, + MozMobileConnection.CALL_BARRING_PROGRAM_INCOMING_SERVICE]; + + return unsupportedPrograms.reduce((previousPromise, program) => { + return previousPromise + .then(() => log("Test " + program)) + .then(() => setProgram(program, false)) + .then(() => { + ok(false, "Should be rejected"); + }, error => { + is(error.name, "RequestNotSupported", + "Failed to setProgram: "+ error.name); + }); + }, Promise.resolve()); +} + // Start tests startTestCommon(function() { return Promise.resolve() - .then(() => setProgram(null, outgoingPrograms)) - .then(() => setProgram(null, incomingPrograms)) + .then(() => setAndCheckProgram(null, outgoingPrograms)) + .then(() => setAndCheckProgram(null, incomingPrograms)) .then(() => log("=== Test outgoing call barring programs ===")) .then(() => testAllPrograms(outgoingPrograms)) .then(() => log("=== Test incoming call barring programs ===")) .then(() => testAllPrograms(incomingPrograms)) + .then(() => log("=== Test unsupported call barring programs ===")) + .then(() => testUnsupportedPrograms()) + .catch(aError => ok(false, "promise rejects during test: " + aError)) - .then(() => setProgram(null, outgoingPrograms)) - .then(() => setProgram(null, incomingPrograms)); -}); \ No newline at end of file + .then(() => setAndCheckProgram(null, outgoingPrograms)) + .then(() => setAndCheckProgram(null, incomingPrograms)); +}); diff --git a/dom/mobileconnection/tests/marionette/test_call_barring_get_option.js b/dom/mobileconnection/tests/marionette/test_call_barring_get_error.js similarity index 93% rename from dom/mobileconnection/tests/marionette/test_call_barring_get_option.js rename to dom/mobileconnection/tests/marionette/test_call_barring_get_error.js index 28fda1d8f418..a561484503f5 100644 --- a/dom/mobileconnection/tests/marionette/test_call_barring_get_option.js +++ b/dom/mobileconnection/tests/marionette/test_call_barring_get_error.js @@ -1,5 +1,5 @@ /* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ + * http://creativecommons.org/publicdomain/zero/1.0/ */ MARIONETTE_TIMEOUT = 60000; MARIONETTE_HEAD_JS = "head.js"; @@ -21,7 +21,7 @@ startTestCommon(function() { // Test program .then(() => testGetCallBarringOption("InvalidParameter", { - program: 5, /* Invalid program */ + program: 8, /* Invalid program */ serviceClass: 0 })) diff --git a/dom/mobileconnection/tests/marionette/test_call_barring_set_error.js b/dom/mobileconnection/tests/marionette/test_call_barring_set_error.js index d8d72f63faa0..0dbd4e521da5 100644 --- a/dom/mobileconnection/tests/marionette/test_call_barring_set_error.js +++ b/dom/mobileconnection/tests/marionette/test_call_barring_set_error.js @@ -1,5 +1,5 @@ /* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ + * http://creativecommons.org/publicdomain/zero/1.0/ */ MARIONETTE_TIMEOUT = 60000; MARIONETTE_HEAD_JS = "head.js"; @@ -21,7 +21,7 @@ startTestCommon(function() { // Test program .then(() => testSetCallBarringOption("InvalidParameter", { - "program": 5, /* Invalid program */ + "program": 8, /* Invalid program */ "enabled": true, "password": "0000", "serviceClass": 0 diff --git a/dom/system/gonk/ril_consts.js b/dom/system/gonk/ril_consts.js index ee297682d4b5..d9a1ed652602 100644 --- a/dom/system/gonk/ril_consts.js +++ b/dom/system/gonk/ril_consts.js @@ -2972,6 +2972,9 @@ this.CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL = 1; this.CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL_EXCEPT_HOME = 2; this.CALL_BARRING_PROGRAM_ALL_INCOMING = 3; this.CALL_BARRING_PROGRAM_INCOMING_ROAMING = 4; +this.CALL_BARRING_PROGRAM_ALL_SERVICE = 5; +this.CALL_BARRING_PROGRAM_OUTGOING_SERVICE = 6; +this.CALL_BARRING_PROGRAM_INCOMING_SERVICE = 7; this.CALL_BARRING_PROGRAM_TO_FACILITY = {}; CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_ALL_OUTGOING] = ICC_CB_FACILITY_BAOC; @@ -2979,6 +2982,9 @@ CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL] = CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL_EXCEPT_HOME] = ICC_CB_FACILITY_BAOICxH; CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_ALL_INCOMING] = ICC_CB_FACILITY_BAIC; CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_INCOMING_ROAMING] = ICC_CB_FACILITY_BAICr; +CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_ALL_SERVICE] = ICC_CB_FACILITY_BA_ALL; +CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_OUTGOING_SERVICE] = ICC_CB_FACILITY_BA_MO; +CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_INCOMING_SERVICE] = ICC_CB_FACILITY_BA_MT; // CLIR constants. Must be in sync with nsIMobileConnectionService interface this.CLIR_DEFAULT = 0; diff --git a/dom/webidl/MozMobileConnection.webidl b/dom/webidl/MozMobileConnection.webidl index 2c63d99319f1..d398c9b296c2 100644 --- a/dom/webidl/MozMobileConnection.webidl +++ b/dom/webidl/MozMobileConnection.webidl @@ -56,6 +56,9 @@ interface MozMobileConnection : EventTarget const long CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL_EXCEPT_HOME = 2; const long CALL_BARRING_PROGRAM_ALL_INCOMING = 3; const long CALL_BARRING_PROGRAM_INCOMING_ROAMING = 4; + const long CALL_BARRING_PROGRAM_ALL_SERVICE = 5; + const long CALL_BARRING_PROGRAM_OUTGOING_SERVICE = 6; + const long CALL_BARRING_PROGRAM_INCOMING_SERVICE = 7; /** * Calling line identification restriction constants.