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

Unified Diff: third_party/WebKit/LayoutTests/media/track/track-mode-triggers-loading.html

Issue 1942633002: Convert track-mode* 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-mode-triggers-loading.html
diff --git a/third_party/WebKit/LayoutTests/media/track/track-mode-triggers-loading.html b/third_party/WebKit/LayoutTests/media/track/track-mode-triggers-loading.html
index fe689a491c7e1153f289478b05d9ae2f98bfd7c9..dc10a5aa143d93ccded57e6350cd2bdf15437901 100644
--- a/third_party/WebKit/LayoutTests/media/track/track-mode-triggers-loading.html
+++ b/third_party/WebKit/LayoutTests/media/track/track-mode-triggers-loading.html
@@ -1,57 +1,37 @@
<!DOCTYPE html>
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Tests that a "metadata" track does not load automatically, but does load when the mode is changed.</title>
+<script src="../media-file.js"></script>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<video>
+ <track kind="metadata" src="captions-webvtt/metadata.vtt">
+</video>
+<script>
+async_test(function(t) {
+ var video = document.querySelector("video");
- <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>
+ // Check initial metadata track state.
+ var track = document.querySelectorAll("track")[0];
+ assert_equals(track.readyState, HTMLTrackElement.NONE);
+ assert_equals(video.textTracks[0].mode, "disabled");
- function trackLoaded()
- {
- consoleWrite("EVENT(load) -- &lt;track&gt;");
- consoleWrite("<i>**check metadata track state<" + "/i>");
- testExpected("track.readyState", HTMLTrackElement.LOADED);
- testExpected("track.track.mode", "hidden");
- testExpected("video.textTracks[0].cues.length", 12);
- testExpected("video.textTracks[0].cues[11].startTime", 22);
- consoleWrite("");
- endTest();
- }
+ video.src = findMediaFile("video", "../content/test");
+ video.oncanplaythrough = t.step_func(canplaythrough);
+ track.onload = t.step_func_done(trackLoaded);
- function canplaythrough()
- {
- consoleWrite("EVENT(canplaythrough) -- &lt;video&gt;");
- consoleWrite("<i>**change metadata track mode so it loads<" + "/i>");
- testExpected("track.readyState", HTMLTrackElement.NONE);
- testExpected("video.textTracks[0].mode", "disabled");
- testExpected("video.textTracks[0].cues", null);
- run("video.textTracks[0].mode = 'hidden'");
- consoleWrite("");
- }
+ function trackLoaded() {
+ assert_equals(track.readyState, HTMLTrackElement.LOADED);
+ assert_equals(track.track.mode, "hidden");
+ assert_equals(video.textTracks[0].cues.length, 12);
+ assert_equals(video.textTracks[0].cues[11].startTime, 22);
+ }
- function start()
- {
- consoleWrite("<br>EVENT(load) -- &lt;body&gt;");
- findMediaElement();
-
- consoleWrite("<i>**check initial metadata track state<" + "/i>");
- track = document.querySelectorAll('track')[0];
- testExpected("track.readyState", HTMLTrackElement.NONE);
- testExpected("video.textTracks[0].mode", "disabled");
-
- video.src = findMediaFile("video", "../content/test");
- consoleWrite("");
- }
- </script>
- </head>
-
- <body onload="start()">
- <p>Tests that a 'metadata' track does not load automatically, but does load when the mode is changed.</p>
- <video oncanplaythrough="canplaythrough()" >
- <track kind="metadata" src="captions-webvtt/metadata.vtt" onload="trackLoaded()">
- </video>
- </body>
-</html>
+ function canplaythrough() {
+ assert_equals(track.readyState, HTMLTrackElement.NONE);
+ assert_equals(video.textTracks[0].mode, "disabled");
+ assert_equals(video.textTracks[0].cues, null);
+ // Change metadata track mode so it loads.
+ video.textTracks[0].mode = "hidden";
+ }
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698