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.

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

mercurial