Changeset 206117 in webkit


Ignore:
Timestamp:
Sep 19, 2016 2:07:31 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Devin Rousso <Devin Rousso> 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:
Location:
trunk/LayoutTests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r206116 r206117  
     12016-09-19  Devin Rousso  <dcrousso+webkit@gmail.com>
     2
     3        Web Inspector: adopt Object.awaitEvent in LayoutTests/inspector/unit-tests
     4        https://bugs.webkit.org/show_bug.cgi?id=162103
     5
     6        Reviewed by Brian Burg.
     7
     8        Replace instances of singleFireEventListener with awaitEvent and use promise logic to make
     9        tests more readable.
     10
     11        * inspector/unit-tests/inspector-test-dispatch-event-to-frontend.html:
     12        * inspector/unit-tests/protocol-test-dispatch-event-to-frontend.html:
     13
    1142016-09-19  Devin Rousso  <dcrousso+webkit@gmail.com>
    215
  • trunk/LayoutTests/inspector/unit-tests/inspector-test-dispatch-event-to-frontend.html

    r195147 r206117  
    1111        name: "InspectorTest.TestPage.dispatchEventToFrontend",
    1212        description: "Ensure TestPage.dispatchEventToFrontend works with an InspectorTest.",
    13         test: (resolve, reject) => {
    14             InspectorTest.evaluateInPage("TestPage.dispatchEventToFrontend('MyEvent', {count: 1})");
    15             InspectorTest.singleFireEventListener("MyEvent", (event) => {
     13        test(resolve, reject) {
     14            InspectorTest.awaitEvent("MyEvent")
     15            .then((event) => {
    1616                InspectorTest.pass("Received Event");
    1717                InspectorTest.expectThat(event.type === "MyEvent", "Event name should be the event dispatched.");
    1818                InspectorTest.expectThat(event.data.count === 1, "Event data should be included.");
    19                 resolve();
    20             });
     19            })
     20            .then(resolve, reject);
     21
     22            InspectorTest.evaluateInPage("TestPage.dispatchEventToFrontend('MyEvent', {count: 1})");
    2123        },
    2224    });
  • trunk/LayoutTests/inspector/unit-tests/protocol-test-dispatch-event-to-frontend.html

    r195147 r206117  
    1111        name: "ProtocolTest.TestPage.dispatchEventToFrontend",
    1212        description: "Ensure TestPage.dispatchEventToFrontend works with a ProtocolTest.",
    13         test: (resolve, reject) => {
    14             ProtocolTest.evaluateInPage("TestPage.dispatchEventToFrontend('MyEvent', {count: 1})");
    15             ProtocolTest.singleFireEventListener("MyEvent", (event) => {
     13        test(resolve, reject) {
     14            ProtocolTest.awaitEvent("MyEvent")
     15            .then((event) => {
    1616                ProtocolTest.pass("Received Event");
    1717                ProtocolTest.expectThat(event.type === "MyEvent", "Event name should be the event dispatched.");
    1818                ProtocolTest.expectThat(event.data.count === 1, "Event data should be included.");
    19                 resolve();
    20             });
     19            })
     20            .then(resolve, reject);
     21
     22            ProtocolTest.evaluateInPage("TestPage.dispatchEventToFrontend('MyEvent', {count: 1})");
    2123        },
    2224    });
Note: See TracChangeset for help on using the changeset viewer.