2014-01-13 22:19:00 +04:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
2014-06-19 14:11:51 +04:00
|
|
|
MARIONETTE_TIMEOUT = 60000;
|
|
|
|
MARIONETTE_HEAD_JS = "head.js";
|
2014-01-13 22:19:00 +04:00
|
|
|
|
2014-06-19 14:11:51 +04:00
|
|
|
// The emulator's hard coded iccid value.
|
|
|
|
const ICCID = "89014103211118510720";
|
2014-01-13 22:19:00 +04:00
|
|
|
|
2014-06-19 14:11:51 +04:00
|
|
|
function setRadioEnabledAndWaitIccChange(aEnabled) {
|
|
|
|
let promises = [];
|
|
|
|
promises.push(waitForManagerEvent("iccchange"));
|
|
|
|
promises.push(setRadioEnabled(aEnabled));
|
2014-01-13 22:19:00 +04:00
|
|
|
|
2014-06-19 14:11:51 +04:00
|
|
|
return Promise.all(promises);
|
2014-01-13 22:19:00 +04:00
|
|
|
}
|
|
|
|
|
2014-06-19 14:11:51 +04:00
|
|
|
// Start tests
|
|
|
|
startTestCommon(function() {
|
2014-11-13 14:12:11 +03:00
|
|
|
is(mobileConnection.iccId, ICCID, "test initial iccId");
|
2014-06-19 14:11:51 +04:00
|
|
|
|
|
|
|
return setRadioEnabledAndWaitIccChange(false)
|
|
|
|
.then(() => {
|
2014-11-13 14:12:11 +03:00
|
|
|
is(mobileConnection.iccId, null, "mobileConnection.iccId");
|
2014-06-19 14:11:51 +04:00
|
|
|
})
|
|
|
|
|
|
|
|
// Restore radio state.
|
|
|
|
.then(() => setRadioEnabledAndWaitIccChange(true))
|
|
|
|
.then(() => {
|
2014-11-13 14:12:11 +03:00
|
|
|
is(mobileConnection.iccId, ICCID, "mobileConnection.iccId");
|
|
|
|
|
|
|
|
// ICC object should be ready in mozIccManager.
|
|
|
|
let icc = getMozIccByIccId(mobileConnection.iccId);
|
|
|
|
ok(icc instanceof MozIcc, "icc should be an instance of MozIcc");
|
|
|
|
is(icc.iccInfo.iccid, mobileConnection.iccId, "icc.iccInfo.iccid");
|
2014-06-19 14:11:51 +04:00
|
|
|
});
|
|
|
|
});
|