Bug 1137093 - Part 11: Fix xpcshell test. r=hsinyi
authorSzu-Yu Chen [:aknow] <szchen@mozilla.com>
Tue, 24 Mar 2015 18:04:50 +0800
changeset 264434 7690d9e5ba8a4d485392dd3a88833b6e3d06a2f4
parent 264433 db752db6d34a2a6c4214c5c060c56471fa8da7b5
child 264435 5d94a95e7a76281db9c13fa4a13a608b17e0b90e
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershsinyi
bugs1137093
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1137093 - Part 11: Fix xpcshell test. r=hsinyi
dom/system/gonk/tests/test_ril_worker_barring_password.js
dom/system/gonk/tests/test_ril_worker_ssn.js
--- a/dom/system/gonk/tests/test_ril_worker_barring_password.js
+++ b/dom/system/gonk/tests/test_ril_worker_barring_password.js
@@ -36,28 +36,28 @@ add_test(function test_change_call_barri
 
   do_test(ICC_CB_FACILITY_BA_ALL, PIN, NEW_PIN);
 
   run_next_test();
 });
 
 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 =
     function fakeChangeCallBarringPassword(options) {
       barringPasswordOptions = options;
       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();
 });
--- a/dom/system/gonk/tests/test_ril_worker_ssn.js
+++ b/dom/system/gonk/tests/test_ril_worker_ssn.js
@@ -40,61 +40,65 @@ add_test(function test_notification() {
     0: new Call(0, '00000')
   };
 
   let twoCalls = {
     0: new Call(0, '00000'),
     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
       code: code,
       index: 0,
       type: 0,
       number: number
     };
 
     context.RIL._processSuppSvcNotification(notificationInfo);
 
     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();
 });