Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / media / w3c-media-utils.js
blob5637333cd2eef50671c99a4ec1d0a93afc0a1d94
1 var consoleDiv = null;
2 function getVideoURI(baseFileName)
4     var fileExtension =
5         (document.createElement("video").
6             canPlayType('video/ogg; codecs="theora"') == "") ? "mp4" : "ogv";
7     return "./content/" + baseFileName + "." + fileExtension;
10 function consoleWrite(text)
12     if (!consoleDiv && document.body)
13     {
14         consoleDiv = document.createElement('div');
15         document.body.appendChild(consoleDiv);
16     }
17     var span = document.createElement("span");
18     span.appendChild(document.createTextNode(text));
19     span.appendChild(document.createElement('br'));
20     consoleDiv.appendChild(span);
23 function waitForEventAndRunStep(eventName, element, func, stepTest)
25     var eventCallback = function(event)
26     {
27         consoleWrite("EVENT(" + eventName + ")");
28         if (func)
29             func(event);
30     }
31     if (stepTest)
32         eventCallback = stepTest.step_func(eventCallback);
34     element.addEventListener(eventName, eventCallback, true);