Bug 995107: fix RIL DSDS marionette test cases on emulator-jb,kk. r=echen

This commit is contained in:
Vicamo Yang 2014-04-11 22:28:07 +08:00
Родитель 398349b49d
Коммит d6a4aef8a6
5 изменённых файлов: 21 добавлений и 45 удалений

Просмотреть файл

@ -16,7 +16,7 @@ ok(iccManager instanceof MozIccManager,
// not map to sim slot directly, we should have a better way to handle this.
let iccIds = iccManager.iccIds;
ok(Array.isArray(iccIds), "iccIds is an array");
is(iccIds.length, 1, "iccIds.length is " + iccIds.length);
ok(iccIds.length > 0, "iccIds.length is " + iccIds.length);
let iccId = iccIds[0];
is(iccId, "89014103211118510720", "iccId is " + iccId);

Просмотреть файл

@ -16,7 +16,7 @@ ok(iccManager instanceof MozIccManager,
// not map to sim slot directly, we should have a better way to handle this.
let iccIds = iccManager.iccIds;
ok(Array.isArray(iccIds), "iccIds is an array");
is(iccIds.length, 1, "iccIds.length is " + iccIds.length);
ok(iccIds.length > 0, "iccIds.length is " + iccIds.length);
let iccId = iccIds[0];
is(iccId, "89014103211118510720", "iccId is " + iccId);

Просмотреть файл

@ -4,6 +4,8 @@
MARIONETTE_TIMEOUT = 30000;
MARIONETTE_HEAD_JS = "icc_header.js";
let origNumICCs = iccManager.iccIds.length;
function setRadioEnabled(enabled) {
let connection = navigator.mozMobileConnections[0];
ok(connection);
@ -26,12 +28,8 @@ taskHelper.push(function testIccUndetectedEvent() {
log("got icc undetected event");
iccManager.removeEventListener("iccundetected", oniccundetected);
// TODO: Bug 932650 - B2G RIL: WebIccManager API - add marionette tests for
// multi-sim
// In single sim scenario, there is only one sim card, we can use below way
// to check iccIds.
is(evt.iccId, iccId, "icc " + evt.iccId + " becomes undetected");
is(iccManager.iccIds.length, 0,
is(iccManager.iccIds.length, origNumICCs - 1,
"iccIds.length becomes to " + iccManager.iccIds.length);
is(iccManager.getIccById(evt.iccId), null,
"should not get a valid icc object here");
@ -47,12 +45,8 @@ taskHelper.push(function testIccDetectedEvent() {
log("got icc detected event");
iccManager.removeEventListener("iccdetected", oniccdetected);
// TODO: Bug 932650 - B2G RIL: WebIccManager API - add marionette tests for
// multi-sim
// In single sim scenario, there is only one sim card, we can use below way
// to check iccIds.
is(evt.iccId, iccId, "icc " + evt.iccId + " is detected");
is(iccManager.iccIds.length, 1,
is(iccManager.iccIds.length, origNumICCs,
"iccIds.length becomes to " + iccManager.iccIds.length);
ok(iccManager.getIccById(evt.iccId) instanceof MozIcc,
"should get a valid icc object here");

Просмотреть файл

@ -195,6 +195,7 @@ function setDataApnSettings(aApnSettings, aAllowError) {
return setSettings1(SETTINGS_KEY_DATA_APN_SETTINGS, aApnSettings, aAllowError);
}
let workingFrame;
let mobileConnection;
/**
@ -234,12 +235,12 @@ function ensureMobileConnection(aAdditionalPermissions, aServiceId) {
// Permission changes can't change existing Navigator.prototype
// objects, so grab our objects from a new Navigator.
let ifr = document.createElement("iframe");
ifr.addEventListener("load", function load() {
ifr.removeEventListener("load", load);
workingFrame = document.createElement("iframe");
workingFrame.addEventListener("load", function load() {
workingFrame.removeEventListener("load", load);
mobileConnection =
ifr.contentWindow.navigator.mozMobileConnections[aServiceId];
workingFrame.contentWindow.navigator.mozMobileConnections[aServiceId];
if (mobileConnection) {
log("navigator.mozMobileConnections[" + aServiceId + "] is instance of " +
@ -255,7 +256,7 @@ function ensureMobileConnection(aAdditionalPermissions, aServiceId) {
}
});
document.body.appendChild(ifr);
document.body.appendChild(workingFrame);
});
return deferred.promise;
@ -710,4 +711,4 @@ function startDSDSTestCommon(aTestCaseMain, aAdditionalPermissions, aServiceId)
ok(true); // We should run at least one test.
cleanUp();
}
}
}

Просмотреть файл

@ -1,32 +1,13 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
MARIONETTE_TIMEOUT = 1000;
MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
SpecialPowers.addPermission("mobileconnection", true, document);
startTestCommon(function() {
let connections =
workingFrame.contentWindow.navigator.mozMobileConnections;
// Permission changes can't change existing Navigator.prototype
// objects, so grab our objects from a new Navigator
let ifr = document.createElement("iframe");
let connections;
ifr.onload = function() {
connections = ifr.contentWindow.navigator.mozMobileConnections;
// mozMobileConnections hasn't been initialized yet.
ok(connections);
is(connections.length, 1);
ifr.parentNode.removeChild(ifr);
ifr = null;
connections = null;
SpecialPowers.gc();
cleanUp();
};
document.body.appendChild(ifr);
function cleanUp() {
SpecialPowers.removePermission("mobileconnection", document);
finish();
}
let num = SpecialPowers.getIntPref("ril.numRadioInterfaces");
is(connections.length, num, "ril.numRadioInterfaces");
});