1 if (window.layoutTestController) {
2 layoutTestController.dumpAsText();
3 layoutTestController.waitUntilDone();
6 var video = document.getElementsByTagName('video')[0];
10 var console = document.createElement('div');
11 document.body.appendChild(console);
15 consoleWrite("FAIL: timed out");
16 if (window.layoutTestController)
17 layoutTestController.notifyDone();
19 setTimeout(hanged, 10000);
21 function testAndEnd(testFuncString)
23 test(testFuncString, true);
26 function test(testFuncString, endit)
28 if (eval(testFuncString))
29 consoleWrite("TEST(" + testFuncString + ") <span style='color:green'>OK</span>");
31 consoleWrite("TEST(" + testFuncString + ") <span style='color:red'>FAIL</span>");
37 function waitForEventAndEnd(eventName, funcString)
39 waitForEvent(eventName, funcString, true)
42 function waitForEvent(eventName, func, endit)
44 function _eventCallback(event)
46 consoleWrite("EVENT(" + eventName + ")");
55 media.addEventListener(eventName, _eventCallback);
58 function waitForEventTestAndEnd(eventName, testFuncString)
60 waitForEventAndTest(eventName, testFuncString, true);
63 function waitForEventAndFail(eventName)
65 waitForEventAndTest(eventName, "false", true);
68 function waitForEventAndTest(eventName, testFuncString, endit)
70 function _eventCallback(event)
72 if (eval(testFuncString))
73 consoleWrite("EVENT(" + eventName + ") TEST(" + testFuncString + ") <span style='color:green'>OK</span>");
75 consoleWrite("EVENT(" + eventName + ") TEST(" + testFuncString + ") <span style='color:red'>FAIL</span>");
81 media.addEventListener(eventName, _eventCallback);
84 function testException(testString, exceptionString)
89 if (ex.code == eval(exceptionString))
90 consoleWrite("TEST(" + testString + ") THROWS("+exceptionString+") <span style='color:green'>OK</span>");
92 consoleWrite("TEST(" + testString + ") THROWS("+exceptionString+") <span style='color:red'>FAIL</span>");
96 var testEnded = false;
100 consoleWrite("END OF TEST");
102 if (window.layoutTestController)
103 layoutTestController.notifyDone();
106 function consoleWrite(text)
110 console.innerHTML += text + "<br>";
113 function relativeURL(url)
115 return url.substr(url.indexOf('/media/')+7);