toolkit/content/tests/widgets/test_videocontrols_audio.html

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 <!DOCTYPE HTML>
     2 <html>
     3 <head>
     4   <title>Video controls with Audio file test</title>
     5   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     6   <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     7   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     8 </head>
     9 <body>
    10 <p id="display"></p>
    12 <div id="content">
    13   <video id="video" controls preload="metadata"></video>
    14 </div>
    16 <pre id="test">
    17 <script class="testbody" type="application/javascript;version=1.7">
    19   var domUtils = SpecialPowers.Cc["@mozilla.org/inspector/dom-utils;1"].
    20     getService(SpecialPowers.Ci.inIDOMUtils);
    22   function findElementByAttribute(element, aName, aValue) {
    23     if (!('getAttribute' in element)) {
    24       return false;
    25     }
    26     if (element.getAttribute(aName) === aValue) {
    27       return element;
    28     }
    29     let children = domUtils.getChildrenForNode(element, true);
    30     for (let child of children) {
    31       var result = findElementByAttribute(child, aName, aValue);
    32       if (result) {
    33         return result;
    34       }
    35     }
    36     return false;
    37   }
    39   function loadedmetadata(event) {
    40     var fullscreenButton = findElementByAttribute(video, 'class', 'fullscreenButton');
    41     is(fullscreenButton.hidden, true, 'Fullscreen button is hidden');
    42     SimpleTest.finish();
    43   }
    45   var video = document.getElementById("video");
    47   SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, startTest);
    48   function startTest() {
    49     // Kick off test once audio has loaded.
    50     video.addEventListener("loadedmetadata", loadedmetadata, false);
    51     video.src = "audio.ogg";
    52   }
    54   SimpleTest.waitForExplicitFinish();
    55 </script>
    56 </pre>
    57 </body>
    58 </html>

mercurial