Bug 1013847 - Part 2-2: Add xpcshell test for icc with app index is -1. r=hsinyi
authorEdgar Chen <echen@mozilla.com>
Wed, 20 Aug 2014 14:47:04 +0800
changeset 224079 a57d1aa27da9b569eb245fdebd98e3c62c9261de
parent 224078 4130d44be0e902fe3df2c3144836382037b9ca4d
child 224080 4ee8cb290dff8a30bf482425f90385f62972cfb9
push id1
push usersledru@mozilla.com
push dateThu, 04 Dec 2014 17:57:20 +0000
reviewershsinyi
bugs1013847
milestone34.0a1
Bug 1013847 - Part 2-2: Add xpcshell test for icc with app index is -1. r=hsinyi
dom/system/gonk/tests/test_ril_worker_icc_CardState.js
--- a/dom/system/gonk/tests/test_ril_worker_icc_CardState.js
+++ b/dom/system/gonk/tests/test_ril_worker_icc_CardState.js
@@ -149,8 +149,42 @@ add_test(function test_icc_permanent_blo
                        CARD_PINSTATE_ENABLED_PERM_BLOCKED,
                        CARD_PINSTATE_ENABLED_PERM_BLOCKED);
   testPermanentBlocked(0,
                        CARD_PINSTATE_UNKNOWN,
                        CARD_PINSTATE_ENABLED_PERM_BLOCKED);
 
   run_next_test();
 });
+
+/**
+ * Verify ICC without app index.
+ */
+add_test(function test_icc_without_app_index() {
+  const ICCID = "123456789";
+
+  let worker = newUint8Worker();
+  let context = worker.ContextPool._contexts[0];
+  let ril = context.RIL;
+
+  let iccStatus = {
+    cardState: CARD_STATE_PRESENT,
+    gsmUmtsSubscriptionAppIndex: -1,
+    universalPINState: CARD_PINSTATE_DISABLED,
+    apps: [
+    {
+      app_state: CARD_APPSTATE_READY
+    }]
+  };
+
+  context.ICCRecordHelper.readICCID = function fakeReadICCID() {
+    ril.iccInfo.iccid = ICCID;
+  };
+
+  ril._processICCStatus(iccStatus);
+
+  // Should read icc id event if the app index is -1.
+  do_check_eq(ril.iccInfo.iccid, ICCID);
+  // cardState is "unknown" if the app index is -1.
+  do_check_eq(ril.cardState, GECKO_CARDSTATE_UNKNOWN);
+
+  run_next_test();
+});