Bug 977440 - B2G RIL: add xpcshell tests for the processICCIOError. r=vicamo
authorYoshi Huang <allstars.chh@mozilla.com>
Thu, 27 Feb 2014 15:35:45 +0800
changeset 171857 4fa71658cf3c8f16a1dd0b587ac180fa5fbf8969
parent 171856 809aaff3075222f1880e0feca0ec77173b18fb7f
child 171858 d9ed4279dc6edc9d87107695238a3e200db9f3e6
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersvicamo
bugs977440
milestone30.0a1
Bug 977440 - B2G RIL: add xpcshell tests for the processICCIOError. r=vicamo From e13745bd7ccd720f66d75c75259af7fd7f4e6014 Mon Sep 17 00:00:00 2001 --- dom/system/gonk/tests/test_ril_worker_icc.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
dom/system/gonk/tests/test_ril_worker_icc.js
--- a/dom/system/gonk/tests/test_ril_worker_icc.js
+++ b/dom/system/gonk/tests/test_ril_worker_icc.js
@@ -2097,16 +2097,40 @@ add_test(function test_error_message_upd
   };
 
   do_test({contactType: "adn", contact: {contactId: ICCID + "1"}},
           CONTACT_ERR_CANNOT_ACCESS_PHONEBOOK);
 
   run_next_test();
 });
 
+add_test(function test_process_icc_io_error() {
+  let worker = newUint8Worker();
+  let context = worker.ContextPool._contexts[0];
+  let ioHelper = context.ICCIOHelper;
+
+  function do_test(errorCode, expectedErrorMsg) {
+    let called = false;
+    function errorCb(errorMsg) {
+      called = true;
+      do_check_eq(errorMsg, expectedErrorMsg);
+    }
+
+    ioHelper.processICCIOError({rilRequestError: errorCode,
+                                onerror: errorCb});
+    do_check_true(called);
+  }
+
+  for (let i = 0; i < ERROR_REJECTED_BY_REMOTE + 1; i++) {
+    do_test(i, RIL_ERROR_TO_GECKO_ERROR[i]);
+  }
+
+  run_next_test();
+});
+
 add_test(function test_personalization_state() {
   let worker = newUint8Worker();
   let context = worker.ContextPool._contexts[0];
   let ril = context.RIL;
 
   context.ICCRecordHelper.readICCID = function fakeReadICCID() {};
 
   function testPersonalization(isCdma, cardPersoState, geckoCardState) {