Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[mediacontrols] Add tests for the status display label
https://bugs.webkit.org/show_bug.cgi?id=148656 <rdar://problem/22509779> Reviewed by Eric Carlson. Source/WebCore: Export the StatusDisplay element and its current content. Tests: media/controls/statusDisplay.html media/controls/statusDisplayBad.html * Modules/mediacontrols/mediaControlsApple.js: (Controller.prototype.getCurrentControlsStatus): LayoutTests: Add a test for the normal status of the status display, and another for the content when we load a bad URL. * media/controls/statusDisplay-expected.txt: Added. * media/controls/statusDisplay.html: Added. * media/controls/statusDisplayBad-expected.txt: Added. * media/controls/statusDisplayBad.html: Added. Canonical link: https://commits.webkit.org/166793@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189215 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
7 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,11 @@ | ||
This tests for the content in the status display. | ||
|
||
This test only runs in DRT! | ||
|
||
|
||
EVENT(canplaythrough) | ||
EXPECTED (statusDisplayInfo.name == 'Status Display') OK | ||
EXPECTED (statusDisplayInfo.className == 'hidden') OK | ||
EXPECTED (statusDisplayInfo.content == '') OK | ||
END OF TEST | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,46 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="../media-file.js"></script> | ||
<script src="../video-test.js"></script> | ||
<script src="controls-test-helpers.js"></script> | ||
<script> | ||
var video; | ||
var currentStatus; | ||
var statusDisplayInfo; | ||
|
||
function init() | ||
{ | ||
findMediaElement(); | ||
video.src = findMediaFile("video", "../content/test"); | ||
|
||
waitForEvent("canplaythrough", canplaythrough); | ||
waitForEventAndFail("error"); | ||
} | ||
|
||
function canplaythrough() | ||
{ | ||
if (!window.testRunner) | ||
return; | ||
|
||
currentStatus = JSON.parse(internals.getCurrentMediaControlsStatusForElement(video)); | ||
if (currentStatus) { | ||
if (currentStatus.idiom == "apple") { | ||
statusDisplayInfo = statusForControlsElement(currentStatus, "Status Display"); | ||
if (statusDisplayInfo) { | ||
testExpected("statusDisplayInfo.name", "Status Display"); | ||
testExpected("statusDisplayInfo.className", "hidden"); | ||
testExpected("statusDisplayInfo.content", ""); | ||
} | ||
} | ||
} | ||
endTest(); | ||
} | ||
</script> | ||
</head> | ||
<body onload="init()"> | ||
<p>This tests for the content in the status display.</p> | ||
<p>This test only runs in DRT!</p> | ||
<video controls></video> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,11 @@ | ||
This tests that the status display has the corrent error message. | ||
|
||
This test only runs in DRT! | ||
|
||
|
||
EVENT(error) | ||
EXPECTED (statusDisplayInfo.name == 'Status Display') OK | ||
EXPECTED (statusDisplayInfo.className == '') OK | ||
EXPECTED (statusDisplayInfo.content == 'Error') OK | ||
END OF TEST | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,45 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="../media-file.js"></script> | ||
<script src="../video-test.js"></script> | ||
<script src="controls-test-helpers.js"></script> | ||
<script> | ||
var video; | ||
var currentStatus; | ||
var statusDisplayInfo; | ||
|
||
function init() | ||
{ | ||
findMediaElement(); | ||
video.src = findMediaFile("video", "non-existent-media-file"); | ||
|
||
waitForEvent("error", runTest); | ||
} | ||
|
||
function runTest() | ||
{ | ||
if (!window.testRunner) | ||
return; | ||
|
||
currentStatus = JSON.parse(internals.getCurrentMediaControlsStatusForElement(video)); | ||
if (currentStatus) { | ||
if (currentStatus.idiom == "apple") { | ||
statusDisplayInfo = statusForControlsElement(currentStatus, "Status Display"); | ||
if (statusDisplayInfo) { | ||
testExpected("statusDisplayInfo.name", "Status Display"); | ||
testExpected("statusDisplayInfo.className", ""); | ||
testExpected("statusDisplayInfo.content", "Error"); | ||
} | ||
} | ||
} | ||
endTest(); | ||
} | ||
</script> | ||
</head> | ||
<body onload="init()"> | ||
<p>This tests that the status display has the corrent error message.</p> | ||
<p>This test only runs in DRT!</p> | ||
<video controls></video> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters