dom/mobileconnection/tests/marionette/test_mobile_data_location.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 * http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 MARIONETTE_TIMEOUT = 60000;
michael@0 5 MARIONETTE_HEAD_JS = "head.js";
michael@0 6
michael@0 7 function verifyDataCellLocationInfo(aLac, aCid) {
michael@0 8 let cell = mobileConnection.data.cell;
michael@0 9 ok(cell, "location available");
michael@0 10
michael@0 11 // Initial LAC/CID. Android emulator initializes both value to
michael@0 12 // 0xffff/0xffffffff.
michael@0 13 is(cell.gsmLocationAreaCode, aLac, "data.cell.gsmLocationAreaCode");
michael@0 14 is(cell.gsmCellId, aCid, "data.cell.gsmCellId");
michael@0 15 is(cell.cdmaBaseStationId, -1, "data.cell.cdmaBaseStationId");
michael@0 16 is(cell.cdmaBaseStationLatitude, -2147483648,
michael@0 17 "data.cell.cdmaBaseStationLatitude");
michael@0 18 is(cell.cdmaBaseStationLongitude, -2147483648,
michael@0 19 "data.cell.cdmaBaseStationLongitude");
michael@0 20 is(cell.cdmaSystemId, -1, "data.cell.cdmaSystemId");
michael@0 21 is(cell.cdmaNetworkId, -1, "data.cell.cdmaNetworkId");
michael@0 22 }
michael@0 23
michael@0 24 /* Test Data Cell Location Info Change */
michael@0 25 function testDataCellLocationUpdate(aLac, aCid) {
michael@0 26 // Set emulator's lac/cid and wait for 'ondatachange' event.
michael@0 27 log("Test cell location with lac=" + aLac + " and cid=" + aCid);
michael@0 28
michael@0 29 let promises = [];
michael@0 30 promises.push(waitForManagerEvent("datachange"));
michael@0 31 promises.push(setEmulatorGsmLocation(aLac, aCid));
michael@0 32 return Promise.all(promises)
michael@0 33 .then(() => verifyDataCellLocationInfo(aLac, aCid));
michael@0 34 }
michael@0 35
michael@0 36 startTestCommon(function() {
michael@0 37 return getEmulatorGsmLocation()
michael@0 38 .then(function(aResult) {
michael@0 39 log("Test initial data location info");
michael@0 40 verifyDataCellLocationInfo(aResult.lac, aResult.cid);
michael@0 41
michael@0 42 return Promise.resolve()
michael@0 43 .then(() => testDataCellLocationUpdate(100, 100))
michael@0 44 .then(() => testDataCellLocationUpdate(2000, 2000))
michael@0 45
michael@0 46 // Reset back to initial values.
michael@0 47 .then(() => testDataCellLocationUpdate(aResult.lac, aResult.cid));
michael@0 48 });
michael@0 49 });

mercurial