Title: [189358] trunk
Revision
189358
Author
[email protected]
Date
2015-09-04 11:12:16 -0700 (Fri, 04 Sep 2015)

Log Message

[mediacontrols] Expose bounding rectangles and computed style to testing
https://bugs.webkit.org/show_bug.cgi?id=148755
<rdar://problems/22567757>

Reviewed by Eric Carlson.

Source/WebCore:

Expose more information on the internal objects to the testing
framework, in particular the bounding client rectangle for an
element as well as its computed style.

These new features are tested by media/controls/statusDisplay*.

* Modules/mediacontrols/mediaControlsApple.js:
(Controller.prototype.getCurrentControlsStatus): Rearrage things so
that it iterates over a list of objects, adding the common things
as well as any extra property values.

LayoutTests:

Update tests to exercise the computed style and bounding rectangles.

* media/controls/controls-test-helpers.js:
(ControlsTest.prototype.isNotZero):
(ControlsTest):
* media/controls/statusDisplay-expected.txt:
* media/controls/statusDisplay.html:
* media/controls/statusDisplayBad-expected.txt:
* media/controls/statusDisplayBad.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (189357 => 189358)


--- trunk/LayoutTests/ChangeLog	2015-09-04 18:00:24 UTC (rev 189357)
+++ trunk/LayoutTests/ChangeLog	2015-09-04 18:12:16 UTC (rev 189358)
@@ -1,3 +1,21 @@
+2015-09-03  Dean Jackson  <[email protected]>
+
+        [mediacontrols] Expose bounding rectangles and computed style to testing
+        https://bugs.webkit.org/show_bug.cgi?id=148755
+        <rdar://problems/22567757>
+
+        Reviewed by Eric Carlson.
+
+        Update tests to exercise the computed style and bounding rectangles.
+
+        * media/controls/controls-test-helpers.js:
+        (ControlsTest.prototype.isNotZero):
+        (ControlsTest):
+        * media/controls/statusDisplay-expected.txt:
+        * media/controls/statusDisplay.html:
+        * media/controls/statusDisplayBad-expected.txt:
+        * media/controls/statusDisplayBad.html:
+
 2015-09-04  Alexey Proskuryakov  <[email protected]>
 
         Add tests for different Unicode normalization forms in domain names

Modified: trunk/LayoutTests/media/controls/controls-test-helpers.js (189357 => 189358)


--- trunk/LayoutTests/media/controls/controls-test-helpers.js	2015-09-04 18:00:24 UTC (rev 189357)
+++ trunk/LayoutTests/media/controls/controls-test-helpers.js	2015-09-04 18:12:16 UTC (rev 189358)
@@ -167,4 +167,12 @@
             this.logFailure(`${this.currentMessage} Expected a false value. Actual: "${this.currentValue}"`);
     }
 
+    isNotZero()
+    {
+        if (this.currentValue)
+            this.logSuccess(this.currentMessage);
+        else
+            this.logFailure(`${this.currentMessage} Expected a non-zero value`);
+    }
+
 }

Modified: trunk/LayoutTests/media/controls/statusDisplay-expected.txt (189357 => 189358)


--- trunk/LayoutTests/media/controls/statusDisplay-expected.txt	2015-09-04 18:00:24 UTC (rev 189357)
+++ trunk/LayoutTests/media/controls/statusDisplay-expected.txt	2015-09-04 18:12:16 UTC (rev 189358)
@@ -11,6 +11,7 @@
 PASS: Name is 'Status Display'
 PASS: Has hidden class
 PASS: Content is Empty
+PASS: CSS display: none
 
 Testing finished.
 

Modified: trunk/LayoutTests/media/controls/statusDisplay.html (189357 => 189358)


--- trunk/LayoutTests/media/controls/statusDisplay.html	2015-09-04 18:00:24 UTC (rev 189357)
+++ trunk/LayoutTests/media/controls/statusDisplay.html	2015-09-04 18:12:16 UTC (rev 189358)
@@ -27,9 +27,13 @@
                     .isEqualTo("hidden");
 
                 tester.test("Content is Empty")
-                    .value(statusDisplayLabelState.content)
+                    .value(statusDisplayLabelState.textContent)
                     .isEmptyString();
 
+                tester.test("CSS display: none")
+                    .value(statusDisplayLabelState.computedStyle.display)
+                    .isEqualTo("none");
+
                 tester.end();
             }
 

Modified: trunk/LayoutTests/media/controls/statusDisplayBad-expected.txt (189357 => 189358)


--- trunk/LayoutTests/media/controls/statusDisplayBad-expected.txt	2015-09-04 18:00:24 UTC (rev 189357)
+++ trunk/LayoutTests/media/controls/statusDisplayBad-expected.txt	2015-09-04 18:12:16 UTC (rev 189358)
@@ -11,6 +11,8 @@
 PASS: Name is 'Status Display'
 PASS: Has empty class
 PASS: Content is 'Error'
+PASS: CSS display: block
+PASS: Displayed bounds is non-zero
 
 Testing finished.
 

Modified: trunk/LayoutTests/media/controls/statusDisplayBad.html (189357 => 189358)


--- trunk/LayoutTests/media/controls/statusDisplayBad.html	2015-09-04 18:00:24 UTC (rev 189357)
+++ trunk/LayoutTests/media/controls/statusDisplayBad.html	2015-09-04 18:12:16 UTC (rev 189358)
@@ -27,9 +27,17 @@
                     .isEmptyString();
 
                 tester.test("Content is 'Error'")
-                    .value(statusDisplayLabelState.content)
+                    .value(statusDisplayLabelState.textContent)
                     .isEqualTo("Error");
 
+                tester.test("CSS display: block")
+                    .value(statusDisplayLabelState.computedStyle.display)
+                    .isEqualTo("block");
+
+                tester.test("Displayed bounds is non-zero")
+                    .value(statusDisplayLabelState.bounds.width)
+                    .isNotZero();
+
                 tester.end();
             }
         </script>

Modified: trunk/Source/WebCore/ChangeLog (189357 => 189358)


--- trunk/Source/WebCore/ChangeLog	2015-09-04 18:00:24 UTC (rev 189357)
+++ trunk/Source/WebCore/ChangeLog	2015-09-04 18:12:16 UTC (rev 189358)
@@ -1,3 +1,22 @@
+2015-09-03  Dean Jackson  <[email protected]>
+
+        [mediacontrols] Expose bounding rectangles and computed style to testing
+        https://bugs.webkit.org/show_bug.cgi?id=148755
+        <rdar://problems/22567757>
+
+        Reviewed by Eric Carlson.
+
+        Expose more information on the internal objects to the testing
+        framework, in particular the bounding client rectangle for an
+        element as well as its computed style.
+
+        These new features are tested by media/controls/statusDisplay*.
+
+        * Modules/mediacontrols/mediaControlsApple.js:
+        (Controller.prototype.getCurrentControlsStatus): Rearrage things so
+        that it iterates over a list of objects, adding the common things
+        as well as any extra property values.
+
 2015-09-04  Chris Dumez  <[email protected]>
 
         Document.body should return the first body / frameset child of the html element

Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js (189357 => 189358)


--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js	2015-09-04 18:00:24 UTC (rev 189357)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js	2015-09-04 18:12:16 UTC (rev 189358)
@@ -2096,22 +2096,50 @@
 
     getCurrentControlsStatus: function ()
     {
-        return JSON.stringify({
+        var result = {
             idiom: this.idiom,
-            status: "ok",
-            elements: [
-                {
-                    name: "Show Controls",
-                    className: this.showControlsButton.className,
-                    hidden: this.showControlsButton.hidden
-                },
-                {
-                    name: "Status Display",
-                    className: this.controls.statusDisplay.className,
-                    content: this.controls.statusDisplay.textContent
-                }
-            ]
+            status: "ok"
+        };
+
+        var elements = [
+            {
+                name: "Show Controls",
+                object: this.showControlsButton,
+                extraProperties: ["hidden"]
+            },
+            {
+                name: "Status Display",
+                object: this.controls.statusDisplay,
+                styleValues: ["display"],
+                extraProperties: ["textContent"]
+            }
+        ];
+
+        elements.forEach(function (element) {
+            var obj = element.object;
+            delete element.object;
+
+            element.computedStyle = {};
+            if (element.styleValues) {
+                var computedStyle = window.getComputedStyle(obj);
+                element.styleValues.forEach(function (propertyName) {
+                    element.computedStyle[propertyName] = computedStyle[propertyName];
+                });
+            }
+            delete element.styleValues;
+
+            element.bounds = obj.getBoundingClientRect();
+            element.className = obj.className;
+
+            element.extraProperties.forEach(function (property) {
+                element[property] = obj[property];
+            });
+            delete element.extraProperties;
         });
+
+        result.elements = elements;
+
+        return JSON.stringify(result);
     }
 
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to