Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Unified Diff: third_party/WebKit/LayoutTests/media/track/track-remove-active-cue-crash.html

Issue 1950283002: Convert track-remove* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/media/track/track-remove-active-cue-crash.html
diff --git a/third_party/WebKit/LayoutTests/media/track/track-remove-active-cue-crash.html b/third_party/WebKit/LayoutTests/media/track/track-remove-active-cue-crash.html
index 0a844885c31d644eb5a8e26543725ce0c86d5da6..06e2ab2b5562b7e467f0b22e9c13124403d8fd3b 100644
--- a/third_party/WebKit/LayoutTests/media/track/track-remove-active-cue-crash.html
+++ b/third_party/WebKit/LayoutTests/media/track/track-remove-active-cue-crash.html
@@ -1,52 +1,35 @@
<!DOCTYPE html>
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-
- <script src=../media-file.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 removeActiveCue()
- {
- testExpected("video.textTracks[0].activeCues.length", 1);
-
- consoleWrite("");
- consoleWrite("** Remove the cue while it is active **");
- video.textTracks[0].removeCue(video.textTracks[0].activeCues[0]);
-
- consoleWrite("");
- consoleWrite("No crash. PASS.");
- consoleWrite("");
-
- endTest();
- }
-
- function startTest()
- {
- findMediaElement();
- video.src = findMediaFile('video', '../content/test');
-
- consoleWrite("** Add a text track to the video element **");
- video.addTextTrack("captions", "regular captions track", "en");
-
- consoleWrite("** Add a cue to the track with enter event listener. **");
- var cue = new VTTCue(0.00, 4.00, "Random");
- cue.addEventListener("enter", removeActiveCue);
- video.textTracks[0].addCue(cue);
-
- consoleWrite("");
- consoleWrite("** Play the video and remove cue when it becomes active. **");
- run("video.play()");
-
- video.textTracks[0].mode = "showing";
- }
- </script>
- </head>
-
- <body onload="startTest()">
- <p>Tests that removing an active cue does not crash the browser.</p>
- <video controls />
- </body>
-</html>
+<title>Tests that removing an active cue does not crash the browser.</title>
+<script src="../media-file.js"></script>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<video></video>
+<script>
+async_test(function(t) {
+ var video = document.querySelector("video");
+ video.src = findMediaFile("video", "../content/test");
+
+ // Add a text track to the video element.
+ video.addTextTrack("captions", "regular captions track", "en");
+
+ // Add a cue to the track with enter event listener.
+ var cue = new VTTCue(0, 4, "Random");
+ cue.onenter = t.step_func_done(removeActiveCue);
+
+ var track = video.textTracks[0];
+ track.addCue(cue);
+
+ function removeActiveCue() {
+ assert_equals(track.activeCues.length, 1);
+
+ // Remove the cue while it is active.
+ track.removeCue(track.activeCues[0]);
+
+ // No crash. PASS.
+ }
+
+ // Play the video and remove cue when it becomes active.
+ video.play();
+ track.mode = "showing";
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698