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

Unified Diff: third_party/WebKit/LayoutTests/media/track/track-webvtt-tc017-line-position.html

Issue 2012833002: Convert track-webvtt-tc[016-018] 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-webvtt-tc017-line-position.html
diff --git a/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc017-line-position.html b/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc017-line-position.html
index 31654a312f7d3661d7de619a034b9b563639a14b..bf2eccba1faba0c2739f540c760da494019df7a5 100644
--- a/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc017-line-position.html
+++ b/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc017-line-position.html
@@ -1,77 +1,61 @@
<!DOCTYPE html>
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Tests cue line position from settings.</title>
+<script src="track-helpers.js"></script>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<video>
+ <track src="captions-webvtt/tc017-line-position.vtt">
+ <track src="captions-webvtt/tc017-line-position-bad.vtt">
+</video>
+<script>
+async_test(function(t) {
+ var video = document.querySelector("video");
- <script src=../media-file.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>
+ var trackElements = document.querySelectorAll("track");
+ assert_equals(trackElements.length, video.textTracks.length);
+ for (var i = 0; i < trackElements.length; i++)
+ trackElements[i].onload = t.step_func(trackLoaded);
- var numberOfTrackTests = 2;
+ enableAllTextTracks(video.textTracks);
- function trackLoaded()
- {
- numberOfTracksLoaded++;
- if (numberOfTracksLoaded == numberOfTrackTests) {
- testTrack(0);
- testTrackError(1);
- }
- }
+ var numberOfTracksLoaded = 0;
+ function trackLoaded() {
+ numberOfTracksLoaded++;
+ if (numberOfTracksLoaded != 2)
+ return;
- function testTrack(i)
- {
- findMediaElement();
- var expected =
- {
- length : 7,
- tests:
- [
- {
- property : "line",
- values : [0, 0, 50, 5, 100, -1, 500],
- },
- {
- property : "snapToLines",
- values : [false, true, false, true, false, true, true],
- },
- ],
- };
- testCues(i, expected);
+ testTrack(0);
+ testTrackError(1);
+ t.done();
+ }
- allTestsEnded();
- }
+ function testTrack(index) {
+ var expected = [
+ { line : 0, snapToLines : false },
+ { line : 0, snapToLines : true },
+ { line : 50, snapToLines : false },
+ { line : 5, snapToLines : true },
+ { line : 100, snapToLines : false },
+ { line : -1, snapToLines : true },
+ { line : 500, snapToLines : true }
+ ];
+ var properties = [ "line", "snapToLines" ];
- function testTrackError(i)
- {
- findMediaElement();
- var expected =
- {
- length : 6,
- tests:
- [
- {
- property : "line",
- values : ["auto", "auto", "auto", "auto", "auto", "auto", "auto"],
- },
- {
- property : "snapToLines",
- values : [true, true, true, true, true, true, true],
- },
- ],
- };
- testCues(i, expected);
+ assert_cues_match(video.textTracks[index].cues, expected, properties);
+ }
- allTestsEnded();
- }
- </script>
- </head>
- <body onload="enableAllTextTracks()">
- <p>Tests cue line position from settings.</p>
- <video>
- <track src="captions-webvtt/tc017-line-position.vtt" onload="trackLoaded()">
- <track src="captions-webvtt/tc017-line-position-bad.vtt" onload="trackLoaded()">
- </video>
- </body>
-</html>
+ function testTrackError(index) {
+ var expected = [
+ { line : "auto", snapToLines : true },
+ { line : "auto", snapToLines : true },
+ { line : "auto", snapToLines : true },
+ { line : "auto", snapToLines : true },
+ { line : "auto", snapToLines : true },
+ { line : "auto", snapToLines : true }
+ ];
+ var properties = [ "line", "snapToLines" ];
+
+ assert_cues_match(video.textTracks[index].cues, expected, properties);
+ }
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698