OLD | NEW |
---|---|
1 function getVideoURI(dummy) { | 1 function getVideoURI(dummy) { |
2 var bool=function(any){return!(any=="no"||!any)}; | 2 var bool=function(any){return!(any=="no"||!any)}; |
3 return "../../../content/test." + (bool(document.createElement("video").canPla yType('video/ogg; codecs="theora"')) ? "ogv" : "mp4"); | 3 return "../../../content/test." + (bool(document.createElement("video").canPla yType('video/ogg; codecs="theora"')) ? "ogv" : "mp4"); |
4 } | 4 } |
5 | 5 |
6 function getAudioURI(dummy) { | 6 function getAudioURI(dummy) { |
7 return "../../../content/test.wav"; | 7 return "../../../content/test.wav"; |
8 } | 8 } |
9 | 9 |
10 function testStep(testFunction){ | 10 function testStep(testFunction) { |
11 try { | 11 try { |
12 testFunction(); | 12 testFunction(); |
13 } catch (e) { | 13 } catch (e) { |
14 testFailed('Aborted with exception: ' + e.message); | 14 testFailed('Aborted with exception: ' + e.message); |
15 } | 15 } |
16 } | 16 } |
17 | 17 |
18 function testDone() { | |
19 // match the semantics of testharness.js done(), where nothing that | |
ddorwin
2014/03/20 17:25:03
nit: Match
philipj_slow
2014/03/21 03:00:52
Done.
| |
20 // happens after that call has any effect on the test result. | |
ddorwin
2014/03/20 17:25:03
Does this mean that W3C tests assume the test term
philipj_slow
2014/03/21 03:00:52
It means that assertions or exceptions after t.don
| |
21 if (!window.wasFinishJSTestCalled) { | |
22 finishJSTest(); | |
23 assert_equals = assert_true = assert_false = function() { }; | |
24 } | |
25 } | |
26 | |
18 function test(testFunction) { | 27 function test(testFunction) { |
19 description(document.title); | 28 description(document.title); |
20 testStep(testFunction); | 29 testStep(testFunction); |
21 } | 30 } |
22 | 31 |
23 function async_test(title, options) { | 32 function async_test(title, options) { |
24 window.jsTestIsAsync = true; | 33 window.jsTestIsAsync = true; |
25 description(title); | 34 description(title); |
26 return { | 35 return { |
27 step: testStep, | 36 step: testStep, |
28 done: finishJSTest | 37 done: testDone |
29 } | 38 } |
30 } | 39 } |
31 | 40 |
32 document.write("<p id=description></p><div id=console></div>"); | 41 document.write("<p id=description></p><div id=console></div>"); |
33 document.write("<script src='../../../../resources/js-test.js'></" + "script>"); | 42 document.write("<script src='../../../../resources/js-test.js'></" + "script>"); |
34 | 43 |
35 assert_equals = function(a, b) { shouldBe('"' + a + '"', '"' + b + '"'); } | 44 assert_equals = function(a, b) { shouldBe('"' + a + '"', '"' + b + '"'); } |
36 assert_true = function(a) { shouldBeTrue("" + a); } | 45 assert_true = function(a) { shouldBeTrue("" + a); } |
37 assert_false = function(a) { shouldBeFalse("" + a); } | 46 assert_false = function(a) { shouldBeFalse("" + a); } |
38 | 47 |
39 if (window.testRunner) | 48 if (window.testRunner) |
40 testRunner.dumpAsText(); | 49 testRunner.dumpAsText(); |
OLD | NEW |