| Index: third_party/WebKit/LayoutTests/media/video-controls-track-selection-menu.html
|
| diff --git a/third_party/WebKit/LayoutTests/media/video-controls-track-selection-menu.html b/third_party/WebKit/LayoutTests/media/video-controls-track-selection-menu.html
|
| index 450899c8d957cd01636e693c2cac31819963a9dd..140171b5e7a616644f3ae238ad096f4f395064b0 100644
|
| --- a/third_party/WebKit/LayoutTests/media/video-controls-track-selection-menu.html
|
| +++ b/third_party/WebKit/LayoutTests/media/video-controls-track-selection-menu.html
|
| @@ -1,49 +1,50 @@
|
| <!DOCTYPE html>
|
| +<title>Test that we can display a track list menu and select tracks from the list.</title>
|
| +<script src="../resources/testharness.js"></script>
|
| +<script src="../resources/testharnessreport.js"></script>
|
| +<script src="track/track-helpers.js"></script>
|
| <script src="media-file.js"></script>
|
| -<!-- TODO(srivats): 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>
|
| +<video controls>
|
| + <track src="track/captions-webvtt/captions.vtt" kind="captions" label="Track1">
|
| + <track src="track/captions-webvtt/long-word.vtt" kind="captions" label="Track2">
|
| +</video>
|
| <script>
|
| +async_test(function(t) {
|
| + var video = document.querySelector("video");
|
|
|
| - function startTest()
|
| - {
|
| - findMediaElement();
|
| - testClosedCaptionsButtonVisibility(true);
|
| - consoleWrite("");
|
| - testExpected("video.textTracks.length", 2);
|
| - testExpected("video.textTracks[0].mode", "hidden");
|
| - testExpected("video.textTracks[1].mode", "hidden");
|
| + var trackElements = document.querySelectorAll("track");
|
| + for (var i = 0; i < video.textTracks.length; i++)
|
| + trackElements[i].onload = t.step_func(trackLoaded);
|
|
|
| - consoleWrite("");
|
| - consoleWrite("Select track 0 and verify it is displayed");
|
| - selectTextTrack(video, 0);
|
| - testExpected("video.textTracks[0].mode", "showing");
|
| - testExpected("video.textTracks[1].mode", "hidden");
|
| - testExpected("textTrackDisplayElement(video, 'display').innerText", "Lorem");
|
| + enableAllTextTracks(video.textTracks);
|
|
|
| - consoleWrite("");
|
| - consoleWrite("Select track 1 and verify it is displayed");
|
| - selectTextTrack(video, 1);
|
| - testExpected("video.textTracks[0].mode", "disabled");
|
| - testExpected("video.textTracks[1].mode", "showing");
|
| - testExpected("textTrackDisplayElement(video, 'display').innerText", "first caption");
|
| + var numberOfTracksLoaded = 0;
|
| + function trackLoaded() {
|
| + numberOfTracksLoaded++;
|
| + if (numberOfTracksLoaded != 2)
|
| + return;
|
|
|
| - consoleWrite("");
|
| - endTest();
|
| - }
|
| + video.oncanplaythrough = t.step_func_done(function() {
|
| + assert_true(isClosedCaptionsButtonVisible(video));
|
| + assert_equals(video.textTracks.length, 2);
|
| + assert_equals(video.textTracks[0].mode, "hidden");
|
| + assert_equals(video.textTracks[1].mode, "hidden");
|
| +
|
| + // Select track 0 and verify it is displayed.
|
| + clickTextTrackAtIndex(video, 0);
|
| + assert_equals(video.textTracks[0].mode, "showing");
|
| + assert_equals(video.textTracks[1].mode, "hidden");
|
| + assert_equals(textTrackDisplayElement(video, "display").innerText, "Lorem");
|
| +
|
| + // Select track 1 and verify it is displayed.
|
| + clickTextTrackAtIndex(video, 1);
|
| + assert_equals(video.textTracks[0].mode, "disabled");
|
| + assert_equals(video.textTracks[1].mode, "showing");
|
| + assert_equals(textTrackDisplayElement(video, "display").innerText, "first caption");
|
| + });
|
|
|
| - window.onload = function()
|
| - {
|
| - consoleWrite("Test that we can display a track list menu and select tracks from the list");
|
| - findMediaElement();
|
| video.src = findMediaFile("video", "content/test");
|
| - enableAllTextTracks();
|
| - waitForEvent("canplaythrough", startTest);
|
| }
|
| -
|
| -</script>
|
| -<video controls>
|
| - <track src="track/captions-webvtt/captions.vtt" kind="captions" label="Track1">
|
| - <track src="track/captions-webvtt/long-word.vtt" kind="captions" label="Track2">
|
| -</video>
|
| +});
|
| +</script>
|
|
|