Bug 1052825 - Part 3: RIL and test changes for lockType WebIDL enum. r=hsinyi
authorEdgar Chen <echen@mozilla.com>
Wed, 12 Nov 2014 12:39:04 +0800
changeset 219812 100e9676dae8aa603a4df2f9ae6cad5803686370
parent 219811 a7c483766f6090665a3ad145c1c13358b63f05cd
child 219813 e55b62072a39b38b78c9601370caff8ea2ef2460
push id10419
push usercbook@mozilla.com
push dateTue, 16 Dec 2014 12:45:27 +0000
treeherderfx-team@ec87657146eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershsinyi
bugs1052825
milestone37.0a1
Bug 1052825 - Part 3: RIL and test changes for lockType WebIDL enum. r=hsinyi
dom/icc/tests/marionette/test_icc_card_lock_get_retry_count.js
dom/system/gonk/RILContentHelper.js
dom/system/gonk/RadioInterfaceLayer.js
dom/system/gonk/ril_consts.js
dom/system/gonk/ril_worker.js
dom/system/gonk/tests/test_ril_worker_icc_CardLock.js
--- a/dom/icc/tests/marionette/test_icc_card_lock_get_retry_count.js
+++ b/dom/icc/tests/marionette/test_icc_card_lock_get_retry_count.js
@@ -1,34 +1,37 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 MARIONETTE_TIMEOUT = 60000;
 MARIONETTE_HEAD_JS = "head.js";
 
 function testGetCardLockRetryCount(aIcc, aLockType, aRetryCount) {
   log("testGetCardLockRetryCount for " + aLockType);
-  return aIcc.getCardLockRetryCount(aLockType)
-    .then((aResult) => {
-      if (!aRetryCount) {
-        ok(false, "getCardLockRetryCount(" + aLockType + ") should not success");
-        return;
-      }
+
+  try {
+    return aIcc.getCardLockRetryCount(aLockType)
+      .then((aResult) => {
+        if (!aRetryCount) {
+          ok(false, "getCardLockRetryCount(" + aLockType + ") should not success");
+          return;
+        }
 
-      // Check the request result.
-      is(aResult.retryCount, aRetryCount, "result.retryCount");
-    }, (aError) => {
-      if (aRetryCount) {
-        ok(false, "getCardLockRetryCount(" + aLockType + ") should not fail");
-        return;
-      }
-
-      // Check the error.
-      is(aError.name, "GenericFailure", "error.name");
-    });
+        // Check the request result.
+        is(aResult.retryCount, aRetryCount, "result.retryCount");
+      }, (aError) => {
+        if (aRetryCount) {
+          ok(false, "getCardLockRetryCount(" + aLockType + ") should not fail" +
+                    aError.name);
+        }
+      });
+  } catch (e) {
+    ok(!aRetryCount, "caught an exception: " + e);
+    return Promise.resolve();
+  }
 }
 
 // Start tests
 startTestCommon(function() {
   let icc = getMozIcc();
 
   // Read PIN-lock retry count.
   // The default PIN-lock retry count hard coded in emulator is 3.
--- a/dom/system/gonk/RILContentHelper.js
+++ b/dom/system/gonk/RILContentHelper.js
@@ -246,63 +246,99 @@ RILContentHelper.prototype = {
         requestId: requestId,
         mvnoType: mvnoType,
         mvnoData: mvnoData
       }
     });
     return request;
   },
 
-  getCardLockState: function(clientId, window, lockType) {
+  getCardLockEnabled: function(clientId, window, lockType) {
     if (window == null) {
       throw Components.Exception("Can't get window object",
                                   Cr.NS_ERROR_UNEXPECTED);
     }
+
     let request = Services.DOMRequest.createRequest(window);
     let requestId = this.getRequestId(request);
     this._windowsMap[requestId] = window;
 
-    cpmm.sendAsyncMessage("RIL:GetCardLockState", {
+    cpmm.sendAsyncMessage("RIL:GetCardLockEnabled", {
       clientId: clientId,
       data: {
         lockType: lockType,
         requestId: requestId
       }
     });
     return request;
   },
 
-  unlockCardLock: function(clientId, window, info) {
+  unlockCardLock: function(clientId, window, lockType, password, newPin) {
+    if (window == null) {
+      throw Components.Exception("Can't get window object",
+                                  Cr.NS_ERROR_UNEXPECTED);
+    }
+
+    let request = Services.DOMRequest.createRequest(window);
+    let requestId = this.getRequestId(request);
+    this._windowsMap[requestId] = window;
+
+    cpmm.sendAsyncMessage("RIL:UnlockCardLock", {
+      clientId: clientId,
+      data: {
+        lockType: lockType,
+        password: password,
+        newPin: newPin,
+        requestId: requestId
+      }
+    });
+    return request;
+  },
+
+  setCardLockEnabled: function(clientId, window, lockType, password, enabled) {
     if (window == null) {
       throw Components.Exception("Can't get window object",
                                   Cr.NS_ERROR_UNEXPECTED);
     }
+
     let request = Services.DOMRequest.createRequest(window);
-    info.requestId = this.getRequestId(request);
-    this._windowsMap[info.requestId] = window;
+    let requestId = this.getRequestId(request);
+    this._windowsMap[requestId] = window;
 
-    cpmm.sendAsyncMessage("RIL:UnlockCardLock", {
+    cpmm.sendAsyncMessage("RIL:SetCardLockEnabled", {
       clientId: clientId,
-      data: info
+      data: {
+        lockType: lockType,
+        password: password,
+        enabled: enabled,
+        requestId: requestId
+      }
     });
     return request;
   },
 
-  setCardLock: function(clientId, window, info) {
+  changeCardLockPassword: function(clientId, window, lockType, password,
+                                   newPassword) {
     if (window == null) {
       throw Components.Exception("Can't get window object",
                                   Cr.NS_ERROR_UNEXPECTED);
     }
+
     let request = Services.DOMRequest.createRequest(window);
-    info.requestId = this.getRequestId(request);
-    this._windowsMap[info.requestId] = window;
+    let requestId = this.getRequestId(request);
+    this._windowsMap[requestId] = window;
 
-    cpmm.sendAsyncMessage("RIL:SetCardLock", {
+    cpmm.sendAsyncMessage("RIL:ChangeCardLockPassword", {
       clientId: clientId,
-      data: info
+      data: {
+        lockType: lockType,
+        password: password,
+        newPassword: newPassword,
+        requestId: requestId
+      }
     });
     return request;
   },
 
   getCardLockRetryCount: function(clientId, window, lockType) {
     if (window == null) {
       throw Components.Exception("Can't get window object",
                                   Cr.NS_ERROR_UNEXPECTED);
--- a/dom/system/gonk/RadioInterfaceLayer.js
+++ b/dom/system/gonk/RadioInterfaceLayer.js
@@ -98,19 +98,20 @@ const NETWORK_TYPE_MOBILE_IMS  = Ci.nsIN
 const NETWORK_TYPE_MOBILE_DUN  = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN;
 
 const RIL_IPC_ICCMANAGER_MSG_NAMES = [
   "RIL:GetRilContext",
   "RIL:SendStkResponse",
   "RIL:SendStkMenuSelection",
   "RIL:SendStkTimerExpiration",
   "RIL:SendStkEventDownload",
-  "RIL:GetCardLockState",
+  "RIL:GetCardLockEnabled",
   "RIL:UnlockCardLock",
-  "RIL:SetCardLock",
+  "RIL:SetCardLockEnabled",
+  "RIL:ChangeCardLockPassword",
   "RIL:GetCardLockRetryCount",
   "RIL:IccOpenChannel",
   "RIL:IccExchangeAPDU",
   "RIL:IccCloseChannel",
   "RIL:ReadIccContacts",
   "RIL:UpdateIccContact",
   "RIL:RegisterIccMsg",
   "RIL:MatchMvno"
@@ -1826,26 +1827,30 @@ RadioInterface.prototype = {
   /**
    * Process a message from the content process.
    */
   receiveMessage: function(msg) {
     switch (msg.name) {
       case "RIL:GetRilContext":
         // This message is sync.
         return this.rilContext;
-      case "RIL:GetCardLockState":
-        this.workerMessenger.sendWithIPCMessage(msg, "iccGetCardLockState",
+      case "RIL:GetCardLockEnabled":
+        this.workerMessenger.sendWithIPCMessage(msg, "iccGetCardLockEnabled",
                                                 "RIL:GetCardLockResult");
         break;
       case "RIL:UnlockCardLock":
         this.workerMessenger.sendWithIPCMessage(msg, "iccUnlockCardLock",
                                                 "RIL:SetUnlockCardLockResult");
         break;
-      case "RIL:SetCardLock":
-        this.workerMessenger.sendWithIPCMessage(msg, "iccSetCardLock",
+      case "RIL:SetCardLockEnabled":
+        this.workerMessenger.sendWithIPCMessage(msg, "iccSetCardLockEnabled",
+                                                "RIL:SetUnlockCardLockResult");
+        break;
+      case "RIL:ChangeCardLockPassword":
+        this.workerMessenger.sendWithIPCMessage(msg, "iccChangeCardLockPassword",
                                                 "RIL:SetUnlockCardLockResult");
         break;
       case "RIL:GetCardLockRetryCount":
         this.workerMessenger.sendWithIPCMessage(msg, "iccGetCardLockRetryCount",
                                                 "RIL:CardLockRetryCount");
         break;
       case "RIL:SendStkResponse":
         this.workerMessenger.send("sendStkTerminalResponse", msg.json.data);
--- a/dom/system/gonk/ril_consts.js
+++ b/dom/system/gonk/ril_consts.js
@@ -2550,37 +2550,51 @@ this.GECKO_CARDSTATE_RUIM_LOCKED = 22;
 this.GECKO_CARDSTATE_NETWORK1_PUK_REQUIRED = 23;
 this.GECKO_CARDSTATE_NETWORK2_PUK_REQUIRED = 24;
 this.GECKO_CARDSTATE_HRPD_NETWORK_PUK_REQUIRED = 25;
 this.GECKO_CARDSTATE_RUIM_CORPORATE_PUK_REQUIRED = 26;
 this.GECKO_CARDSTATE_RUIM_SERVICE_PROVIDER_PUK_REQUIRED = 27;
 this.GECKO_CARDSTATE_RUIM_PUK_REQUIRED = 28;
 this.GECKO_CARDSTATE_ILLEGAL = 29;
 
-this.GECKO_CARDLOCK_PIN      = "pin";
-this.GECKO_CARDLOCK_PIN2     = "pin2";
-this.GECKO_CARDLOCK_PUK      = "puk";
-this.GECKO_CARDLOCK_PUK2     = "puk2";
-this.GECKO_CARDLOCK_FDN      = "fdn";
-this.GECKO_CARDLOCK_NCK      = "nck";
-this.GECKO_CARDLOCK_NCK1     = "nck1";
-this.GECKO_CARDLOCK_NCK2     = "nck2";
-this.GECKO_CARDLOCK_HNCK     = "hnck";
-this.GECKO_CARDLOCK_CCK      = "cck";
-this.GECKO_CARDLOCK_SPCK     = "spck";
-this.GECKO_CARDLOCK_RCCK     = "rcck";
-this.GECKO_CARDLOCK_RSPCK    = "rspck";
-this.GECKO_CARDLOCK_NCK_PUK  = "nckPuk";
-this.GECKO_CARDLOCK_NCK1_PUK = "nck1Puk";
-this.GECKO_CARDLOCK_NCK2_PUK = "nck2Puk";
-this.GECKO_CARDLOCK_HNCK_PUK = "hnckPuk";
-this.GECKO_CARDLOCK_CCK_PUK  = "cckPuk";
-this.GECKO_CARDLOCK_SPCK_PUK = "spckPuk";
-this.GECKO_CARDLOCK_RCCK_PUK = "rcckPuk";
-this.GECKO_CARDLOCK_RSPCK_PUK = "rspckPuk";
+// See nsIIccProvider::CARD_LOCK_TYPE_*
+this.GECKO_CARDLOCK_PIN = 0;
+this.GECKO_CARDLOCK_PIN2 = 1;
+this.GECKO_CARDLOCK_PUK = 2;
+this.GECKO_CARDLOCK_PUK2 = 3;
+this.GECKO_CARDLOCK_NCK = 4;
+this.GECKO_CARDLOCK_NCK1 = 5;
+this.GECKO_CARDLOCK_NCK2 = 6;
+this.GECKO_CARDLOCK_HNCK = 7;
+this.GECKO_CARDLOCK_CCK = 8;
+this.GECKO_CARDLOCK_SPCK = 9;
+this.GECKO_CARDLOCK_RCCK = 10;
+this.GECKO_CARDLOCK_RSPCK = 11;
+this.GECKO_CARDLOCK_NCK_PUK = 12;
+this.GECKO_CARDLOCK_NCK1_PUK = 13;
+this.GECKO_CARDLOCK_NCK2_PUK = 14;
+this.GECKO_CARDLOCK_HNCK_PUK = 15;
+this.GECKO_CARDLOCK_CCK_PUK = 16;
+this.GECKO_CARDLOCK_SPCK_PUK = 17;
+this.GECKO_CARDLOCK_RCCK_PUK = 18;
+this.GECKO_CARDLOCK_RSPCK_PUK = 19;
+this.GECKO_CARDLOCK_FDN = 20;
+
+this.GECKO_CARDLOCK_TO_FACILITY = {};
+GECKO_CARDLOCK_TO_FACILITY[GECKO_CARDLOCK_PIN] = ICC_CB_FACILITY_SIM;
+GECKO_CARDLOCK_TO_FACILITY[GECKO_CARDLOCK_FDN] = ICC_CB_FACILITY_FDN;
+
+this.GECKO_CARDLOCK_TO_SEL_CODE = {};
+GECKO_CARDLOCK_TO_SEL_CODE[GECKO_CARDLOCK_PIN] = ICC_SEL_CODE_SIM_PIN;
+GECKO_CARDLOCK_TO_SEL_CODE[GECKO_CARDLOCK_PIN2] = ICC_SEL_CODE_SIM_PIN2;
+GECKO_CARDLOCK_TO_SEL_CODE[GECKO_CARDLOCK_PUK] = ICC_SEL_CODE_SIM_PUK;
+GECKO_CARDLOCK_TO_SEL_CODE[GECKO_CARDLOCK_PUK2] = ICC_SEL_CODE_SIM_PUK2;
+GECKO_CARDLOCK_TO_SEL_CODE[GECKO_CARDLOCK_NCK] = ICC_SEL_CODE_PH_NET_PIN;
+GECKO_CARDLOCK_TO_SEL_CODE[GECKO_CARDLOCK_CCK] = ICC_SEL_CODE_PH_CORP_PIN;
+GECKO_CARDLOCK_TO_SEL_CODE[GECKO_CARDLOCK_SPCK] = ICC_SEL_CODE_PH_SP_PIN;
 
 // See ril.h RIL_PersoSubstate
 this.PERSONSUBSTATE = {};
 PERSONSUBSTATE[CARD_PERSOSUBSTATE_UNKNOWN] = GECKO_CARDSTATE_UNKNOWN;
 PERSONSUBSTATE[CARD_PERSOSUBSTATE_IN_PROGRESS] = GECKO_CARDSTATE_PERSONALIZATION_IN_PROGRESS;
 PERSONSUBSTATE[CARD_PERSOSUBSTATE_READY] = GECKO_CARDSTATE_PERSONALIZATION_READY;
 PERSONSUBSTATE[CARD_PERSOSUBSTATE_SIM_NETWORK] = GECKO_CARDSTATE_NETWORK_LOCKED;
 PERSONSUBSTATE[CARD_PERSOSUBSTATE_SIM_NETWORK_SUBSET] = GECKO_CARDSTATE_NETWORK_SUBSET_LOCKED;
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -610,237 +610,227 @@ RilObject.prototype = {
         this.enterICCPUK2(options);
         break;
       case GECKO_CARDLOCK_NCK:
       case GECKO_CARDLOCK_NCK1:
       case GECKO_CARDLOCK_NCK2:
       case GECKO_CARDLOCK_HNCK:
       case GECKO_CARDLOCK_CCK:
       case GECKO_CARDLOCK_SPCK:
-      case GECKO_CARDLOCK_RCCK: // Fall through.
-      case GECKO_CARDLOCK_RSPCK: {
-        let type = GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[options.lockType];
-        this.enterDepersonalization(type, options.pin, options);
-        break;
-      }
+      case GECKO_CARDLOCK_RCCK:
+      case GECKO_CARDLOCK_RSPCK:
       case GECKO_CARDLOCK_NCK_PUK:
       case GECKO_CARDLOCK_NCK1_PUK:
       case GECKO_CARDLOCK_NCK2_PUK:
       case GECKO_CARDLOCK_HNCK_PUK:
       case GECKO_CARDLOCK_CCK_PUK:
       case GECKO_CARDLOCK_SPCK_PUK:
       case GECKO_CARDLOCK_RCCK_PUK: // Fall through.
-      case GECKO_CARDLOCK_RSPCK_PUK: {
-        let type = GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[options.lockType];
-        this.enterDepersonalization(type, options.puk, options);
-        break;
-      }
+      case GECKO_CARDLOCK_RSPCK_PUK:
+        options.personlization =
+          GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[options.lockType];
+        this.enterDepersonalization(options);
+        break;
       default:
-        options.errorMsg = "Unsupported Card Lock.";
-        options.success = false;
+        options.errorMsg = GECKO_ERROR_REQUEST_NOT_SUPPORTED;
         this.sendChromeMessage(options);
     }
   },
 
   /**
    * Enter a PIN to unlock the ICC.
    *
-   * @param pin
+   * @param password
    *        String containing the PIN.
    * @param [optional] aid
    *        AID value.
    */
   enterICCPIN: function(options) {
     let Buf = this.context.Buf;
     Buf.newParcel(REQUEST_ENTER_SIM_PIN, options);
     Buf.writeInt32(this.v5Legacy ? 1 : 2);
-    Buf.writeString(options.pin);
+    Buf.writeString(options.password);
     if (!this.v5Legacy) {
       Buf.writeString(options.aid || this.aid);
     }
     Buf.sendParcel();
   },
 
   /**
    * Enter a PIN2 to unlock the ICC.
    *
-   * @param pin
+   * @param password
    *        String containing the PIN2.
    * @param [optional] aid
    *        AID value.
    */
   enterICCPIN2: function(options) {
     let Buf = this.context.Buf;
     Buf.newParcel(REQUEST_ENTER_SIM_PIN2, options);
     Buf.writeInt32(this.v5Legacy ? 1 : 2);
-    Buf.writeString(options.pin);
+    Buf.writeString(options.password);
     if (!this.v5Legacy) {
       Buf.writeString(options.aid || this.aid);
     }
     Buf.sendParcel();
   },
 
   /**
    * Requests a network personalization be deactivated.
    *
-   * @param type
-   *        Integer indicating the network personalization be deactivated.
+   * @param personlization
+   *        One of CARD_PERSOSUBSTATE_*
    * @param password
    *        String containing the password.
    */
-  enterDepersonalization: function(type, password, options) {
+  enterDepersonalization: function(options) {
     let Buf = this.context.Buf;
     Buf.newParcel(REQUEST_ENTER_NETWORK_DEPERSONALIZATION_CODE, options);
-    Buf.writeInt32(type);
-    Buf.writeString(password);
+    Buf.writeInt32(options.personlization);
+    Buf.writeString(options.password);
     Buf.sendParcel();
   },
 
   /**
-   * Helper function for changing ICC locks.
-   */
-  iccSetCardLock: function(options) {
-    if (options.newPin !== undefined) { // Change PIN lock.
-      switch (options.lockType) {
-        case GECKO_CARDLOCK_PIN:
-          this.changeICCPIN(options);
-          break;
-        case GECKO_CARDLOCK_PIN2:
-          this.changeICCPIN2(options);
-          break;
-        default:
-          options.errorMsg = "Unsupported Card Lock.";
-          options.success = false;
-          this.sendChromeMessage(options);
-      }
-    } else { // Enable/Disable lock.
-      switch (options.lockType) {
-        case GECKO_CARDLOCK_PIN:
-          options.facility = ICC_CB_FACILITY_SIM;
-          options.password = options.pin;
-          break;
-        case GECKO_CARDLOCK_FDN:
-          options.facility = ICC_CB_FACILITY_FDN;
-          options.password = options.pin2;
-          break;
-        default:
-          options.errorMsg = "Unsupported Card Lock.";
-          options.success = false;
-          this.sendChromeMessage(options);
-          return;
-      }
-      options.enabled = options.enabled;
-      options.serviceClass = ICC_SERVICE_CLASS_VOICE |
-                             ICC_SERVICE_CLASS_DATA  |
-                             ICC_SERVICE_CLASS_FAX;
-      this.setICCFacilityLock(options);
-    }
-  },
-
-  /**
    * Change the current ICC PIN number.
    *
-   * @param pin
+   * @param password
    *        String containing the old PIN value
-   * @param newPin
+   * @param newPassword
    *        String containing the new PIN value
    * @param [optional] aid
    *        AID value.
    */
   changeICCPIN: function(options) {
     let Buf = this.context.Buf;
     Buf.newParcel(REQUEST_CHANGE_SIM_PIN, options);
     Buf.writeInt32(this.v5Legacy ? 2 : 3);
-    Buf.writeString(options.pin);
-    Buf.writeString(options.newPin);
+    Buf.writeString(options.password);
+    Buf.writeString(options.newPassword);
     if (!this.v5Legacy) {
       Buf.writeString(options.aid || this.aid);
     }
     Buf.sendParcel();
   },
 
   /**
    * Change the current ICC PIN2 number.
    *
-   * @param pin
+   * @param password
    *        String containing the old PIN2 value
-   * @param newPin
+   * @param newPassword
    *        String containing the new PIN2 value
    * @param [optional] aid
    *        AID value.
    */
   changeICCPIN2: function(options) {
     let Buf = this.context.Buf;
     Buf.newParcel(REQUEST_CHANGE_SIM_PIN2, options);
     Buf.writeInt32(this.v5Legacy ? 2 : 3);
-    Buf.writeString(options.pin);
-    Buf.writeString(options.newPin);
+    Buf.writeString(options.password);
+    Buf.writeString(options.newPassword);
     if (!this.v5Legacy) {
       Buf.writeString(options.aid || this.aid);
     }
     Buf.sendParcel();
   },
+
   /**
    * Supplies ICC PUK and a new PIN to unlock the ICC.
    *
-   * @param puk
+   * @param password
    *        String containing the PUK value.
-   * @param newPin
+   * @param newPassword
    *        String containing the new PIN value.
    * @param [optional] aid
    *        AID value.
    */
    enterICCPUK: function(options) {
      let Buf = this.context.Buf;
      Buf.newParcel(REQUEST_ENTER_SIM_PUK, options);
      Buf.writeInt32(this.v5Legacy ? 2 : 3);
-     Buf.writeString(options.puk);
+     Buf.writeString(options.password);
      Buf.writeString(options.newPin);
      if (!this.v5Legacy) {
        Buf.writeString(options.aid || this.aid);
      }
      Buf.sendParcel();
    },
 
   /**
    * Supplies ICC PUK2 and a new PIN2 to unlock the ICC.
    *
-   * @param puk
+   * @param password
    *        String containing the PUK2 value.
-   * @param newPin
+   * @param newPassword
    *        String containing the new PIN2 value.
    * @param [optional] aid
    *        AID value.
    */
    enterICCPUK2: function(options) {
      let Buf = this.context.Buf;
      Buf.newParcel(REQUEST_ENTER_SIM_PUK2, options);
      Buf.writeInt32(this.v5Legacy ? 2 : 3);
-     Buf.writeString(options.puk);
+     Buf.writeString(options.password);
      Buf.writeString(options.newPin);
      if (!this.v5Legacy) {
        Buf.writeString(options.aid || this.aid);
      }
      Buf.sendParcel();
    },
 
   /**
-   * Helper function for fetching the state of ICC locks.
-   */
-  iccGetCardLockState: function(options) {
+   * Helper function for changing ICC locks.
+   */
+  iccChangeCardLockPassword: function(options) {
     switch (options.lockType) {
       case GECKO_CARDLOCK_PIN:
-        options.facility = ICC_CB_FACILITY_SIM;
-        break;
+        this.changeICCPIN(options);
+        break;
+      case GECKO_CARDLOCK_PIN2:
+        this.changeICCPIN2(options);
+        break;
+      default:
+        options.errorMsg = GECKO_ERROR_REQUEST_NOT_SUPPORTED;
+        this.sendChromeMessage(options);
+    }
+  },
+
+  /**
+   * Helper function for setting the state of ICC locks.
+   */
+  iccSetCardLockEnabled: function(options) {
+    switch (options.lockType) {
+      case GECKO_CARDLOCK_PIN: // Fall through.
       case GECKO_CARDLOCK_FDN:
-        options.facility = ICC_CB_FACILITY_FDN;
+        options.facility = GECKO_CARDLOCK_TO_FACILITY[options.lockType];
         break;
       default:
-        options.errorMsg = "Unsupported Card Lock.";
-        options.success = false;
+        options.errorMsg = GECKO_ERROR_REQUEST_NOT_SUPPORTED;
+        this.sendChromeMessage(options);
+        return;
+    }
+
+    options.serviceClass = ICC_SERVICE_CLASS_VOICE |
+                           ICC_SERVICE_CLASS_DATA  |
+                           ICC_SERVICE_CLASS_FAX;
+    this.setICCFacilityLock(options);
+  },
+
+  /**
+   * Helper function for fetching the state of ICC locks.
+   */
+  iccGetCardLockEnabled: function(options) {
+    switch (options.lockType) {
+      case GECKO_CARDLOCK_PIN: // Fall through.
+      case GECKO_CARDLOCK_FDN:
+        options.facility = GECKO_CARDLOCK_TO_FACILITY[options.lockType];
+        break;
+      default:
+        options.errorMsg = GECKO_ERROR_REQUEST_NOT_SUPPORTED;
         this.sendChromeMessage(options);
         return;
     }
 
     options.password = ""; // For query no need to provide pin.
     options.serviceClass = ICC_SERVICE_CLASS_VOICE |
                            ICC_SERVICE_CLASS_DATA  |
                            ICC_SERVICE_CLASS_FAX;
@@ -849,44 +839,40 @@ RilObject.prototype = {
 
   /**
    * Helper function for fetching the number of unlock retries of ICC locks.
    *
    * We only query the retry count when we're on the emulator. The phones do
    * not support the request id and their rild doesn't return an error.
    */
   iccGetCardLockRetryCount: function(options) {
-    var selCode = {
-      pin: ICC_SEL_CODE_SIM_PIN,
-      puk: ICC_SEL_CODE_SIM_PUK,
-      pin2: ICC_SEL_CODE_SIM_PIN2,
-      puk2: ICC_SEL_CODE_SIM_PUK2,
-      nck: ICC_SEL_CODE_PH_NET_PIN,
-      cck: ICC_SEL_CODE_PH_CORP_PIN,
-      spck: ICC_SEL_CODE_PH_SP_PIN
-    };
-
-    if (typeof(selCode[options.lockType]) === 'undefined') {
-      /* unknown lock type */
-      options.errorMsg = GECKO_ERROR_GENERIC_FAILURE;
-      options.success = false;
+    if (!RILQUIRKS_HAVE_QUERY_ICC_LOCK_RETRY_COUNT) {
+      // Only the emulator supports this request.
+      options.errorMsg = GECKO_ERROR_REQUEST_NOT_SUPPORTED;
       this.sendChromeMessage(options);
       return;
     }
 
-    if (RILQUIRKS_HAVE_QUERY_ICC_LOCK_RETRY_COUNT) {
-      /* Only the emulator supports this request, ... */
-      options.selCode = selCode[options.lockType];
-      this.queryICCLockRetryCount(options);
-    } else {
-      /* ... while the phones do not. */
-      options.errorMsg = GECKO_ERROR_REQUEST_NOT_SUPPORTED;
-      options.success = false;
-      this.sendChromeMessage(options);
-    }
+    switch (options.lockType) {
+      case GECKO_CARDLOCK_PIN:
+      case GECKO_CARDLOCK_PIN2:
+      case GECKO_CARDLOCK_PUK:
+      case GECKO_CARDLOCK_PUK2:
+      case GECKO_CARDLOCK_NCK:
+      case GECKO_CARDLOCK_CCK: // Fall through.
+      case GECKO_CARDLOCK_SPCK:
+        options.selCode = GECKO_CARDLOCK_TO_SEL_CODE[options.lockType];
+        break;
+      default:
+        options.errorMsg = GECKO_ERROR_REQUEST_NOT_SUPPORTED;
+        this.sendChromeMessage(options);
+        return;
+    }
+
+    this.queryICCLockRetryCount(options);
   },
 
   /**
    * Query ICC lock retry count.
    *
    * @param selCode
    *        One of ICC_SEL_CODE_*.
    * @param serviceClass
@@ -2468,62 +2454,62 @@ RilObject.prototype = {
         // As defined in TS.122.030 6.6.2 to change the ICC PIN we should expect
         // an MMI code of the form **04*OLD_PIN*NEW_PIN*NEW_PIN#, where old PIN
         // should be entered as the SIA parameter and the new PIN as SIB and
         // SIC.
         if (!_isRadioAvailable() || !_isValidPINPUKRequest()) {
           return;
         }
 
-        options.pin = mmi.sia;
-        options.newPin = mmi.sib;
+        options.password = mmi.sia;
+        options.newPassword = mmi.sib;
         this.changeICCPIN(options);
         return;
 
       // Change the current ICC PIN2 number.
       case MMI_SC_PIN2:
         // As defined in TS.122.030 6.6.2 to change the ICC PIN2 we should
         // enter and MMI code of the form **042*OLD_PIN2*NEW_PIN2*NEW_PIN2#,
         // where the old PIN2 should be entered as the SIA parameter and the
         // new PIN2 as SIB and SIC.
         if (!_isRadioAvailable() || !_isValidPINPUKRequest()) {
           return;
         }
 
-        options.pin = mmi.sia;
-        options.newPin = mmi.sib;
+        options.password = mmi.sia;
+        options.newPassword = mmi.sib;
         this.changeICCPIN2(options);
         return;
 
       // Unblock ICC PIN.
       case MMI_SC_PUK:
         // As defined in TS.122.030 6.6.3 to unblock the ICC PIN we should
         // enter an MMI code of the form **05*PUK*NEW_PIN*NEW_PIN#, where PUK
         // should be entered as the SIA parameter and the new PIN as SIB and
         // SIC.
         if (!_isRadioAvailable() || !_isValidPINPUKRequest()) {
           return;
         }
 
-        options.puk = mmi.sia;
+        options.password = mmi.sia;
         options.newPin = mmi.sib;
         this.enterICCPUK(options);
         return;
 
       // Unblock ICC PIN2.
       case MMI_SC_PUK2:
         // As defined in TS.122.030 6.6.3 to unblock the ICC PIN2 we should
         // enter an MMI code of the form **052*PUK2*NEW_PIN2*NEW_PIN2#, where
         // PUK2 should be entered as the SIA parameter and the new PIN2 as SIB
         // and SIC.
         if (!_isRadioAvailable() || !_isValidPINPUKRequest()) {
           return;
         }
 
-        options.puk = mmi.sia;
+        options.password = mmi.sia;
         options.newPin = mmi.sib;
         this.enterICCPUK2(options);
         return;
 
       // IMEI
       case MMI_SC_IMEI:
         // A device's IMEI can't change, so we only need to request it once.
         if (this.IMEI == null) {
--- a/dom/system/gonk/tests/test_ril_worker_icc_CardLock.js
+++ b/dom/system/gonk/tests/test_ril_worker_icc_CardLock.js
@@ -1,56 +1,58 @@
 /* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 subscriptLoader.loadSubScript("resource://gre/modules/ril_consts.js", this);
 
 function run_test() {
   run_next_test();
 }
 
 /**
- * Verify RIL.iccGetCardLockState("fdn")
+ * Verify RIL.iccGetCardLockEnabled
  */
-add_test(function test_icc_get_card_lock_state_fdn() {
+add_test(function test_icc_get_card_lock_enabled() {
   let worker = newUint8Worker();
   let context = worker.ContextPool._contexts[0];
+  let buf = context.Buf;
   let ril = context.RIL;
-  let buf = context.Buf;
-
-  buf.sendParcel = function() {
-    // Request Type.
-    do_check_eq(this.readInt32(), REQUEST_QUERY_FACILITY_LOCK)
+  ril.aid = "123456789";
+  ril.v5Legacy = false;
 
-    // Token : we don't care.
-    this.readInt32();
+  function do_test(aLock) {
+    const serviceClass = ICC_SERVICE_CLASS_VOICE |
+                         ICC_SERVICE_CLASS_DATA  |
+                         ICC_SERVICE_CLASS_FAX;
 
-    // String Array Length.
-    do_check_eq(this.readInt32(), ril.v5Legacy ? 3 : 4);
+    buf.sendParcel = function fakeSendParcel() {
+      // Request Type.
+      do_check_eq(this.readInt32(), REQUEST_QUERY_FACILITY_LOCK)
 
-    // Facility.
-    do_check_eq(this.readString(), ICC_CB_FACILITY_FDN);
+      // Token : we don't care.
+      this.readInt32();
 
-    // Password.
-    do_check_eq(this.readString(), "");
-
-    // Service class.
-    do_check_eq(this.readString(), (ICC_SERVICE_CLASS_VOICE |
-                                    ICC_SERVICE_CLASS_DATA  |
-                                    ICC_SERVICE_CLASS_FAX).toString());
+      // Data
+      let parcel = this.readStringList();
+      do_check_eq(parcel.length, ril.v5Legacy ? 3 : 4);
+      do_check_eq(parcel[0], GECKO_CARDLOCK_TO_FACILITY[aLock]);
+      do_check_eq(parcel[1], "");
+      do_check_eq(parcel[2], serviceClass.toString());
+      if (!ril.v5Legacy) {
+        do_check_eq(parcel[3], ril.aid);
+      }
+    };
 
-    if (!ril.v5Legacy) {
-      // AID. Ignore because it's from modem.
-      this.readInt32();
-    }
+    ril.iccGetCardLockEnabled({lockType: aLock});
+  }
 
-    run_next_test();
-  };
+  do_test(GECKO_CARDLOCK_PIN)
+  do_test(GECKO_CARDLOCK_FDN)
 
-  ril.iccGetCardLockState({lockType: "fdn"});
+  run_next_test();
 });
 
 add_test(function test_path_id_for_spid_and_spn() {
   let worker = newWorker({
     postRILMessage: function(data) {
       // Do nothing
     },
     postMessage: function(message) {
@@ -72,138 +74,237 @@ add_test(function test_path_id_for_spid_
   do_check_eq(ICCFileHelper.getEFPath(ICC_EF_SPDI),
               EF_PATH_MF_SIM + EF_PATH_ADF_USIM);
   do_check_eq(ICCFileHelper.getEFPath(ICC_EF_SPDI),
               EF_PATH_MF_SIM + EF_PATH_ADF_USIM);
   run_next_test();
 });
 
 /**
- * Verify iccSetCardLock - Facility Lock.
+ * Verify RIL.iccSetCardLockEnabled
  */
-add_test(function test_set_icc_card_lock_facility_lock() {
+add_test(function test_icc_set_card_lock_enabled() {
   let worker = newUint8Worker();
   let context = worker.ContextPool._contexts[0];
-  let aid = "123456789";
+  let buf = context.Buf;
   let ril = context.RIL;
-  ril.aid = aid;
+  ril.aid = "123456789";
   ril.v5Legacy = false;
-  let buf = context.Buf;
-
-  let GECKO_CARDLOCK_TO_FACILITIY_LOCK = {};
-  GECKO_CARDLOCK_TO_FACILITIY_LOCK[GECKO_CARDLOCK_PIN] = ICC_CB_FACILITY_SIM;
-  GECKO_CARDLOCK_TO_FACILITIY_LOCK[GECKO_CARDLOCK_FDN] = ICC_CB_FACILITY_FDN;
-
-  let GECKO_CARDLOCK_TO_PASSWORD_TYPE = {};
-  GECKO_CARDLOCK_TO_PASSWORD_TYPE[GECKO_CARDLOCK_PIN] = "pin";
-  GECKO_CARDLOCK_TO_PASSWORD_TYPE[GECKO_CARDLOCK_FDN] = "pin2";
-
-  const pin = "1234";
-  const pin2 = "4321";
-  let GECKO_CARDLOCK_TO_PASSWORD = {};
-  GECKO_CARDLOCK_TO_PASSWORD[GECKO_CARDLOCK_PIN] = pin;
-  GECKO_CARDLOCK_TO_PASSWORD[GECKO_CARDLOCK_FDN] = pin2;
-
-  const serviceClass = ICC_SERVICE_CLASS_VOICE |
-                       ICC_SERVICE_CLASS_DATA  |
-                       ICC_SERVICE_CLASS_FAX;
 
   function do_test(aLock, aPassword, aEnabled) {
-    buf.sendParcel = function fakeSendParcel () {
+    const serviceClass = ICC_SERVICE_CLASS_VOICE |
+                         ICC_SERVICE_CLASS_DATA  |
+                         ICC_SERVICE_CLASS_FAX;
+
+    buf.sendParcel = function fakeSendParcel() {
       // Request Type.
       do_check_eq(this.readInt32(), REQUEST_SET_FACILITY_LOCK);
 
       // Token : we don't care
       this.readInt32();
 
+      // Data
       let parcel = this.readStringList();
-      do_check_eq(parcel.length, 5);
-      do_check_eq(parcel[0], GECKO_CARDLOCK_TO_FACILITIY_LOCK[aLock]);
+      do_check_eq(parcel.length, ril.v5Legacy ? 4 : 5);
+      do_check_eq(parcel[0], GECKO_CARDLOCK_TO_FACILITY[aLock]);
       do_check_eq(parcel[1], aEnabled ? "1" : "0");
-      do_check_eq(parcel[2], GECKO_CARDLOCK_TO_PASSWORD[aLock]);
+      do_check_eq(parcel[2], aPassword);
       do_check_eq(parcel[3], serviceClass.toString());
-      do_check_eq(parcel[4], aid);
+      if (!ril.v5Legacy) {
+        do_check_eq(parcel[4], ril.aid);
+      }
     };
 
-    let lock = {lockType: aLock,
-                enabled: aEnabled};
-    lock[GECKO_CARDLOCK_TO_PASSWORD_TYPE[aLock]] = aPassword;
-
-    ril.iccSetCardLock(lock);
+    ril.iccSetCardLockEnabled({
+      lockType: aLock,
+      enabled: aEnabled,
+      password: aPassword});
   }
 
-  do_test(GECKO_CARDLOCK_PIN, pin, true);
-  do_test(GECKO_CARDLOCK_PIN, pin, false);
-  do_test(GECKO_CARDLOCK_FDN, pin2, true);
-  do_test(GECKO_CARDLOCK_FDN, pin2, false);
+  do_test(GECKO_CARDLOCK_PIN, "1234", true);
+  do_test(GECKO_CARDLOCK_PIN, "1234", false);
+  do_test(GECKO_CARDLOCK_FDN, "4321", true);
+  do_test(GECKO_CARDLOCK_FDN, "4321", false);
+
+  run_next_test();
+});
+
+/**
+ * Verify RIL.iccChangeCardLockPassword
+ */
+add_test(function test_icc_change_card_lock_password() {
+  let worker = newUint8Worker();
+  let context = worker.ContextPool._contexts[0];
+  let buf = context.Buf;
+  let ril = context.RIL;
+
+
+  function do_test(aLock, aPassword, aNewPassword) {
+    let GECKO_CARDLOCK_TO_REQUEST = {};
+    GECKO_CARDLOCK_TO_REQUEST[GECKO_CARDLOCK_PIN] = REQUEST_CHANGE_SIM_PIN;
+    GECKO_CARDLOCK_TO_REQUEST[GECKO_CARDLOCK_PIN2] = REQUEST_CHANGE_SIM_PIN2;
+
+    buf.sendParcel = function fakeSendParcel() {
+      // Request Type.
+      do_check_eq(this.readInt32(), GECKO_CARDLOCK_TO_REQUEST[aLock]);
+
+      // Token : we don't care
+      this.readInt32();
+
+      // Data
+      let parcel = this.readStringList();
+      do_check_eq(parcel.length, ril.v5Legacy ? 2 : 3);
+      do_check_eq(parcel[0], aPassword);
+      do_check_eq(parcel[1], aNewPassword);
+      if (!ril.v5Legacy) {
+        do_check_eq(parcel[2], ril.aid);
+      }
+    };
+
+    ril.iccChangeCardLockPassword({
+      lockType: aLock,
+      password: aPassword,
+      newPassword: aNewPassword});
+  }
+
+  do_test(GECKO_CARDLOCK_PIN, "1234", "4321");
+  do_test(GECKO_CARDLOCK_PIN2, "1234", "4321");
 
   run_next_test();
 });
 
 /**
- * Verify iccUnlockCardLock.
+ * Verify RIL.iccUnlockCardLock - PIN
  */
-add_test(function test_unlock_card_lock_corporateLocked() {
+add_test(function test_icc_unlock_card_lock_pin() {
   let worker = newUint8Worker();
   let context = worker.ContextPool._contexts[0];
   let ril = context.RIL;
   let buf = context.Buf;
-  const pin = "12345678";
-  const puk = "12345678";
-
-  let GECKO_CARDLOCK_TO_PASSWORD_TYPE = {};
-  GECKO_CARDLOCK_TO_PASSWORD_TYPE[GECKO_CARDLOCK_NCK] = "pin";
-  GECKO_CARDLOCK_TO_PASSWORD_TYPE[GECKO_CARDLOCK_NCK1] = "pin";
-  GECKO_CARDLOCK_TO_PASSWORD_TYPE[GECKO_CARDLOCK_NCK2] = "pin";
-  GECKO_CARDLOCK_TO_PASSWORD_TYPE[GECKO_CARDLOCK_HNCK] = "pin";
-  GECKO_CARDLOCK_TO_PASSWORD_TYPE[GECKO_CARDLOCK_CCK] = "pin";
-  GECKO_CARDLOCK_TO_PASSWORD_TYPE[GECKO_CARDLOCK_SPCK] = "pin";
-  GECKO_CARDLOCK_TO_PASSWORD_TYPE[GECKO_CARDLOCK_RCCK] = "pin";
-  GECKO_CARDLOCK_TO_PASSWORD_TYPE[GECKO_CARDLOCK_RSPCK] = "pin";
-  GECKO_CARDLOCK_TO_PASSWORD_TYPE[GECKO_CARDLOCK_NCK_PUK] = "puk";
-  GECKO_CARDLOCK_TO_PASSWORD_TYPE[GECKO_CARDLOCK_NCK1_PUK] = "puk";
-  GECKO_CARDLOCK_TO_PASSWORD_TYPE[GECKO_CARDLOCK_NCK2_PUK] = "puk";
-  GECKO_CARDLOCK_TO_PASSWORD_TYPE[GECKO_CARDLOCK_HNCK_PUK] = "puk";
-  GECKO_CARDLOCK_TO_PASSWORD_TYPE[GECKO_CARDLOCK_CCK_PUK] = "puk";
-  GECKO_CARDLOCK_TO_PASSWORD_TYPE[GECKO_CARDLOCK_SPCK_PUK] = "puk";
-  GECKO_CARDLOCK_TO_PASSWORD_TYPE[GECKO_CARDLOCK_RCCK_PUK] = "puk";
-  GECKO_CARDLOCK_TO_PASSWORD_TYPE[GECKO_CARDLOCK_RSPCK_PUK] = "puk";
+  ril.aid = "123456789";
+  ril.v5Legacy = false;
 
   function do_test(aLock, aPassword) {
-    buf.sendParcel = function fakeSendParcel () {
+    let GECKO_CARDLOCK_TO_REQUEST = {};
+    GECKO_CARDLOCK_TO_REQUEST[GECKO_CARDLOCK_PIN] = REQUEST_ENTER_SIM_PIN;
+    GECKO_CARDLOCK_TO_REQUEST[GECKO_CARDLOCK_PIN2] = REQUEST_ENTER_SIM_PIN2;
+
+    buf.sendParcel = function fakeSendParcel() {
+      // Request Type.
+      do_check_eq(this.readInt32(), GECKO_CARDLOCK_TO_REQUEST[aLock]);
+
+      // Token : we don't care
+      this.readInt32();
+
+      // Data
+      let parcel = this.readStringList();
+      do_check_eq(parcel.length, ril.v5Legacy ? 1 : 2);
+      do_check_eq(parcel[0], aPassword);
+      if (!ril.v5Legacy) {
+        do_check_eq(parcel[1], ril.aid);
+      }
+    };
+
+    ril.iccUnlockCardLock({
+      lockType: aLock,
+      password: aPassword
+    });
+  }
+
+  do_test(GECKO_CARDLOCK_PIN, "1234");
+  do_test(GECKO_CARDLOCK_PIN2, "1234");
+
+  run_next_test();
+});
+
+/**
+ * Verify RIL.iccUnlockCardLock - PUK
+ */
+add_test(function test_icc_unlock_card_lock_puk() {
+  let worker = newUint8Worker();
+  let context = worker.ContextPool._contexts[0];
+  let ril = context.RIL;
+  let buf = context.Buf;
+  ril.aid = "123456789";
+  ril.v5Legacy = false;
+
+  function do_test(aLock, aPassword, aNewPin) {
+    let GECKO_CARDLOCK_TO_REQUEST = {};
+    GECKO_CARDLOCK_TO_REQUEST[GECKO_CARDLOCK_PUK] = REQUEST_ENTER_SIM_PUK;
+    GECKO_CARDLOCK_TO_REQUEST[GECKO_CARDLOCK_PUK2] = REQUEST_ENTER_SIM_PUK2;
+
+    buf.sendParcel = function fakeSendParcel() {
+      // Request Type.
+      do_check_eq(this.readInt32(), GECKO_CARDLOCK_TO_REQUEST[aLock]);
+
+      // Token : we don't care
+      this.readInt32();
+
+      // Data
+      let parcel = this.readStringList();
+      do_check_eq(parcel.length, ril.v5Legacy ? 2 : 3);
+      do_check_eq(parcel[0], aPassword);
+      do_check_eq(parcel[1], aNewPin);
+      if (!ril.v5Legacy) {
+        do_check_eq(parcel[2], ril.aid);
+      }
+    };
+
+    ril.iccUnlockCardLock({
+      lockType: aLock,
+      password: aPassword,
+      newPin: aNewPin
+    });
+  }
+
+  do_test(GECKO_CARDLOCK_PUK, "12345678", "1234");
+  do_test(GECKO_CARDLOCK_PUK2, "12345678", "1234");
+
+  run_next_test();
+});
+
+/**
+ * Verify RIL.iccUnlockCardLock - Depersonalization
+ */
+add_test(function test_icc_unlock_card_lock_depersonalization() {
+  let worker = newUint8Worker();
+  let context = worker.ContextPool._contexts[0];
+  let ril = context.RIL;
+  let buf = context.Buf;
+
+  function do_test(aLock, aPassword) {
+    buf.sendParcel = function fakeSendParcel() {
       // Request Type.
       do_check_eq(this.readInt32(), REQUEST_ENTER_NETWORK_DEPERSONALIZATION_CODE);
 
       // Token : we don't care
       this.readInt32();
 
-      let lockType = GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[aLock];
-      // Lock Type
-      do_check_eq(this.readInt32(), lockType);
-
-      // Pin/Puk.
+      // Data
+      do_check_eq(this.readInt32(), GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[aLock]);
       do_check_eq(this.readString(), aPassword);
     };
 
-    let lock = {lockType: aLock};
-    lock[GECKO_CARDLOCK_TO_PASSWORD_TYPE[aLock]] = aPassword;
-    ril.iccUnlockCardLock(lock);
+    ril.iccUnlockCardLock({
+      lockType: aLock,
+      password: aPassword
+    });
   }
 
-  do_test(GECKO_CARDLOCK_NCK, pin);
-  do_test(GECKO_CARDLOCK_NCK1, pin);
-  do_test(GECKO_CARDLOCK_NCK2, pin);
-  do_test(GECKO_CARDLOCK_HNCK, pin);
-  do_test(GECKO_CARDLOCK_CCK, pin);
-  do_test(GECKO_CARDLOCK_SPCK, pin);
-  do_test(GECKO_CARDLOCK_RCCK, pin);
-  do_test(GECKO_CARDLOCK_RSPCK, pin);
-  do_test(GECKO_CARDLOCK_NCK_PUK, puk);
-  do_test(GECKO_CARDLOCK_NCK1_PUK, puk);
-  do_test(GECKO_CARDLOCK_NCK2_PUK, puk);
-  do_test(GECKO_CARDLOCK_HNCK_PUK, puk);
-  do_test(GECKO_CARDLOCK_CCK_PUK, puk);
-  do_test(GECKO_CARDLOCK_SPCK_PUK, puk);
-  do_test(GECKO_CARDLOCK_RCCK_PUK, puk);
-  do_test(GECKO_CARDLOCK_RSPCK_PUK, puk);
+  do_test(GECKO_CARDLOCK_NCK, "12345678");
+  do_test(GECKO_CARDLOCK_NCK1, "12345678");
+  do_test(GECKO_CARDLOCK_NCK2, "12345678");
+  do_test(GECKO_CARDLOCK_HNCK, "12345678");
+  do_test(GECKO_CARDLOCK_CCK, "12345678");
+  do_test(GECKO_CARDLOCK_SPCK, "12345678");
+  do_test(GECKO_CARDLOCK_RCCK, "12345678");
+  do_test(GECKO_CARDLOCK_RSPCK, "12345678");
+  do_test(GECKO_CARDLOCK_NCK_PUK, "12345678");
+  do_test(GECKO_CARDLOCK_NCK1_PUK, "12345678");
+  do_test(GECKO_CARDLOCK_NCK2_PUK, "12345678");
+  do_test(GECKO_CARDLOCK_HNCK_PUK, "12345678");
+  do_test(GECKO_CARDLOCK_CCK_PUK, "12345678");
+  do_test(GECKO_CARDLOCK_SPCK_PUK, "12345678");
+  do_test(GECKO_CARDLOCK_RCCK_PUK, "12345678");
+  do_test(GECKO_CARDLOCK_RSPCK_PUK, "12345678");
 
   run_next_test();
 });