dom/fmradio/test/marionette/test_seek_up_and_down.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 = 30000;
     6 SpecialPowers.addPermission("fmradio", true, document);
     8 let FMRadio = window.navigator.mozFMRadio;
    10 function verifyInitialState() {
    11   log("Verifying initial state.");
    12   ok(FMRadio);
    13   is(FMRadio.enabled, false);
    14   setUp();
    15 }
    17 function setUp() {
    18   let frequency = FMRadio.frequencyLowerBound + FMRadio.channelWidth;
    19   FMRadio.enable(frequency);
    20   FMRadio.onenabled = seekUp;
    21 }
    23 function seekUp() {
    24   log("Seek up");
    25   var request = FMRadio.seekUp();
    26   ok(request);
    28   request.onsuccess = function() {
    29     seekDown();
    30   };
    32   request.onerror = function() {
    33     ok(false, "Seekup request should not fail.");
    34   };
    35 }
    37 function seekDown() {
    38   log("Seek down");
    39   var request = FMRadio.seekDown();
    40   ok(request);
    42   request.onsuccess = function() {
    43     cleanUp();
    44   };
    46   request.onerror = function() {
    47     ok(false, "Seekdown request should not fail.");
    48   };
    49 }
    51 function cleanUp() {
    52   FMRadio.disable();
    53   FMRadio.ondisabled = function() {
    54     FMRadio.ondisabled = null;
    55     ok(!FMRadio.enabled);
    56     finish();
    57   };
    58 }
    60 verifyInitialState();

mercurial