Title: [158062] trunk/LayoutTests
Revision
158062
Author
[email protected]
Date
2013-10-25 15:24:49 -0700 (Fri, 25 Oct 2013)

Log Message

Web Inspector: CSS Regions: Add layout tests for the new events in the DOMTreeManager
https://bugs.webkit.org/show_bug.cgi?id=123361

Reviewed by Timothy Hatcher.

Created a test to check that WebInspector.DOMTree.Event.ContentFlowWasAdded and
WebInspector.DOMTree.Event.ContentFlowWasRemoved are dispatched when a flow is added
and removed.

* http/tests/inspector-protocol/resources/InspectorTest.js:
(InspectorTest.assert): Similar to InspectorTest.log, but also takes a boolean and prefixes the message
with "FAIL" or "PASS" depending on the value.
(InspectorTest.importInspectorScripts): Added the required CSS Agent scripts to enable the flow thread events.
* inspector-protocol/model/content-flow-list-expected.txt: Added.
* inspector-protocol/model/content-flow-list.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (158061 => 158062)


--- trunk/LayoutTests/ChangeLog	2013-10-25 22:23:20 UTC (rev 158061)
+++ trunk/LayoutTests/ChangeLog	2013-10-25 22:24:49 UTC (rev 158062)
@@ -1,3 +1,21 @@
+2013-10-25  Alexandru Chiculita  <[email protected]>
+
+        Web Inspector: CSS Regions: Add layout tests for the new events in the DOMTreeManager
+        https://bugs.webkit.org/show_bug.cgi?id=123361
+
+        Reviewed by Timothy Hatcher.
+
+        Created a test to check that WebInspector.DOMTree.Event.ContentFlowWasAdded and
+        WebInspector.DOMTree.Event.ContentFlowWasRemoved are dispatched when a flow is added
+        and removed.
+
+        * http/tests/inspector-protocol/resources/InspectorTest.js:
+        (InspectorTest.assert): Similar to InspectorTest.log, but also takes a boolean and prefixes the message 
+        with "FAIL" or "PASS" depending on the value.
+        (InspectorTest.importInspectorScripts): Added the required CSS Agent scripts to enable the flow thread events.
+        * inspector-protocol/model/content-flow-list-expected.txt: Added.
+        * inspector-protocol/model/content-flow-list.html: Added.
+
 2013-10-25  Oliver Hunt  <[email protected]>
 
         Fix a number of problems with destructuring of arguments

Modified: trunk/LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js (158061 => 158062)


--- trunk/LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js	2013-10-25 22:23:20 UTC (rev 158061)
+++ trunk/LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js	2013-10-25 22:24:49 UTC (rev 158062)
@@ -75,6 +75,17 @@
 }
 
 /**
+* Logs an assert message to document.
+* @param {boolean} condition
+* @param {string} message
+*/
+InspectorTest.assert = function(condition, message)
+{
+    var status = condition ? "PASS" : "FAIL";
+    this.sendCommand("Runtime.evaluate", { "_expression_": "log(" + JSON.stringify(status + ": " + message) + ")" } );
+}
+
+/**
 * Logs message directly to process stdout via alert function (hopefully followed by flush call).
 * This message should survive process crash or kill by timeout.
 * @param {string} message
@@ -130,6 +141,7 @@
         "Setting",
         "PageObserver",
         "DOMObserver",
+        "CSSObserver",
         "FrameResourceManager",
         "RuntimeManager",
         "Frame",
@@ -143,7 +155,9 @@
         "ContentFlow",
         "DOMTree",
         "ExecutionContext",
-        "ExecutionContextList"
+        "ExecutionContextList",
+        "CSSStyleManager",
+        "Color"
     ];
     for (var i = 0; i < inspectorScripts.length; ++i)
         InspectorTest.importScript("../../../../../Source/WebInspectorUI/UserInterface/" + inspectorScripts[i] + ".js");
@@ -154,9 +168,11 @@
 
     InspectorBackend.registerPageDispatcher(new WebInspector.PageObserver);
     InspectorBackend.registerDOMDispatcher(new WebInspector.DOMObserver);
+    InspectorBackend.registerCSSDispatcher(new WebInspector.CSSObserver);
 
     WebInspector.frameResourceManager = new WebInspector.FrameResourceManager;
     WebInspector.domTreeManager = new WebInspector.DOMTreeManager;
+    WebInspector.cssStyleManager = new WebInspector.CSSStyleManager;
 
     InspectorFrontendHost.loaded();
 }

Added: trunk/LayoutTests/inspector-protocol/model/content-flow-list-expected.txt (0 => 158062)


--- trunk/LayoutTests/inspector-protocol/model/content-flow-list-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector-protocol/model/content-flow-list-expected.txt	2013-10-25 22:24:49 UTC (rev 158062)
@@ -0,0 +1,7 @@
+Testing that the ContentFlows events are correctly dispatched when new flows are created/removed.
+
+PASS: ContentFlow was added
+PASS: Flow count is 1
+PASS: ContentFlow was removed
+PASS: Flow count is 0
+

Added: trunk/LayoutTests/inspector-protocol/model/content-flow-list.html (0 => 158062)


--- trunk/LayoutTests/inspector-protocol/model/content-flow-list.html	                        (rev 0)
+++ trunk/LayoutTests/inspector-protocol/model/content-flow-list.html	2013-10-25 22:24:49 UTC (rev 158062)
@@ -0,0 +1,56 @@
+<!doctype html>
+<html>
+<head>
+<style>
+#flow1
+{
+    -webkit-flow-into: flow1;
+}
+</style>
+<script type="text/_javascript_" src=""
+<script>
+function removeFlow()
+{
+    document.getElementById("flow1").remove();
+}
+
+function test()
+{
+    InspectorTest.importInspectorScripts();
+
+    WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.MainFrameDidChange, function(event) {
+        var domTree = WebInspector.frameResourceManager.mainFrame.domTree;
+        domTree.addEventListener(WebInspector.DOMTree.Event.RootDOMNodeInvalidated, onRootDOMNodeInvalidated, null);
+        domTree.addEventListener(WebInspector.DOMTree.Event.ContentFlowWasAdded, onContentFlowWasAdded, null);
+        domTree.addEventListener(WebInspector.DOMTree.Event.ContentFlowWasRemoved, onContentFlowWasRemoved, null);
+        domTree.requestContentFlowList();
+    });
+
+    function onRootDOMNodeInvalidated()
+    {
+        WebInspector.frameResourceManager.mainFrame.domTree.requestContentFlowList();
+    }
+
+    function onContentFlowWasAdded(event)
+    {
+        InspectorTest.assert(event.data.flow.name === "flow1", "ContentFlow was added");
+        InspectorTest.assert(WebInspector.frameResourceManager.mainFrame.domTree.flowsCount === 1, "Flow count is 1");
+        
+        InspectorTest.sendCommand("Runtime.evaluate", {_expression_: "removeFlow()"});
+    }
+    
+    function onContentFlowWasRemoved(event)
+    {
+        InspectorTest.assert(event.data.flow.name === "flow1", "ContentFlow was removed");
+        InspectorTest.assert(WebInspector.frameResourceManager.mainFrame.domTree.flowsCount === 0, "Flow count is 0");
+        InspectorTest.completeTest();
+    }
+}
+</script>
+</head>
+<body _onload_="runTest()">
+    <p>Testing that the ContentFlows events are correctly dispatched when new flows are created/removed.</p>
+    
+    <div id="flow1"></div>
+</body>
+</html>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to