Title: [195147] trunk/LayoutTests
Revision
195147
Author
[email protected]
Date
2016-01-15 14:21:41 -0800 (Fri, 15 Jan 2016)

Log Message

LayoutTest inspector/script-profiler/event-type-Other.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=153016
<rdar://problem/24192919>

Patch by Joseph Pecoraro <[email protected]> on 2016-01-15
Reviewed by Brian Burg.

Introduce a better way for the inspected page to signal to
the inspector page by dispatching an event with JSON data.
Use it in this test to try to eliminate flakyness.

* http/tests/inspector/resources/inspector-test.js:
(TestPage.dispatchEventToFrontend):
* http/tests/inspector/resources/protocol-test.js:
(TestPage.runTest.window.runTest):
(TestPage.dispatchEventToFrontend):
* inspector/script-profiler/event-type-Other.html:
* inspector/unit-tests/inspector-test-dispatch-event-to-frontend-expected.txt: Added.
* inspector/unit-tests/inspector-test-dispatch-event-to-frontend.html: Added.
* inspector/unit-tests/protocol-test-dispatch-event-to-frontend-expected.txt: Added.
* inspector/unit-tests/protocol-test-dispatch-event-to-frontend.html: Added.
* platform/mac/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (195146 => 195147)


--- trunk/LayoutTests/ChangeLog	2016-01-15 21:49:33 UTC (rev 195146)
+++ trunk/LayoutTests/ChangeLog	2016-01-15 22:21:41 UTC (rev 195147)
@@ -1,3 +1,27 @@
+2016-01-15  Joseph Pecoraro  <[email protected]>
+
+        LayoutTest inspector/script-profiler/event-type-Other.html is flaky
+        https://bugs.webkit.org/show_bug.cgi?id=153016
+        <rdar://problem/24192919>
+
+        Reviewed by Brian Burg.
+
+        Introduce a better way for the inspected page to signal to
+        the inspector page by dispatching an event with JSON data.
+        Use it in this test to try to eliminate flakyness.
+
+        * http/tests/inspector/resources/inspector-test.js:
+        (TestPage.dispatchEventToFrontend):
+        * http/tests/inspector/resources/protocol-test.js:
+        (TestPage.runTest.window.runTest):
+        (TestPage.dispatchEventToFrontend):
+        * inspector/script-profiler/event-type-Other.html:
+        * inspector/unit-tests/inspector-test-dispatch-event-to-frontend-expected.txt: Added.
+        * inspector/unit-tests/inspector-test-dispatch-event-to-frontend.html: Added.
+        * inspector/unit-tests/protocol-test-dispatch-event-to-frontend-expected.txt: Added.
+        * inspector/unit-tests/protocol-test-dispatch-event-to-frontend.html: Added.
+        * platform/mac/TestExpectations:
+
 2016-01-15  Zalan Bujtas  <[email protected]>
 
         ASSERTION FAILED: canHaveChildren() || canHaveGeneratedChildren() in WebCore::RenderElement::insertChildInternal

Modified: trunk/LayoutTests/http/tests/inspector/resources/inspector-test.js (195146 => 195147)


--- trunk/LayoutTests/http/tests/inspector/resources/inspector-test.js	2016-01-15 21:49:33 UTC (rev 195146)
+++ trunk/LayoutTests/http/tests/inspector/resources/inspector-test.js	2016-01-15 22:21:41 UTC (rev 195147)
@@ -139,6 +139,12 @@
     this._resultElement.append(text, document.createElement("br"));
 }
 
+TestPage.dispatchEventToFrontend = function(eventName, data)
+{
+    let dispatchEventCodeString = `InspectorTest.dispatchEventToListeners(${JSON.stringify(eventName)}, ${JSON.stringify(data)});`;
+    testRunner.evaluateInWebInspector(dispatchEventCodeString);
+};
+
 TestPage.allowUncaughtExceptions = false;
 TestPage.needToSanitizeUncaughtExceptionURLs = false;
 

Modified: trunk/LayoutTests/http/tests/inspector/resources/protocol-test.js (195146 => 195147)


--- trunk/LayoutTests/http/tests/inspector/resources/protocol-test.js	2016-01-15 21:49:33 UTC (rev 195146)
+++ trunk/LayoutTests/http/tests/inspector/resources/protocol-test.js	2016-01-15 22:21:41 UTC (rev 195147)
@@ -117,12 +117,18 @@
         }
     }
 
-    let inspectorFrontend = window.internals.openDummyInspectorFrontend(url);
-    inspectorFrontend.addEventListener("load", (event) => {
+    TestPage.inspectorFrontend = window.internals.openDummyInspectorFrontend(url);
+    TestPage.inspectorFrontend.addEventListener("load", (event) => {
         let initializationCodeString = `(${runInitializationMethodsInFrontend.toString()})([${TestPage._initializers}]);`;
         let testFunctionCodeString = `(${runTestMethodInFrontend.toString()})(${testFunction.toString()});`;
 
-        inspectorFrontend.postMessage(initializationCodeString, "*");
-        inspectorFrontend.postMessage(testFunctionCodeString, "*");
+        TestPage.inspectorFrontend.postMessage(initializationCodeString, "*");
+        TestPage.inspectorFrontend.postMessage(testFunctionCodeString, "*");
     });
 };
+
+TestPage.dispatchEventToFrontend = function(eventName, data)
+{
+    let dispatchEventCodeString = `ProtocolTest.dispatchEventToListeners(${JSON.stringify(eventName)}, ${JSON.stringify(data)});`;
+    TestPage.inspectorFrontend.postMessage(dispatchEventCodeString, "*");
+};

Modified: trunk/LayoutTests/inspector/script-profiler/event-type-Other.html (195146 => 195147)


--- trunk/LayoutTests/inspector/script-profiler/event-type-Other.html	2016-01-15 21:49:33 UTC (rev 195146)
+++ trunk/LayoutTests/inspector/script-profiler/event-type-Other.html	2016-01-15 22:21:41 UTC (rev 195147)
@@ -18,6 +18,7 @@
 function triggerTimerEvaluation() {
     setTimeout(() => {
         console.log("timer fired");
+        TestPage.dispatchEventToFrontend("TestPageTimerEvaluated");
     }, 0);
 }
 
@@ -49,7 +50,9 @@
             ProtocolTest.evaluateInPage("triggerScriptEvaluation()");
             ProtocolTest.evaluateInPage("triggerEventDispatchEvaluation()");
             ProtocolTest.evaluateInPage("triggerTimerEvaluation()");
-            setTimeout(() => { InspectorProtocol.sendCommand("ScriptProfiler.stopTracking", {}); }, 50);
+            ProtocolTest.singleFireEventListener("TestPageTimerEvaluated", (event) => {
+                InspectorProtocol.sendCommand("ScriptProfiler.stopTracking", {});
+            });
         }
     });
 

Added: trunk/LayoutTests/inspector/unit-tests/inspector-test-dispatch-event-to-frontend-expected.txt (0 => 195147)


--- trunk/LayoutTests/inspector/unit-tests/inspector-test-dispatch-event-to-frontend-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/unit-tests/inspector-test-dispatch-event-to-frontend-expected.txt	2016-01-15 22:21:41 UTC (rev 195147)
@@ -0,0 +1,7 @@
+
+== Running test suite: InspectorTest.TestPage.dispatchEventToFrontend
+-- Running test case: InspectorTest.TestPage.dispatchEventToFrontend
+PASS: Received Event
+PASS: Event name should be the event dispatched.
+PASS: Event data should be included.
+

Added: trunk/LayoutTests/inspector/unit-tests/inspector-test-dispatch-event-to-frontend.html (0 => 195147)


--- trunk/LayoutTests/inspector/unit-tests/inspector-test-dispatch-event-to-frontend.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/unit-tests/inspector-test-dispatch-event-to-frontend.html	2016-01-15 22:21:41 UTC (rev 195147)
@@ -0,0 +1,30 @@
+<!doctype html>
+<html>
+<head>
+<script src=""
+<script>
+function test()
+{
+    let suite = InspectorTest.createAsyncSuite("InspectorTest.TestPage.dispatchEventToFrontend");
+
+    suite.addTestCase({
+        name: "InspectorTest.TestPage.dispatchEventToFrontend",
+        description: "Ensure TestPage.dispatchEventToFrontend works with an InspectorTest.",
+        test: (resolve, reject) => {
+            InspectorTest.evaluateInPage("TestPage.dispatchEventToFrontend('MyEvent', {count: 1})");
+            InspectorTest.singleFireEventListener("MyEvent", (event) => {
+                InspectorTest.pass("Received Event");
+                InspectorTest.expectThat(event.type === "MyEvent", "Event name should be the event dispatched.");
+                InspectorTest.expectThat(event.data.count === 1, "Event data should be included.");
+                resolve();
+            });
+        },
+    });
+
+    suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body _onLoad_="runTest()">
+</body>
+</html>

Added: trunk/LayoutTests/inspector/unit-tests/protocol-test-dispatch-event-to-frontend-expected.txt (0 => 195147)


--- trunk/LayoutTests/inspector/unit-tests/protocol-test-dispatch-event-to-frontend-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/unit-tests/protocol-test-dispatch-event-to-frontend-expected.txt	2016-01-15 22:21:41 UTC (rev 195147)
@@ -0,0 +1,7 @@
+
+== Running test suite: ProtocolTest.TestPage.dispatchEventToFrontend
+-- Running test case: ProtocolTest.TestPage.dispatchEventToFrontend
+PASS: Received Event
+PASS: Event name should be the event dispatched.
+PASS: Event data should be included.
+

Added: trunk/LayoutTests/inspector/unit-tests/protocol-test-dispatch-event-to-frontend.html (0 => 195147)


--- trunk/LayoutTests/inspector/unit-tests/protocol-test-dispatch-event-to-frontend.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/unit-tests/protocol-test-dispatch-event-to-frontend.html	2016-01-15 22:21:41 UTC (rev 195147)
@@ -0,0 +1,30 @@
+<!doctype html>
+<html>
+<head>
+<script src=""
+<script>
+function test()
+{
+    let suite = ProtocolTest.createAsyncSuite("ProtocolTest.TestPage.dispatchEventToFrontend");
+
+    suite.addTestCase({
+        name: "ProtocolTest.TestPage.dispatchEventToFrontend",
+        description: "Ensure TestPage.dispatchEventToFrontend works with a ProtocolTest.",
+        test: (resolve, reject) => {
+            ProtocolTest.evaluateInPage("TestPage.dispatchEventToFrontend('MyEvent', {count: 1})");
+            ProtocolTest.singleFireEventListener("MyEvent", (event) => {
+                ProtocolTest.pass("Received Event");
+                ProtocolTest.expectThat(event.type === "MyEvent", "Event name should be the event dispatched.");
+                ProtocolTest.expectThat(event.data.count === 1, "Event data should be included.");
+                resolve();
+            });
+        },
+    });
+
+    suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body _onLoad_="runTest()">
+</body>
+</html>

Modified: trunk/LayoutTests/platform/mac/TestExpectations (195146 => 195147)


--- trunk/LayoutTests/platform/mac/TestExpectations	2016-01-15 21:49:33 UTC (rev 195146)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2016-01-15 22:21:41 UTC (rev 195147)
@@ -1241,8 +1241,6 @@
 
 webkit.org/b/152029 inspector/debugger/command-line-api-exception.html [ Pass Timeout ]
 
-webkit.org/b/153016 inspector/script-profiler/event-type-Other.html [ Pass Failure ]
-
 webkit.org/b/153108 [ Debug ] inspector/model/scope-chain-node.html [ Pass Timeout ]
 
 # Colorspaces on CA OpenGL layers not available in Yosemite
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to