Index: third_party/WebKit/LayoutTests/media/track/track-cue-rendering-tree-is-removed-properly.html |
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-tree-is-removed-properly.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-tree-is-removed-properly.html |
index 1fc1f758a2744c2e86f2ebaf9526962aeb01ff68..8ec121e2765a6e6afc6d848d3c68a76c9d2fc583 100644 |
--- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-tree-is-removed-properly.html |
+++ b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-tree-is-removed-properly.html |
@@ -1,57 +1,24 @@ |
<!DOCTYPE html> |
-<html> |
- <head> |
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
- |
- <script src=../media-file.js></script> |
- <script src=../media-controls.js></script> |
- <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 |
- (Please avoid writing new tests using video-test.js) --> |
- <script src=../video-test.js></script> |
- |
- <script> |
- function emptyVideoTextContent() |
- { |
- consoleWrite(""); |
- consoleWrite("** Empty the contents of the video element when it is ready to play **"); |
- video.textContent = ""; |
- |
- consoleWrite(""); |
- consoleWrite("** Text track should not be rendered anymore **"); |
- try { |
- var textTrackCueBox = textTrackDisplayElement(video, 'display'); |
- } catch (e) { |
- consoleWrite(e); |
- } |
- |
- consoleWrite(""); |
- consoleWrite("No crash. PASS."); |
- consoleWrite(""); |
- |
- endTest(); |
- } |
- |
- function initElements() |
- { |
- consoleWrite("** Set the mode of the text track to showing **"); |
- testTrack = document.querySelector('track'); |
- testTrack.track.mode = "showing"; |
- |
- consoleWrite(""); |
- consoleWrite("** Initialize the video element **"); |
- findMediaElement(); |
- video.src = findMediaFile('video', '../content/test'); |
- |
- video.play(); |
- waitForEvent('canplaythrough', emptyVideoTextContent); |
- } |
- |
- </script> |
- </head> |
- <body onload="initElements()"> |
- <p>Tests that the cue display tree has been removed properly and no crash happens.</p> |
- <video controls> |
- <track src="captions-webvtt/captions.vtt" kind="captions"> |
- </video> |
- </body> |
-</html> |
+<title>Tests that the cue display tree has been removed properly and no crash happens.</title> |
+<script src="../media-file.js"></script> |
+<script src="../media-controls.js"></script> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<video> |
+ <track src="captions-webvtt/captions.vtt" kind="captions" mode="showing"> |
+</video> |
+<script> |
+async_test(function(t) { |
+ var video = document.querySelector("video"); |
+ video.src = findMediaFile("video", "../content/test"); |
+ |
+ video.play(); |
+ video.oncanplaythrough = t.step_func_done(function() { |
+ // Empty the contents of the video element when it is ready to play. |
+ video.textContent = ""; |
+ |
+ // Text track should not be rendered anymore. |
+ assert_throws(null, function() { textTrackDisplayElement(video, "display"); }); |
+ }); |
+}); |
+</script> |