Bug 1137093 - Part 11: Fix xpcshell test. r=hsinyi

--HG--
extra : rebase_source : ac4661b3e531d6ee58119d57259fb6fb25acc65a
This commit is contained in:
Szu-Yu Chen [:aknow] 2015-03-24 18:04:50 +08:00
Родитель a9ebecf8dc
Коммит f7361a2519
2 изменённых файлов: 25 добавлений и 21 удалений

Просмотреть файл

@ -41,12 +41,8 @@ add_test(function test_change_call_barring_password() {
add_test(function test_check_change_call_barring_password_result() {
let barringPasswordOptions;
let worker = newWorker({
postMessage: function(message) {
equal(barringPasswordOptions.pin, PIN);
equal(barringPasswordOptions.newPin, NEW_PIN);
}
});
let workerHelper = newInterceptWorker();
let worker = workerHelper.worker;
let context = worker.ContextPool._contexts[0];
context.RIL.changeCallBarringPassword =
@ -55,9 +51,13 @@ add_test(function test_check_change_call_barring_password_result() {
context.RIL[REQUEST_CHANGE_BARRING_PASSWORD](0, {
rilRequestError: ERROR_SUCCESS
});
}
};
context.RIL.changeCallBarringPassword({pin: PIN, newPin: NEW_PIN});
let postedMessage = workerHelper.postedMessage;
equal(barringPasswordOptions.pin, PIN);
equal(barringPasswordOptions.newPin, NEW_PIN);
run_next_test();
});

Просмотреть файл

@ -45,16 +45,17 @@ add_test(function test_notification() {
1: new Call(1, '11111')
};
function testNotification(calls, code, number, resultNotification,
resultCallIndex) {
function testNotification(calls, code, number, resultNotification) {
let testInfo = {calls: calls, code: code, number: number,
resultNotification: resultNotification,
resultCallIndex: resultCallIndex};
resultNotification: resultNotification};
do_print('Test case info: ' + JSON.stringify(testInfo));
// Set current calls.
context.RIL._processCalls(calls);
context.RIL.sendChromeMessage({
rilMessageType: "currentCalls",
calls: calls
});
let notificationInfo = {
notificationType: 1, // MT
@ -68,33 +69,36 @@ add_test(function test_notification() {
let postedMessage = workerHelper.postedMessage;
equal(postedMessage.rilMessageType, 'suppSvcNotification');
equal(postedMessage.number, number);
equal(postedMessage.notification, resultNotification);
equal(postedMessage.callIndex, resultCallIndex);
// Clear all existed calls.
context.RIL._processCalls({});
context.RIL.sendChromeMessage({
rilMessageType: "currentCalls",
calls: {}
});
}
testNotification(oneCall, SUPP_SVC_NOTIFICATION_CODE2_PUT_ON_HOLD, null,
GECKO_SUPP_SVC_NOTIFICATION_REMOTE_HELD, 0);
GECKO_SUPP_SVC_NOTIFICATION_REMOTE_HELD);
testNotification(oneCall, SUPP_SVC_NOTIFICATION_CODE2_RETRIEVED, null,
GECKO_SUPP_SVC_NOTIFICATION_REMOTE_RESUMED, 0);
GECKO_SUPP_SVC_NOTIFICATION_REMOTE_RESUMED);
testNotification(twoCalls, SUPP_SVC_NOTIFICATION_CODE2_PUT_ON_HOLD, null,
GECKO_SUPP_SVC_NOTIFICATION_REMOTE_HELD, -1);
GECKO_SUPP_SVC_NOTIFICATION_REMOTE_HELD);
testNotification(twoCalls, SUPP_SVC_NOTIFICATION_CODE2_RETRIEVED, null,
GECKO_SUPP_SVC_NOTIFICATION_REMOTE_RESUMED, -1);
GECKO_SUPP_SVC_NOTIFICATION_REMOTE_RESUMED);
testNotification(twoCalls, SUPP_SVC_NOTIFICATION_CODE2_PUT_ON_HOLD, '00000',
GECKO_SUPP_SVC_NOTIFICATION_REMOTE_HELD, 0);
GECKO_SUPP_SVC_NOTIFICATION_REMOTE_HELD);
testNotification(twoCalls, SUPP_SVC_NOTIFICATION_CODE2_PUT_ON_HOLD, '11111',
GECKO_SUPP_SVC_NOTIFICATION_REMOTE_HELD, 1);
GECKO_SUPP_SVC_NOTIFICATION_REMOTE_HELD);
testNotification(twoCalls, SUPP_SVC_NOTIFICATION_CODE2_PUT_ON_HOLD, '22222',
GECKO_SUPP_SVC_NOTIFICATION_REMOTE_HELD, -1);
GECKO_SUPP_SVC_NOTIFICATION_REMOTE_HELD);
run_next_test();
});