Skip to content
Permalink
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
grorg committed Sep 1, 2015
1 parent 38cde5c commit f2bb7ac839032d83d3a59ba696a3095e5e602449
Showing 7 changed files with 150 additions and 0 deletions.
@@ -1,3 +1,19 @@
2015-08-31 Dean Jackson <dino@apple.com>

[mediacontrols] Add tests for the status display label
https://bugs.webkit.org/show_bug.cgi?id=148656
<rdar://problem/22509779>

Reviewed by Eric Carlson.

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.

2015-08-31 Dean Jackson <dino@apple.com>

[mediacontrols] Add a test for the show controls button
@@ -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

@@ -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>
@@ -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

@@ -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>
@@ -1,3 +1,19 @@
2015-08-31 Dean Jackson <dino@apple.com>

[mediacontrols] Add tests for the status display label
https://bugs.webkit.org/show_bug.cgi?id=148656
<rdar://problem/22509779>

Reviewed by Eric Carlson.

Export the StatusDisplay element and its current content.

Tests: media/controls/statusDisplay.html
media/controls/statusDisplayBad.html

* Modules/mediacontrols/mediaControlsApple.js:
(Controller.prototype.getCurrentControlsStatus):

2015-08-31 Dean Jackson <dino@apple.com>

[mediacontrols] Add a test for the show controls button
@@ -2104,6 +2104,11 @@ Controller.prototype = {
name: "Show Controls",
className: this.showControlsButton.className,
hidden: this.showControlsButton.hidden
},
{
name: "Status Display",
className: this.controls.statusDisplay.className,
content: this.controls.statusDisplay.textContent
}
]
});

0 comments on commit f2bb7ac

Please sign in to comment.