<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[189254] trunk/LayoutTests</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/189254">189254</a></dd>
<dt>Author</dt> <dd>dino@apple.com</dd>
<dt>Date</dt> <dd>2015-09-02 10:33:17 -0700 (Wed, 02 Sep 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>[mediacontrols] Improve media controls testing helpers
https://bugs.webkit.org/show_bug.cgi?id=148697
<rdar://problem/22530876>
Reviewed by Eric Carlson.
Implement a more modern-looking testing API for media
controls tests, and update the existing tests to
use the new API.
* media/controls/basic-expected.txt:
* media/controls/basic.html:
* media/controls/controls-test-helpers.js:
(ControlsTest): New class for helping testing.
(statusForControlsElement): Deleted.
* media/controls/showControlsButton-expected.txt:
* media/controls/showControlsButton.html:
* media/controls/statusDisplay-expected.txt:
* media/controls/statusDisplay.html:
* media/controls/statusDisplayBad-expected.txt:
* media/controls/statusDisplayBad.html:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsmediacontrolsbasicexpectedtxt">trunk/LayoutTests/media/controls/basic-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediacontrolsbasichtml">trunk/LayoutTests/media/controls/basic.html</a></li>
<li><a href="#trunkLayoutTestsmediacontrolscontrolstesthelpersjs">trunk/LayoutTests/media/controls/controls-test-helpers.js</a></li>
<li><a href="#trunkLayoutTestsmediacontrolsshowControlsButtonexpectedtxt">trunk/LayoutTests/media/controls/showControlsButton-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediacontrolsshowControlsButtonhtml">trunk/LayoutTests/media/controls/showControlsButton.html</a></li>
<li><a href="#trunkLayoutTestsmediacontrolsstatusDisplayexpectedtxt">trunk/LayoutTests/media/controls/statusDisplay-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediacontrolsstatusDisplayhtml">trunk/LayoutTests/media/controls/statusDisplay.html</a></li>
<li><a href="#trunkLayoutTestsmediacontrolsstatusDisplayBadexpectedtxt">trunk/LayoutTests/media/controls/statusDisplayBad-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediacontrolsstatusDisplayBadhtml">trunk/LayoutTests/media/controls/statusDisplayBad.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (189253 => 189254)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-09-02 17:09:00 UTC (rev 189253)
+++ trunk/LayoutTests/ChangeLog        2015-09-02 17:33:17 UTC (rev 189254)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2015-09-01 Dean Jackson <dino@apple.com>
+
+ [mediacontrols] Improve media controls testing helpers
+ https://bugs.webkit.org/show_bug.cgi?id=148697
+ <rdar://problem/22530876>
+
+ Reviewed by Eric Carlson.
+
+ Implement a more modern-looking testing API for media
+ controls tests, and update the existing tests to
+ use the new API.
+
+ * media/controls/basic-expected.txt:
+ * media/controls/basic.html:
+ * media/controls/controls-test-helpers.js:
+ (ControlsTest): New class for helping testing.
+ (statusForControlsElement): Deleted.
+ * media/controls/showControlsButton-expected.txt:
+ * media/controls/showControlsButton.html:
+ * media/controls/statusDisplay-expected.txt:
+ * media/controls/statusDisplay.html:
+ * media/controls/statusDisplayBad-expected.txt:
+ * media/controls/statusDisplayBad.html:
+
</ins><span class="cx"> 2015-09-02 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> document.createProcessingInstruction() does not behave according to specification
</span></span></pre></div>
<a id="trunkLayoutTestsmediacontrolsbasicexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/media/controls/basic-expected.txt (189253 => 189254)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/controls/basic-expected.txt        2015-09-02 17:09:00 UTC (rev 189253)
+++ trunk/LayoutTests/media/controls/basic-expected.txt        2015-09-02 17:33:17 UTC (rev 189254)
</span><span class="lines">@@ -3,8 +3,8 @@
</span><span class="cx"> This test only runs in DRT!
</span><span class="cx">
</span><span class="cx">
</span><del>-EVENT(canplaythrough)
-TEST(currentStatus != null) OK
-EXPECTED (currentStatus.status == 'ok') OK
-END OF TEST
</del><ins>+EVENT: canplaythrough
+PASS: Check that status is ok
</ins><span class="cx">
</span><ins>+Testing finished.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediacontrolsbasichtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/media/controls/basic.html (189253 => 189254)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/controls/basic.html        2015-09-02 17:09:00 UTC (rev 189253)
+++ trunk/LayoutTests/media/controls/basic.html        2015-09-02 17:33:17 UTC (rev 189254)
</span><span class="lines">@@ -2,34 +2,24 @@
</span><span class="cx"> <html>
</span><span class="cx"> <head>
</span><span class="cx"> <script src="../media-file.js"></script>
</span><del>- <script src="../video-test.js"></script>
</del><ins>+ <script src="controls-test-helpers.js"></script>
</ins><span class="cx"> <script>
</span><del>- var video;
- var currentStatus;
</del><ins>+ var tester = new ControlsTest()
+ .whenReady(runTests)
+ .start();
</ins><span class="cx">
</span><del>- function init()
</del><ins>+ function runTests()
</ins><span class="cx"> {
</span><del>- findMediaElement();
- video.src = findMediaFile("video", "../content/test");
</del><ins>+ currentState = tester.currentState;
+ tester.test("Check that status is ok")
+ .value(currentState.status)
+ .isEqualTo("ok");
</ins><span class="cx">
</span><del>- waitForEvent("canplaythrough", canplaythrough);
- waitForEventAndFail("error");
</del><ins>+ tester.end();
</ins><span class="cx"> }
</span><del>-
- function canplaythrough()
- {
- if (!window.testRunner)
- return;
-
- currentStatus = JSON.parse(internals.getCurrentMediaControlsStatusForElement(video));
- test("currentStatus != null");
- if (currentStatus)
- testExpected("currentStatus.status", "ok");
- endTest();
- }
</del><span class="cx"> </script>
</span><span class="cx"> </head>
</span><del>- <body onload="init()">
</del><ins>+ <body>
</ins><span class="cx"> <p>This is a basic test of the internal controls status API.</p>
</span><span class="cx"> <p>This test only runs in DRT!</p>
</span><span class="cx"> <video controls></video>
</span></span></pre></div>
<a id="trunkLayoutTestsmediacontrolscontrolstesthelpersjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/media/controls/controls-test-helpers.js (189253 => 189254)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/controls/controls-test-helpers.js        2015-09-02 17:09:00 UTC (rev 189253)
+++ trunk/LayoutTests/media/controls/controls-test-helpers.js        2015-09-02 17:33:17 UTC (rev 189254)
</span><span class="lines">@@ -1,10 +1,170 @@
</span><del>-function statusForControlsElement(statusObject, elementName)
-{
- if (statusObject.elements && statusObject.elements.length) {
- for (var i = 0; i < statusObject.elements.length; i++) {
- if (statusObject.elements[i].name == elementName)
- return statusObject.elements[i];
</del><ins>+ControlsTest = class ControlsTest {
+ constructor(mediaURL, eventTrigger)
+ {
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
</ins><span class="cx"> }
</span><ins>+
+ this.callback = null;
+ this.mediaURL = mediaURL || "../content/test";
+ this.eventTrigger = eventTrigger || "canplaythrough";
+ this.currentMessage = "";
+ this.currentValue = null;
</ins><span class="cx"> }
</span><del>- return null;
</del><ins>+
+ whenReady(callback)
+ {
+ if (typeof callback == "function")
+ this.callback = callback;
+ return this;
+ }
+
+ get currentState()
+ {
+ if (!this.media)
+ return null;
+
+ if (window.internals)
+ return JSON.parse(internals.getCurrentMediaControlsStatusForElement(this.media));
+
+ // This is only for fallback testing. Even then it is pretty useless.
+ return { idiom: "apple", status: "fail" };
+ }
+
+ stateForControlsElement(elementName)
+ {
+ var state = this.currentState;
+ if (state.elements && state.elements.length) {
+ for (var i = 0; i < state.elements.length; i++) {
+ if (state.elements[i].name == elementName)
+ return state.elements[i];
+ }
+ }
+ return null;
+ }
+
+ handleEvent(event)
+ {
+ this.logMessage(`EVENT: ${event.type}`);
+ if (event.type == this.eventTrigger && this.callback)
+ this.callback();
+ }
+
+ logSuccess(msg)
+ {
+ this.logMessage(`PASS: ${msg}`);
+ }
+
+ logFailure(msg)
+ {
+ this.logMessage(`FAIL: ${msg}`);
+ }
+
+ logMessage(msg)
+ {
+ this.console.appendChild(document.createTextNode(msg));
+ this.logBlankLine();
+ }
+
+ logBlankLine()
+ {
+ this.console.appendChild(document.createElement("br"));
+ }
+
+ startNewSection(msg)
+ {
+ this.logBlankLine();
+ this.logMessage(msg);
+ this.logBlankLine();
+ }
+
+ setup()
+ {
+ if (!window.testRunner) {
+ this.logFailure("Test requires DRT.");
+ return false;
+ }
+
+ this.console = document.createElement("div");
+ this.console.className = "console";
+ document.body.appendChild(this.console);
+
+ this.media = document.querySelector("video");
+
+ if (!this.media) {
+ this.logFailure("Unable to find media element");
+ this.end();
+ return false;
+ }
+
+ this.media.addEventListener(this.eventTrigger, this, false);
+ this.media.src = findMediaFile("video", this.mediaURL);
+
+ return true;
+ }
+
+ start(msg)
+ {
+ window.addEventListener("load", function () {
+ this.setup();
+ if (msg)
+ this.startNewSection(msg);
+ }.bind(this), false);
+ return this;
+ }
+
+ end()
+ {
+ this.logMessage("");
+ this.logMessage("Testing finished.");
+ if (window.testRunner)
+ testRunner.notifyDone();
+ return this;
+ }
+
+ test(message)
+ {
+ this.currentMessage = message;
+ return this;
+ }
+
+ value(newValue)
+ {
+ this.currentValue = newValue;
+ return this;
+ }
+
+ isEqualTo(value)
+ {
+ if (this.currentValue == value)
+ this.logSuccess(this.currentMessage);
+ else
+ this.logFailure(`${this.currentMessage} Expected: "${value}". Actual: "${this.currentValue}"`);
+ }
+
+ isEmptyString()
+ {
+ if (!this.currentValue && typeof this.currentValue == "string")
+ this.logSuccess(this.currentMessage);
+ else
+ this.logFailure(`${this.currentMessage} Expected an empty string. Actual: "${this.currentValue}"`);
+ }
+
+ isTrue()
+ {
+ if (this.currentValue)
+ this.logSuccess(this.currentMessage);
+ else
+ this.logFailure(`${this.currentMessage} Expected a true value. Actual: "${this.currentValue}"`);
+ }
+
+ isFalse()
+ {
+ if (!this.currentValue)
+ this.logSuccess(this.currentMessage);
+ else
+ this.logFailure(`${this.currentMessage} Expected a false value. Actual: "${this.currentValue}"`);
+ }
+
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkLayoutTestsmediacontrolsshowControlsButtonexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/media/controls/showControlsButton-expected.txt (189253 => 189254)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/controls/showControlsButton-expected.txt        2015-09-02 17:09:00 UTC (rev 189253)
+++ trunk/LayoutTests/media/controls/showControlsButton-expected.txt        2015-09-02 17:33:17 UTC (rev 189254)
</span><span class="lines">@@ -3,8 +3,16 @@
</span><span class="cx"> This test only runs in DRT!
</span><span class="cx">
</span><span class="cx">
</span><del>-EVENT(canplaythrough)
-EXPECTED (showControlsButtonInfo.name == 'Show Controls') OK
-EXPECTED (showControlsButtonInfo.hidden == 'true') OK
-END OF TEST
</del><span class="cx">
</span><ins>+Test for Show Controls button
+
+EVENT: canplaythrough
+PASS: We are using the apple idiom
+
+Get the button that shows controls while in Voice Over
+
+PASS: Name is 'Show Controls'
+PASS: Is hidden
+
+Testing finished.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediacontrolsshowControlsButtonhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/media/controls/showControlsButton.html (189253 => 189254)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/controls/showControlsButton.html        2015-09-02 17:09:00 UTC (rev 189253)
+++ trunk/LayoutTests/media/controls/showControlsButton.html        2015-09-02 17:33:17 UTC (rev 189254)
</span><span class="lines">@@ -2,42 +2,35 @@
</span><span class="cx"> <html>
</span><span class="cx"> <head>
</span><span class="cx"> <script src="../media-file.js"></script>
</span><del>- <script src="../video-test.js"></script>
</del><span class="cx"> <script src="controls-test-helpers.js"></script>
</span><span class="cx"> <script>
</span><del>- var video;
- var currentStatus;
- var showControlsButtonInfo;
</del><ins>+ var tester = new ControlsTest()
+ .whenReady(runTests)
+ .start("Test for Show Controls button");
</ins><span class="cx">
</span><del>- function init()
</del><ins>+ function runTests()
</ins><span class="cx"> {
</span><del>- findMediaElement();
- video.src = findMediaFile("video", "../content/test");
</del><ins>+ currentState = tester.currentState;
+ tester.test("We are using the apple idiom")
+ .value(currentState.idiom)
+ .isEqualTo("apple");
</ins><span class="cx">
</span><del>- waitForEvent("canplaythrough", canplaythrough);
- waitForEventAndFail("error");
- }
</del><ins>+ tester.startNewSection("Get the button that shows controls while in Voice Over");
+ var controlsButtonState = tester.stateForControlsElement("Show Controls");
</ins><span class="cx">
</span><del>- function canplaythrough()
- {
- if (!window.testRunner)
- return;
</del><ins>+ tester.test("Name is 'Show Controls'")
+ .value(controlsButtonState.name)
+ .isEqualTo("Show Controls");
</ins><span class="cx">
</span><del>- currentStatus = JSON.parse(internals.getCurrentMediaControlsStatusForElement(video));
- if (currentStatus) {
- if (currentStatus.idiom == "apple") {
- showControlsButtonInfo = statusForControlsElement(currentStatus, "Show Controls");
- if (showControlsButtonInfo) {
- testExpected("showControlsButtonInfo.name", "Show Controls");
- testExpected("showControlsButtonInfo.hidden", true);
- }
- }
- }
- endTest();
</del><ins>+ tester.test("Is hidden")
+ .value(controlsButtonState.hidden)
+ .isTrue();
+
+ tester.end();
</ins><span class="cx"> }
</span><span class="cx"> </script>
</span><span class="cx"> </head>
</span><del>- <body onload="init()">
</del><ins>+ <body>
</ins><span class="cx"> <p>This tests for the existence of a hidden Show Controls button.</p>
</span><span class="cx"> <p>This test only runs in DRT!</p>
</span><span class="cx"> <video controls></video>
</span></span></pre></div>
<a id="trunkLayoutTestsmediacontrolsstatusDisplayexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/media/controls/statusDisplay-expected.txt (189253 => 189254)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/controls/statusDisplay-expected.txt        2015-09-02 17:09:00 UTC (rev 189253)
+++ trunk/LayoutTests/media/controls/statusDisplay-expected.txt        2015-09-02 17:33:17 UTC (rev 189254)
</span><span class="lines">@@ -3,9 +3,14 @@
</span><span class="cx"> This test only runs in DRT!
</span><span class="cx">
</span><span class="cx">
</span><del>-EVENT(canplaythrough)
-EXPECTED (statusDisplayInfo.name == 'Status Display') OK
-EXPECTED (statusDisplayInfo.className == 'hidden') OK
-EXPECTED (statusDisplayInfo.content == '') OK
-END OF TEST
</del><ins>+EVENT: canplaythrough
+PASS: We are using the apple idiom
</ins><span class="cx">
</span><ins>+Get the status label state
+
+PASS: Name is 'Status Display'
+PASS: Has hidden class
+PASS: Content is Empty
+
+Testing finished.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediacontrolsstatusDisplayhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/media/controls/statusDisplay.html (189253 => 189254)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/controls/statusDisplay.html        2015-09-02 17:09:00 UTC (rev 189253)
+++ trunk/LayoutTests/media/controls/statusDisplay.html        2015-09-02 17:33:17 UTC (rev 189254)
</span><span class="lines">@@ -2,43 +2,40 @@
</span><span class="cx"> <html>
</span><span class="cx"> <head>
</span><span class="cx"> <script src="../media-file.js"></script>
</span><del>- <script src="../video-test.js"></script>
</del><span class="cx"> <script src="controls-test-helpers.js"></script>
</span><span class="cx"> <script>
</span><del>- var video;
- var currentStatus;
- var statusDisplayInfo;
</del><ins>+ var tester = new ControlsTest()
+ .whenReady(runTests)
+ .start();
</ins><span class="cx">
</span><del>- function init()
</del><ins>+ function runTests()
</ins><span class="cx"> {
</span><del>- findMediaElement();
- video.src = findMediaFile("video", "../content/test");
</del><ins>+ currentState = tester.currentState;
+ tester.test("We are using the apple idiom")
+ .value(currentState.idiom)
+ .isEqualTo("apple");
</ins><span class="cx">
</span><del>- waitForEvent("canplaythrough", canplaythrough);
- waitForEventAndFail("error");
- }
</del><ins>+ tester.startNewSection("Get the status label state");
+ var statusDisplayLabelState = tester.stateForControlsElement("Status Display");
</ins><span class="cx">
</span><del>- function canplaythrough()
- {
- if (!window.testRunner)
- return;
</del><ins>+ tester.test("Name is 'Status Display'")
+ .value(statusDisplayLabelState.name)
+ .isEqualTo("Status Display");
</ins><span class="cx">
</span><del>- 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();
</del><ins>+ tester.test("Has hidden class")
+ .value(statusDisplayLabelState.className)
+ .isEqualTo("hidden");
+
+ tester.test("Content is Empty")
+ .value(statusDisplayLabelState.content)
+ .isEmptyString();
+
+ tester.end();
</ins><span class="cx"> }
</span><ins>+
</ins><span class="cx"> </script>
</span><span class="cx"> </head>
</span><del>- <body onload="init()">
</del><ins>+ <body>
</ins><span class="cx"> <p>This tests for the content in the status display.</p>
</span><span class="cx"> <p>This test only runs in DRT!</p>
</span><span class="cx"> <video controls></video>
</span></span></pre></div>
<a id="trunkLayoutTestsmediacontrolsstatusDisplayBadexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/media/controls/statusDisplayBad-expected.txt (189253 => 189254)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/controls/statusDisplayBad-expected.txt        2015-09-02 17:09:00 UTC (rev 189253)
+++ trunk/LayoutTests/media/controls/statusDisplayBad-expected.txt        2015-09-02 17:33:17 UTC (rev 189254)
</span><span class="lines">@@ -3,9 +3,14 @@
</span><span class="cx"> This test only runs in DRT!
</span><span class="cx">
</span><span class="cx">
</span><del>-EVENT(error)
-EXPECTED (statusDisplayInfo.name == 'Status Display') OK
-EXPECTED (statusDisplayInfo.className == '') OK
-EXPECTED (statusDisplayInfo.content == 'Error') OK
-END OF TEST
</del><ins>+EVENT: error
+PASS: We are using the apple idiom
</ins><span class="cx">
</span><ins>+Get the status label state
+
+PASS: Name is 'Status Display'
+PASS: Has empty class
+PASS: Content is 'Error'
+
+Testing finished.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediacontrolsstatusDisplayBadhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/media/controls/statusDisplayBad.html (189253 => 189254)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/controls/statusDisplayBad.html        2015-09-02 17:09:00 UTC (rev 189253)
+++ trunk/LayoutTests/media/controls/statusDisplayBad.html        2015-09-02 17:33:17 UTC (rev 189254)
</span><span class="lines">@@ -2,42 +2,39 @@
</span><span class="cx"> <html>
</span><span class="cx"> <head>
</span><span class="cx"> <script src="../media-file.js"></script>
</span><del>- <script src="../video-test.js"></script>
</del><span class="cx"> <script src="controls-test-helpers.js"></script>
</span><span class="cx"> <script>
</span><del>- var video;
- var currentStatus;
- var statusDisplayInfo;
</del><ins>+ var tester = new ControlsTest("non-existent-media-file", "error")
+ .whenReady(runTests)
+ .start();
</ins><span class="cx">
</span><del>- function init()
</del><ins>+ function runTests()
</ins><span class="cx"> {
</span><del>- findMediaElement();
- video.src = findMediaFile("video", "non-existent-media-file");
</del><ins>+ currentState = tester.currentState;
+ tester.test("We are using the apple idiom")
+ .value(currentState.idiom)
+ .isEqualTo("apple");
</ins><span class="cx">
</span><del>- waitForEvent("error", runTest);
- }
</del><ins>+ tester.startNewSection("Get the status label state");
+ var statusDisplayLabelState = tester.stateForControlsElement("Status Display");
</ins><span class="cx">
</span><del>- function runTest()
- {
- if (!window.testRunner)
- return;
</del><ins>+ tester.test("Name is 'Status Display'")
+ .value(statusDisplayLabelState.name)
+ .isEqualTo("Status Display");
</ins><span class="cx">
</span><del>- 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();
</del><ins>+ tester.test("Has empty class")
+ .value(statusDisplayLabelState.className)
+ .isEmptyString();
+
+ tester.test("Content is 'Error'")
+ .value(statusDisplayLabelState.content)
+ .isEqualTo("Error");
+
+ tester.end();
</ins><span class="cx"> }
</span><span class="cx"> </script>
</span><span class="cx"> </head>
</span><del>- <body onload="init()">
</del><ins>+ <body>
</ins><span class="cx"> <p>This tests that the status display has the corrent error message.</p>
</span><span class="cx"> <p>This test only runs in DRT!</p>
</span><span class="cx"> <video controls></video>
</span></span></pre>
</div>
</div>
</body>
</html>