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

Unified Diff: third_party/WebKit/LayoutTests/media/track/track-webvtt-tc016-align-positioning.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: 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-tc016-align-positioning.html
diff --git a/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc016-align-positioning.html b/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc016-align-positioning.html
index 5291c8a8e60a1ee80afdb856475bf23647bc3c81..11cd14f910de8fea45114483edf9c47ac7364d02 100644
--- a/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc016-align-positioning.html
+++ b/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc016-align-positioning.html
@@ -1,77 +1,75 @@
<!DOCTYPE html>
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Tests cue text position and alignment 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/tc016-align-positioning.vtt">
+ <track src="captions-webvtt/tc016-align-positioning-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");
+ for (var i = 0; i < video.textTracks.length; i++)
fs 2016/05/25 19:49:56 It feels a bit odd to use another length for itera
Srirama 2016/05/26 10:47:18 Done.
+ 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 : 3,
- tests:
- [
- {
- property : "position",
- values : [10, 20, 80],
- },
- {
- property : "align",
- values : ["start", "middle", "end"],
- },
- ],
- };
- testCues(i, expected);
+ testTrack(0);
+ testTrackError(1);
+ t.done();
+ }
- allTestsEnded();
+ function testTrack(index) {
+ var expected = [
+ {
+ position : 10,
fs 2016/05/25 19:49:56 I think it would be ok to write these lists as one
Srirama 2016/05/26 10:47:18 Done.
+ align : "start",
+ vertical : ""
+ },
+ {
+ position : 20,
+ align : "middle",
+ vertical : ""
+ },
+ {
+ position : 80,
+ align : "end",
+ vertical : ""
}
+ ];
- function testTrackError(i)
- {
- findMediaElement();
- var expected =
- {
- length : 3,
- tests:
- [
- {
- property : "position",
- values : [10, "auto", "auto"],
- },
- {
- property : "align",
- values : ["middle", "middle", "middle"],
- },
- ],
- };
- testCues(i, expected);
+ assert_cues_equal_by_style(video.textTracks[index].cues, expected);
+ }
- allTestsEnded();
+ function testTrackError(index) {
+ var expected = [
+ {
+ position : 10,
+ align : "middle",
+ vertical : ""
+ },
+ {
+ position : "auto",
+ align : "middle",
+ vertical : ""
+ },
+ {
+ position : "auto",
+ align : "middle",
+ vertical : ""
}
- </script>
- </head>
- <body onload="enableAllTextTracks()">
- <p>Tests cue text position and alignment from settings.</p>
- <video>
- <track src="captions-webvtt/tc016-align-positioning.vtt" onload="trackLoaded()">
- <track src="captions-webvtt/tc016-align-positioning-bad.vtt" onload="trackLoaded()">
- </video>
- </body>
-</html>
+ ];
+
+ assert_cues_equal_by_style(video.textTracks[index].cues, expected);
+ }
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698