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

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: 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-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..4332bd50d3993508b815fb92d397e34850390c76 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,54 @@
<!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");
+ 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 : 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, align : "start" },
+ { position : 20, align : "middle" },
+ { position : 80, align : "end" }
+ ];
+ var properties = [ "position", "align" ];
- 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_match(video.textTracks[index].cues, expected, properties);
+ }
- allTestsEnded();
- }
- </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>
+ function testTrackError(index) {
+ var expected = [
+ { position : 10, align : "middle" },
+ { position : "auto", align : "middle" },
+ { position : "auto", align : "middle" }
+ ];
+ var properties = [ "position", "align" ];
+
+ assert_cues_match(video.textTracks[index].cues, expected, properties);
+ }
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698