author | Jonathan Griffin <jgriffin@mozilla.com> |
Tue, 11 Dec 2012 15:41:40 -0800 | |
changeset 115715 | b1212b861665ddfad23c64171c7bb6007f56e3f1 |
parent 115714 | 6d2586f85a8198324e15f115b0f424dfd46465a4 |
child 115716 | 481814c74277b0757f5bfc901d686d8038b2a0c9 |
push id | 19502 |
push user | jgriffin@mozilla.com |
push date | Tue, 11 Dec 2012 23:41:48 +0000 |
treeherder | mozilla-inbound@b1212b861665 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 811580 |
milestone | 20.0a1 |
backs out | 9dffd2d825c90b41acb10687f9aa67f28f5cbf27 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
dom/network/tests/marionette/manifest.ini | file | annotate | diff | comparison | revisions | |
dom/network/tests/marionette/test_mobile_data_location.js | file | annotate | diff | comparison | revisions | |
dom/network/tests/marionette/test_mobile_data_state.js | file | annotate | diff | comparison | revisions |
--- a/dom/network/tests/marionette/manifest.ini +++ b/dom/network/tests/marionette/manifest.ini @@ -5,10 +5,8 @@ qemu = true [test_mobile_networks.js] disabled = Bug 808783 [test_mobile_voice_state.js] [test_mobile_iccinfo.js] [test_mobile_operator_names.js] [test_mobile_preferred_network_type.js] disabled = Bug 808783 -[test_mobile_data_location.js] -[test_mobile_data_state.js]
deleted file mode 100644 --- a/dom/network/tests/marionette/test_mobile_data_location.js +++ /dev/null @@ -1,115 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -MARIONETTE_TIMEOUT = 20000; - -SpecialPowers.addPermission("mobileconnection", true, document); - -let mobileConnection = navigator.mozMobileConnection; - -function verifyInitialState() { - log("Verifying initial state."); - ok(mobileConnection instanceof MozMobileConnection, - "mobileConnection is instanceof " + mobileConnection.constructor); - testStartingCellLocation(); -} - -function testStartingCellLocation() { - // Get the current emulator data cell location - log("Getting the starting GSM location from the emulator."); - - runEmulatorCmd("gsm location", function(result) { - log("Emulator callback."); - is(result[0].substring(0,3), "lac", "lac output"); - is(result[1].substring(0,2), "ci", "ci output"); - is(result[2], "OK", "emulator ok"); - - let emulatorStartLac = result[0].substring(5); - log("Emulator GSM location LAC is '" + emulatorStartLac + "'."); - let emulatorStartCid = result[1].substring(4); - log("Emulator GSM location CID is '" + emulatorStartCid + "'."); - - log("mobileConnection.data.cell.gsmLocationAreaCode is '" - + mobileConnection.data.cell.gsmLocationAreaCode + "'."); - log("mobileConnection.data.cell.gsmCellId is '" - + mobileConnection.data.cell.gsmCellId + "'."); - - // Verify the mobileConnection.data.cell location matches emulator values - if (emulatorStartLac == -1) { - // Emulator initializes LAC to -1, corresponds to these values - is(mobileConnection.data.cell.gsmLocationAreaCode, - 65535, "starting LAC"); - } else { - // A previous test changed the LAC, so verify API matches emulator - is(mobileConnection.data.cell.gsmLocationAreaCode, - emulatorStartLac, "starting LAC"); - } - if (emulatorStartCid == -1) { - // Emulator initializes CID to -1, corresponds to these values - is(mobileConnection.data.cell.gsmCellId, 268435455, "starting CID"); - } else { - // A previous test changed the CID, so verify API matches emulator - is(mobileConnection.data.cell.gsmCellId, - emulatorStartCid, "starting CID"); - } - - // Now test changing the GSM location - testChangeCellLocation(emulatorStartLac, emulatorStartCid); - }); -} - -function testChangeCellLocation(emulatorStartLac, emulatorStartCid) { - // Change emulator GSM location and verify mobileConnection.data.cell values - let newLac = 1000; - let newCid = 2000; - let gotCallback = false; - - // Ensure values will actually be changed - if (newLac == emulatorStartLac) { newLac++; }; - if (newCid == emulatorStartCid) { newCid++; }; - - // Setup 'ondatachange' event listener - mobileConnection.addEventListener("datachange", function ondatachange() { - mobileConnection.removeEventListener("datachange", ondatachange); - log("Received 'ondatachange' event."); - log("mobileConnection.data.cell.gsmLocationAreaCode is now '" - + mobileConnection.data.cell.gsmLocationAreaCode + "'."); - log("mobileConnection.data.cell.gsmCellId is now '" - + mobileConnection.data.cell.gsmCellId + "'."); - is(mobileConnection.data.cell.gsmLocationAreaCode, newLac, - "data.cell.gsmLocationAreaCode"); - is(mobileConnection.data.cell.gsmCellId, newCid, "data.cell.gsmCellId"); - waitFor(restoreLocation(emulatorStartLac, emulatorStartCid), function() { - return(gotCallback); - }); - }); - - // Use emulator command to change GSM location - log("Changing emulator GSM location to '" + newLac + ", " + newCid - + "' and waiting for 'ondatachange' event."); - gotCallback = false; - runEmulatorCmd("gsm location " + newLac + " " + newCid, function(result) { - is(result[0], "OK"); - log("Emulator callback."); - gotCallback = true; - }); -} - -function restoreLocation(lac, cid) { - // Restore the emulator GSM location back to what it was originally - log("Restoring emulator GSM location back to '" + lac + ", " + cid + "'."); - runEmulatorCmd("gsm location " + lac + " " + cid, function(result) { - log("Emulator callback."); - is(result[0], "OK"); - cleanUp(); - }); -} - -function cleanUp() { - mobileConnection.ondatachange = null; - SpecialPowers.removePermission("mobileconnection", document); - finish(); -} - -// Start the test -verifyInitialState();
deleted file mode 100644 --- a/dom/network/tests/marionette/test_mobile_data_state.js +++ /dev/null @@ -1,121 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -MARIONETTE_TIMEOUT = 30000; - -SpecialPowers.addPermission("mobileconnection", true, document); - -let mobileConnection = navigator.mozMobileConnection; - -function verifyInitialState() { - log("Verifying initial state."); - ok(mobileConnection instanceof MozMobileConnection, - "mobileConnection is instanceof " + mobileConnection.constructor); - // Want to start test with mobileConnection.data.state 'registered' - // This is the default state; if it is not currently this value then set it - log("Starting mobileConnection.data.state is: '" - + mobileConnection.data.state + "'."); - if (mobileConnection.data.state != "registered") { - changeDataStateAndVerify("home", "registered", testUnregistered); - } else { - testUnregistered(); - } -} - -function changeDataStateAndVerify(dataState, expected, nextFunction) { - let gotCallback = false; - - // Change the mobileConnection.data.state via 'gsm data' command - log("Changing emulator data state to '" + dataState - + "' and waiting for 'ondatachange' event."); - - // Setup 'ondatachange' event handler - mobileConnection.addEventListener("datachange", function ondatachange() { - mobileConnection.removeEventListener("datachange", ondatachange); - log("Received 'ondatachange' event."); - log("mobileConnection.data.state is now '" - + mobileConnection.data.state + "'."); - is(mobileConnection.data.state, expected, "data.state"); - waitFor(nextFunction, function() { - return(gotCallback); - }); - }); - - // Change the emulator data state - gotCallback = false; - runEmulatorCmd("gsm data " + dataState, function(result) { - is(result[0], "OK"); - log("Emulator callback complete."); - gotCallback = true; - }); -} - -function testUnregistered() { - log("Test 1: Unregistered."); - // Set emulator data state to 'unregistered' and verify - // Expect mobileConnection.data.state to be 'notsearching' - changeDataStateAndVerify("unregistered", "notSearching", testRoaming); -} - -function testRoaming() { - log("Test 2: Roaming."); - // Set emulator data state to 'roaming' and verify - // Expect mobileConnection.data.state to be 'registered' - changeDataStateAndVerify("roaming", "registered", testOff); -} - -function testOff() { - log("Test 3: Off."); - // Set emulator data state to 'off' and verify - // Expect mobileConnection.data.state to be 'notsearching' - changeDataStateAndVerify("off", "notSearching", testSearching); -} - -function testSearching() { - log("Test 4: Searching."); - // Set emulator data state to 'searching' and verify - - // Bug 819533: WebMobileConnection data/voice state incorrect when emulator - // data state is 'searching'. So until fixed, expect 'registered'. - - // changeDataStateAndVerify("searching", "searching", testDenied); - log("* When Bug 819533 is fixed, change this test to expect 'searching' *"); - changeDataStateAndVerify("searching", "registered", testDenied); -} - -function testDenied() { - log("Test 5: Denied."); - // Set emulator data state to 'denied' and verify - // Expect mobileConnection.data.state to be 'denied' - changeDataStateAndVerify("denied", "denied", testOn); -} - -function testOn() { - log("Test 6: On."); - // Set emulator data state to 'on' and verify - // Expect mobileConnection.data.state to be 'registered' - changeDataStateAndVerify("on", "registered", testOffAgain); -} - -function testOffAgain() { - log("Test 7: Off again."); - // Set emulator data state to 'off' and verify - // Expect mobileConnection.data.state to be 'notsearching' - changeDataStateAndVerify("off", "notSearching", testHome); -} - -function testHome() { - log("Test 8: Home."); - // Set emulator data state to 'home' and verify - // Expect mobileConnection.data.state to be 'registered' - changeDataStateAndVerify("home", "registered", cleanUp); -} - -function cleanUp() { - mobileConnection.ondatachange = null; - SpecialPowers.removePermission("mobileconnection", document); - finish(); -} - -// Start the test -verifyInitialState();