Bug 1169160 - [MobileConnection] Support more call barring program: all service, outgoing service and incoming service. r=hsinyi,aknow

--HG--
rename : dom/mobileconnection/tests/marionette/test_call_barring_get_option.js => dom/mobileconnection/tests/marionette/test_call_barring_get_error.js
This commit is contained in:
Edgar Chen 2015-05-28 15:41:55 +08:00
parent 2f56135da3
commit 6e38b077c4
8 changed files with 48 additions and 13 deletions

View File

@ -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

View File

@ -163,7 +163,7 @@ already_AddRefed<nsIMobileConnectionService>
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.

View File

@ -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]

View File

@ -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));
});
.then(() => setAndCheckProgram(null, outgoingPrograms))
.then(() => setAndCheckProgram(null, incomingPrograms));
});

View File

@ -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
}))

View File

@ -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

View File

@ -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;

View File

@ -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.