Index: LayoutTests/media/video-controls-captions.html |
diff --git a/LayoutTests/media/video-controls-captions.html b/LayoutTests/media/video-controls-captions.html |
index 8f827cabb4f6a89404137ecbd3ff89cadb35401c..e7610c394232196ee7c0e6d627b22271c3ab9855 100644 |
--- a/LayoutTests/media/video-controls-captions.html |
+++ b/LayoutTests/media/video-controls-captions.html |
@@ -7,8 +7,6 @@ |
<script src=media-controls.js></script> |
<script src=video-test.js></script> |
<script> |
- var captionsButtonElement; |
- var captionsButtonCoordinates; |
var track; |
function addTextTrackThroughJS() |
@@ -45,29 +43,12 @@ |
video.removeChild(htmlTrack); |
} |
- function testClosedCaptionsButtonVisibility(expected) |
+ function checkCaptionsDisplay() |
{ |
- try { |
- captionsButtonElement = mediaControlsElement(internals.shadowRoot(video).firstChild, "-webkit-media-controls-toggle-closed-captions-button"); |
- captionsButtonCoordinates = mediaControlsButtonCoordinates(video, "toggle-closed-captions-button"); |
- } catch (exception) { |
- consoleWrite("Failed to find a closed captions button or its coordinates: " + exception); |
- if (expected) |
- failTest(); |
- return; |
- } |
- |
- consoleWrite(""); |
- if (expected == true) { |
- consoleWrite("** Caption button should be visible and enabled because we have a captions track."); |
- testExpected("captionsButtonCoordinates[0]", 0, ">"); |
- testExpected("captionsButtonCoordinates[1]", 0, ">"); |
- testExpected("captionsButtonElement.disabled", false); |
- } else { |
- consoleWrite("** Caption button should not be visible as there are no caption tracks."); |
- testExpected("captionsButtonCoordinates[0]", 0, "<="); |
- testExpected("captionsButtonCoordinates[1]", 0, "<="); |
- } |
+ // When no tracks are loaded, this should report no text track container, |
+ // when tracks are loaded but not visible, should report no cues visible, |
+ // when tracks are loaded and visible, should properly check the text. |
+ testExpected("textTrackDisplayElement(video, 'display').innerText", "Lorem"); |
} |
function startTest() |
@@ -88,26 +69,14 @@ |
consoleWrite(""); |
consoleWrite("** Captions track should load and captions should become visible after button is clicked **"); |
- clickCCButton(); |
- } |
- |
- function clickCCButton() |
- { |
- consoleWrite("*** Click the CC button."); |
- eventSender.mouseMoveTo(captionsButtonCoordinates[0], captionsButtonCoordinates[1]); |
- eventSender.mouseDown(); |
- eventSender.mouseUp(); |
- } |
- function checkCaptionsDisplay() |
- { |
- // When no tracks are loaded, this should report no text track container, |
- // when tracks are loaded but not visible, should report no cues visible, |
- // when tracks are loaded and visible, should properly check the text. |
- testExpected("textTrackDisplayElement(video, 'display').innerText", "Lorem"); |
+ // Note: the test flow continues with "testCCButtonToggling" when the |
+ // "load" event of the single TextTrack fires up. While the test structure |
+ // might seem weird, this avoids timeouts. |
+ clickCCButton(); |
} |
- function trackLoaded() |
+ function testCCButtonToggling() |
{ |
checkCaptionsDisplay(); |
@@ -137,13 +106,9 @@ |
endTest(); |
} |
- |
function loaded() |
{ |
findMediaElement(); |
- consoleWrite("Set the user language preference so that the track will be chosen when the CC button is clicked."); |
- run("internals.setUserPreferredLanguages(['en'])"); |
- |
waitForEvent('canplaythrough', startTest); |
video.src = findMediaFile('video', 'content/counting'); |
@@ -152,9 +117,8 @@ |
</head> |
<body onload="loaded()"> |
<p>Tests that the closed captions button, when toggled, updates the text track display area.</p> |
- <video controls > |
- <track src="track/captions-webvtt/captions-fast.vtt" kind="captions" srclang="en" onload="trackLoaded()"> |
+ <video controls> |
+ <track src="track/captions-webvtt/captions-fast.vtt" kind="captions" onload="testCCButtonToggling()"> |
</video> |
- |
</body> |
</html> |