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

Unified Diff: third_party/WebKit/LayoutTests/media/track/track-cue-nothing-to-render.html

Issue 1887943002: Convert track tests from video-test.js to testharness.js based (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address nits Created 4 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/track/track-cue-nothing-to-render-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/media/track/track-cue-nothing-to-render.html
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-nothing-to-render.html b/third_party/WebKit/LayoutTests/media/track/track-cue-nothing-to-render.html
index c8a03a80b10d58c6d3cb902c9f75552647d9aeb7..1b3fff3c58068d683667e8e35a396258bb2086b6 100644
--- a/third_party/WebKit/LayoutTests/media/track/track-cue-nothing-to-render.html
+++ b/third_party/WebKit/LayoutTests/media/track/track-cue-nothing-to-render.html
@@ -1,65 +1,50 @@
<!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 src=../media-controls.js></script>
-
- <script>
-
- var testTrack;
- var seekedCount = 0;
- var info = [
- 0.5, "",
- 1.5, "Lorem ipsum dolor sit amet,",
- 2.5, "",
- 3.3, "consectetuer adipiscing elit,",
- 0.6, "",
- 5.9, "sed diam nonummy nibh euismod tincidunt",
- 4.4, "",
- 7.9, "ut laoreet dolore magna aliquam erat volutpat."
- ];
-
- function seeked()
- {
- var time = info[seekedCount];
- var cueText = info[seekedCount + 1];
- seekedCount += 2;
-
- testExpected("video.currentTime.toFixed(1)", time.toFixed(1));
- if (cueText.length)
- testExpected("testTrack.track.activeCues[0].text", cueText);
- testExpected("textTrackDisplayElement(video, 'display').innerText", cueText);
-
- if (seekedCount >= info.length) {
- consoleWrite("");
- endTest();
- return;
- }
-
- consoleWrite("");
- run("video.currentTime = " + (info[seekedCount]));
+<title>Test that cues are rendered and removed.</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-gaps.vtt" kind="captions" default>
+</video>
+<script>
+async_test(function(t) {
+ var video = document.querySelector("video");
+ var testTrack = document.querySelector("track");
+ video.src = findMediaFile("video", "../content/counting");
+
+ var seekTimeIndex = 0;
+ var info = [
+ 0.5, "",
+ 1.5, "Lorem ipsum dolor sit amet,",
+ 2.5, "",
+ 3.3, "consectetuer adipiscing elit,",
+ 0.6, "",
+ 5.9, "sed diam nonummy nibh euismod tincidunt",
+ 4.4, "",
+ 7.9, "ut laoreet dolore magna aliquam erat volutpat."
+ ];
+
+ video.onseeked = t.step_func(function() {
+ var time = info[seekTimeIndex];
+ assert_equals(video.currentTime, time);
+ var cueText = info[++seekTimeIndex];
+ ++seekTimeIndex;
+
+ assert_equals(video.currentTime.toFixed(1), time.toFixed(1));
+ if (cueText.length) {
+ assert_equals(testTrack.track.activeCues[0].text, cueText);
+ assert_equals(textTrackDisplayElement(video, "display").innerText, cueText);
+ } else {
+ assert_equals(testTrack.track.activeCues.length, 0);
}
- function loaded()
- {
- findMediaElement();
- testTrack = document.querySelector('track');
- video.src = findMediaFile('video', '../content/counting');
- waitForEvent('seeked', seeked);
- waitForEventOnce('canplaythrough', function() { video.currentTime = .5; });
- }
+ if (seekTimeIndex >= info.length)
+ t.done();
+
+ video.currentTime = info[seekTimeIndex];
+ });
- </script>
- </head>
- <body onload="loaded()">
- <video controls >
- <track src="captions-webvtt/captions-gaps.vtt" kind="captions" default>
- </video>
- <p>Test that cues are rendered and removed.</p>
- </body>
-</html>
+ video.currentTime = info[0];
+});
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/track/track-cue-nothing-to-render-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698