Index: third_party/WebKit/LayoutTests/media/track/media-element-enqueue-event-crash.html |
diff --git a/third_party/WebKit/LayoutTests/media/track/media-element-enqueue-event-crash.html b/third_party/WebKit/LayoutTests/media/track/media-element-enqueue-event-crash.html |
index a7cea1f7f8db8299e9681bc5fb324fb233aea18e..561f98da36d59fa095b835468a6453f4c5d6a9db 100644 |
--- a/third_party/WebKit/LayoutTests/media/track/media-element-enqueue-event-crash.html |
+++ b/third_party/WebKit/LayoutTests/media/track/media-element-enqueue-event-crash.html |
@@ -1,62 +1,43 @@ |
<!DOCTYPE html> |
-<html> |
- <head> |
- <script src=../media-file.js></script> |
- <script src=../media-controls.js></script> |
- <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 |
- (Please avoid writing new tests using video-test.js) --> |
- <script src=../video-test.js></script> |
- |
- <script> |
- if (window.testRunner) |
- { |
- testRunner.dumpAsText(); |
- testRunner.waitUntilDone(); |
- } |
- |
- function startTest() |
- { |
- if (localStorage.testRuns) |
- localStorage.testRuns = Number(localStorage.testRuns) + 1; |
- else { |
- localStorage.testRuns = 1; |
- localStorage.totalRuns = 5; |
- } |
- |
- document.getElementsByTagName('track')[0].track.mode = 'showing'; |
- setTimeout(CFcrash, 100); |
- } |
- |
- function forceGC() { |
- gc(); |
- |
- // End the test only if it ran at least totalRuns. |
- if (window.testRunner && localStorage.testRuns == localStorage.totalRuns) { |
- consoleWrite("** No crash. Pass **"); |
- testRunner.notifyDone(); |
- } else |
- window.location.reload(); |
- } |
- |
- function CFcrash() |
- { |
- document1 = document.implementation.createDocument("", null); |
- document1.appendChild(videoElement); |
- delete document1; |
- |
- setTimeout(forceGC, 0); |
- } |
- |
- document.addEventListener("DOMContentLoaded", startTest, false); |
- </script> |
- </head> |
- |
- <body> |
- <p>Tests that appending events for dispatching doesn't crash</p> |
- <video autoplay id="videoElement"> |
- <source src="../content/test.ogv"> |
- <source src="../content/test.mp4"> |
- <track src="captions-webvtt/captions-fast.vtt" default> |
- </video> |
- </body> |
-</html> |
+<title>Tests that appending events for dispatching doesn't crash.</title> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script src="../../resources/gc.js"></script> |
+<script src="../media-file.js"></script> |
+<video autoplay> |
+ <track src="captions-webvtt/captions-fast.vtt" default> |
+</video> |
+<script> |
+async_test(function(t) { |
+ if (localStorage.testRuns) |
+ localStorage.testRuns = Number(localStorage.testRuns) + 1; |
+ else { |
+ localStorage.testRuns = 1; |
+ localStorage.totalRuns = 5; |
+ } |
+ |
+ document.querySelector("track").track.mode = "showing"; |
+ setTimeout(t.step_func(CFcrash), 100); |
+ |
+ function CFcrash() { |
+ var video = document.querySelector("video"); |
+ video.src = findMediaFile("video", "content/test"); |
+ var document1 = document.implementation.createDocument("", null); |
+ document1.appendChild(video); |
+ delete document1; |
+ |
+ setTimeout(t.step_func(forceGC), 0); |
+ } |
+ |
+ function forceGC() { |
+ gc(); |
+ |
+ // End the test only if it ran totalRuns. |
+ if (localStorage.testRuns == localStorage.totalRuns) |
+ t.done(); |
+ else |
+ location.reload(); |
+ } |
+ |
+}); |
+</script> |