OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Tests that appending events for dispatching doesn't crash.</title> |
3 <head> | 3 <script src="../../resources/testharness.js"></script> |
4 <script src=../media-file.js></script> | 4 <script src="../../resources/testharnessreport.js"></script> |
5 <script src=../media-controls.js></script> | 5 <script src="../../resources/gc.js"></script> |
6 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 6 <script src="../media-file.js"></script> |
7 (Please avoid writing new tests using video-test.js) --> | 7 <video autoplay> |
8 <script src=../video-test.js></script> | 8 <track src="captions-webvtt/captions-fast.vtt" default> |
| 9 </video> |
| 10 <script> |
| 11 async_test(function(t) { |
| 12 if (localStorage.testRuns) |
| 13 localStorage.testRuns = Number(localStorage.testRuns) + 1; |
| 14 else { |
| 15 localStorage.testRuns = 1; |
| 16 localStorage.totalRuns = 5; |
| 17 } |
9 | 18 |
10 <script> | 19 document.querySelector("track").track.mode = "showing"; |
11 if (window.testRunner) | 20 setTimeout(t.step_func(CFcrash), 100); |
12 { | |
13 testRunner.dumpAsText(); | |
14 testRunner.waitUntilDone(); | |
15 } | |
16 | 21 |
17 function startTest() | 22 function CFcrash() { |
18 { | 23 var video = document.querySelector("video"); |
19 if (localStorage.testRuns) | 24 video.src = findMediaFile("video", "content/test"); |
20 localStorage.testRuns = Number(localStorage.testRuns) + 1; | 25 var document1 = document.implementation.createDocument("", null); |
21 else { | 26 document1.appendChild(video); |
22 localStorage.testRuns = 1; | 27 delete document1; |
23 localStorage.totalRuns = 5; | |
24 } | |
25 | 28 |
26 document.getElementsByTagName('track')[0].track.mode = 'showing'; | 29 setTimeout(t.step_func(forceGC), 0); |
27 setTimeout(CFcrash, 100); | 30 } |
28 } | |
29 | 31 |
30 function forceGC() { | 32 function forceGC() { |
31 gc(); | 33 gc(); |
32 | 34 |
33 // End the test only if it ran at least totalRuns. | 35 // End the test only if it ran totalRuns. |
34 if (window.testRunner && localStorage.testRuns == localStorage.total
Runs) { | 36 if (localStorage.testRuns == localStorage.totalRuns) |
35 consoleWrite("** No crash. Pass **"); | 37 t.done(); |
36 testRunner.notifyDone(); | 38 else |
37 } else | 39 location.reload(); |
38 window.location.reload(); | 40 } |
39 } | |
40 | 41 |
41 function CFcrash() | 42 }); |
42 { | 43 </script> |
43 document1 = document.implementation.createDocument("", null); | |
44 document1.appendChild(videoElement); | |
45 delete document1; | |
46 | |
47 setTimeout(forceGC, 0); | |
48 } | |
49 | |
50 document.addEventListener("DOMContentLoaded", startTest, false); | |
51 </script> | |
52 </head> | |
53 | |
54 <body> | |
55 <p>Tests that appending events for dispatching doesn't crash</p> | |
56 <video autoplay id="videoElement"> | |
57 <source src="../content/test.ogv"> | |
58 <source src="../content/test.mp4"> | |
59 <track src="captions-webvtt/captions-fast.vtt" default> | |
60 </video> | |
61 </body> | |
62 </html> | |
OLD | NEW |