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.

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

mercurial