Title: [206117] trunk/LayoutTests
Revision
206117
Author
commit-qu...@webkit.org
Date
2016-09-19 14:07:31 -0700 (Mon, 19 Sep 2016)

Log Message

Web Inspector: adopt Object.awaitEvent in LayoutTests/inspector/unit-tests
https://bugs.webkit.org/show_bug.cgi?id=162103

Patch by Devin Rousso <dcrousso+web...@gmail.com> on 2016-09-19
Reviewed by Brian Burg.

Replace instances of singleFireEventListener with awaitEvent and use promise logic to make
tests more readable.

* inspector/unit-tests/inspector-test-dispatch-event-to-frontend.html:
* inspector/unit-tests/protocol-test-dispatch-event-to-frontend.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (206116 => 206117)


--- trunk/LayoutTests/ChangeLog	2016-09-19 20:49:32 UTC (rev 206116)
+++ trunk/LayoutTests/ChangeLog	2016-09-19 21:07:31 UTC (rev 206117)
@@ -1,5 +1,18 @@
 2016-09-19  Devin Rousso  <dcrousso+web...@gmail.com>
 
+        Web Inspector: adopt Object.awaitEvent in LayoutTests/inspector/unit-tests
+        https://bugs.webkit.org/show_bug.cgi?id=162103
+
+        Reviewed by Brian Burg.
+
+        Replace instances of singleFireEventListener with awaitEvent and use promise logic to make
+        tests more readable.
+
+        * inspector/unit-tests/inspector-test-dispatch-event-to-frontend.html:
+        * inspector/unit-tests/protocol-test-dispatch-event-to-frontend.html:
+
+2016-09-19  Devin Rousso  <dcrousso+web...@gmail.com>
+
         Web Inspector: adopt Object.awaitEvent in LayoutTests/inspector/console
         https://bugs.webkit.org/show_bug.cgi?id=162070
 

Modified: trunk/LayoutTests/inspector/unit-tests/inspector-test-dispatch-event-to-frontend.html (206116 => 206117)


--- trunk/LayoutTests/inspector/unit-tests/inspector-test-dispatch-event-to-frontend.html	2016-09-19 20:49:32 UTC (rev 206116)
+++ trunk/LayoutTests/inspector/unit-tests/inspector-test-dispatch-event-to-frontend.html	2016-09-19 21:07:31 UTC (rev 206117)
@@ -10,14 +10,16 @@
     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) => {
+        test(resolve, reject) {
+            InspectorTest.awaitEvent("MyEvent")
+            .then((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();
-            });
+            })
+            .then(resolve, reject);
+
+            InspectorTest.evaluateInPage("TestPage.dispatchEventToFrontend('MyEvent', {count: 1})");
         },
     });
 

Modified: trunk/LayoutTests/inspector/unit-tests/protocol-test-dispatch-event-to-frontend.html (206116 => 206117)


--- trunk/LayoutTests/inspector/unit-tests/protocol-test-dispatch-event-to-frontend.html	2016-09-19 20:49:32 UTC (rev 206116)
+++ trunk/LayoutTests/inspector/unit-tests/protocol-test-dispatch-event-to-frontend.html	2016-09-19 21:07:31 UTC (rev 206117)
@@ -10,14 +10,16 @@
     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) => {
+        test(resolve, reject) {
+            ProtocolTest.awaitEvent("MyEvent")
+            .then((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();
-            });
+            })
+            .then(resolve, reject);
+
+            ProtocolTest.evaluateInPage("TestPage.dispatchEventToFrontend('MyEvent', {count: 1})");
         },
     });
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to