Bug 893791 - Fix xpcshell tests failed in test_ril_worker_mmi.js. r=vyang
authorEdgar Chen <echen@mozilla.com>
Mon, 15 Jul 2013 23:04:22 +0800
changeset 138715 fe9851ec4198549a54c4d8d1eff75e8c9c288e13
parent 138714 099014c88d3c6440b3e5223781bfffbf1d353513
child 138716 5d1db64bb6bd21eee9c9d605af8851ecaa413bd6
push id24964
push userryanvm@gmail.com
push dateTue, 16 Jul 2013 20:04:09 +0000
treeherderautoland@fd10ead17ace [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvyang
bugs893791
milestone25.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 893791 - Fix xpcshell tests failed in test_ril_worker_mmi.js. r=vyang
dom/system/gonk/tests/test_ril_worker_mmi.js
--- a/dom/system/gonk/tests/test_ril_worker_mmi.js
+++ b/dom/system/gonk/tests/test_ril_worker_mmi.js
@@ -40,16 +40,17 @@ function getWorker() {
 }
 
 function testSendMMI(mmi, error) {
   let workerhelper = getWorker();
   let worker = workerhelper.worker;
 
   do_print("worker.postMessage " + worker.postMessage);
 
+  worker.RIL.radioState = GECKO_RADIOSTATE_READY;
   worker.RIL.sendMMI({mmi: mmi});
 
   let postedMessage = workerhelper.postedMessage;
 
   do_check_eq(postedMessage.rilMessageType, "sendMMI");
   do_check_eq(postedMessage.errorMsg, error);
 }
 
@@ -333,16 +334,17 @@ function setCallForwardSuccess(mmi) {
   let worker = workerhelper.worker;
 
   worker.RIL.setCallForward = function fakeSetCallForward(options) {
     worker.RIL[REQUEST_SET_CALL_FORWARD](0, {
       rilRequestError: ERROR_SUCCESS
     });
   };
 
+  worker.RIL.radioState = GECKO_RADIOSTATE_READY;
   worker.RIL.sendMMI({mmi: mmi});
 
   let postedMessage = workerhelper.postedMessage;
 
   do_check_eq(postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
   do_check_true(postedMessage.success);
 }
 
@@ -379,16 +381,17 @@ add_test(function test_sendMMI_call_forw
       1,   // rules.active
       1    // rulesLength
     ];
     worker.RIL[REQUEST_QUERY_CALL_FORWARD_STATUS](1, {
       rilRequestError: ERROR_SUCCESS
     });
   };
 
+  worker.RIL.radioState = GECKO_RADIOSTATE_READY;
   worker.RIL.sendMMI({mmi: "*#21#"});
 
   let postedMessage = workerhelper.postedMessage;
 
   do_check_eq(postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
   do_check_true(postedMessage.success);
   do_check_true(Array.isArray(postedMessage.rules));
   do_check_eq(postedMessage.rules.length, 1);
@@ -408,16 +411,17 @@ add_test(function test_sendMMI_call_forw
   };
 
   worker.RIL.queryCallForwardStatus = function fakeQueryCallForward(options) {
     worker.RIL[REQUEST_QUERY_CALL_FORWARD_STATUS](1, {
       rilRequestError: ERROR_SUCCESS
     });
   };
 
+  worker.RIL.radioState = GECKO_RADIOSTATE_READY;
   worker.RIL.sendMMI({mmi: "*#21#"});
 
   let postedMessage = workerhelper.postedMessage;
 
   do_check_eq(postedMessage.errorMsg, GECKO_ERROR_GENERIC_FAILURE);
   do_check_false(postedMessage.success);
 
   run_next_test();
@@ -471,16 +475,17 @@ add_test(function test_sendMMI_change_PI
   let worker = workerhelper.worker;
 
   worker.RIL.changeICCPIN = function fakeChangeICCPIN(options) {
     worker.RIL[REQUEST_ENTER_SIM_PIN](0, {
       rilRequestError: ERROR_SUCCESS
     });
   }
 
+  worker.RIL.radioState = GECKO_RADIOSTATE_READY;
   worker.RIL.sendMMI({mmi: "**04*1234*4567*4567#"});
 
   let postedMessage = workerhelper.postedMessage;
 
   do_check_eq (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
   do_check_true(postedMessage.success);
 
   run_next_test();
@@ -515,16 +520,17 @@ add_test(function test_sendMMI_change_PI
   let worker = workerhelper.worker;
 
   worker.RIL.changeICCPIN2 = function fakeChangeICCPIN2(options){
     worker.RIL[REQUEST_ENTER_SIM_PIN2](0, {
       rilRequestError: ERROR_SUCCESS
     });
   }
 
+  worker.RIL.radioState = GECKO_RADIOSTATE_READY;
   worker.RIL.sendMMI({mmi: "**042*1234*4567*4567#"});
 
   let postedMessage = workerhelper.postedMessage;
 
   do_check_eq (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
   do_check_true(postedMessage.success);
 
   run_next_test();
@@ -559,16 +565,17 @@ add_test(function test_sendMMI_unblock_P
   let worker = workerhelper.worker;
 
   worker.RIL.enterICCPUK = function fakeEnterICCPUK(options){
     worker.RIL[REQUEST_ENTER_SIM_PUK](0, {
       rilRequestError: ERROR_SUCCESS
     });
   }
 
+  worker.RIL.radioState = GECKO_RADIOSTATE_READY;
   worker.RIL.sendMMI({mmi: "**05*1234*4567*4567#"});
 
   let postedMessage = workerhelper.postedMessage;
 
   do_check_eq (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
   do_check_true(postedMessage.success);
 
   run_next_test();
@@ -603,16 +610,17 @@ add_test(function test_sendMMI_unblock_P
   let worker = workerhelper.worker;
 
   worker.RIL.enterICCPUK2 = function fakeEnterICCPUK2(options){
     worker.RIL[REQUEST_ENTER_SIM_PUK2](0, {
       rilRequestError: ERROR_SUCCESS
     });
   }
 
+  worker.RIL.radioState = GECKO_RADIOSTATE_READY;
   worker.RIL.sendMMI({mmi: "**052*1234*4567*4567#"});
 
   let postedMessage = workerhelper.postedMessage;
 
   do_check_eq (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
   do_check_true(postedMessage.success);
 
   run_next_test();
@@ -707,16 +715,17 @@ add_test(function test_sendMMI_USSD() {
 
   worker.RIL.sendUSSD = function fakeSendUSSD(options){
     ussdOptions = options;
     worker.RIL[REQUEST_SEND_USSD](0, {
       rilRequestError: ERROR_SUCCESS
     });
   }
 
+  worker.RIL.radioState = GECKO_RADIOSTATE_READY;
   worker.RIL.sendMMI({mmi: "*123#"});
 
   let postedMessage = workerhelper.postedMessage;
 
   do_check_eq(ussdOptions.ussd, "*123#");
   do_check_eq (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
   do_check_true(postedMessage.success);
   do_check_true(worker.RIL._ussdSession);
@@ -731,16 +740,17 @@ add_test(function test_sendMMI_USSD_erro
 
   worker.RIL.sendUSSD = function fakeSendUSSD(options){
     ussdOptions = options;
     worker.RIL[REQUEST_SEND_USSD](0, {
       rilRequestError: ERROR_GENERIC_FAILURE
     });
   }
 
+  worker.RIL.radioState = GECKO_RADIOSTATE_READY;
   worker.RIL.sendMMI({mmi: "*123#"});
 
   let postedMessage = workerhelper.postedMessage;
 
   do_check_eq(ussdOptions.ussd, "*123#");
   do_check_eq (postedMessage.errorMsg, GECKO_ERROR_GENERIC_FAILURE);
   do_check_false(postedMessage.success);
   do_check_false(worker.RIL._ussdSession);