Web Inspector: adopt Object.awaitEvent in LayoutTests/inspector/storage
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Sep 2016 20:45:52 +0000 (20:45 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Sep 2016 20:45:52 +0000 (20:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=162102

Patch by Devin Rousso <dcrousso+webkit@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/storage/domStorage-events.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206113 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/inspector/storage/domStorage-events.html

index f12d594..d1e96a2 100644 (file)
@@ -1,5 +1,17 @@
 2016-09-19  Devin Rousso  <dcrousso+webkit@gmail.com>
 
+        Web Inspector: adopt Object.awaitEvent in LayoutTests/inspector/storage
+        https://bugs.webkit.org/show_bug.cgi?id=162102
+
+        Reviewed by Brian Burg.
+
+        Replace instances of singleFireEventListener with awaitEvent and use promise logic to make
+        tests more readable.
+
+        * inspector/storage/domStorage-events.html:
+
+2016-09-19  Devin Rousso  <dcrousso+webkit@gmail.com>
+
         Web Inspector: adopt Object.awaitEvent in LayoutTests/inspector/network
         https://bugs.webkit.org/show_bug.cgi?id=162099
 
index 8e652c8..97166b3 100644 (file)
@@ -40,19 +40,22 @@ function test()
             InspectorTest.fail("Unexpected WebInspector.DOMStorageObject.Event.ItemAdded");
         });
 
-        storageObject.singleFireEventListener(WebInspector.DOMStorageObject.Event.ItemRemoved, (event) => {
+        storageObject.awaitEvent(WebInspector.DOMStorageObject.Event.ItemRemoved)
+        .then((event) => {
             InspectorTest.pass("WebInspector.DOMStorageObject.Event.ItemRemoved");
             InspectorTest.expectThat(event.data.key === "foo", "Should remove key 'x'.");
         });
 
-        storageObject.singleFireEventListener(WebInspector.DOMStorageObject.Event.ItemUpdated, (event) => {
+        storageObject.awaitEvent(WebInspector.DOMStorageObject.Event.ItemUpdated)
+        .then((event) => {
             InspectorTest.pass("WebInspector.DOMStorageObject.Event.ItemUpdated");
             InspectorTest.expectThat(event.data.key === "foo", "Should update key 'x'.");
             InspectorTest.expectThat(event.data.oldValue === "value1", "Should have oldValue 'value1'.");
             InspectorTest.expectThat(event.data.value === "value2", "Should have new value 'value2'.");
         });
 
-        storageObject.singleFireEventListener(WebInspector.DOMStorageObject.Event.ItemsCleared, (event) => {
+        storageObject.awaitEvent(WebInspector.DOMStorageObject.Event.ItemsCleared)
+        .then((event) => {
             InspectorTest.pass("WebInspector.DOMStorageObject.Event.ItemsCleared");
             storageObject.removeEventListener(WebInspector.DOMStorageObject.Event.ItemAdded, null, null);
             callback();
@@ -64,7 +67,7 @@ function test()
     suite.addTestCase({
         name: "TestSessionStorage",
         description: "Test backend generated DOMStorage added, removed, updated, and cleared events for sessionStorage.",
-        test: (resolve, reject) => {
+        test(resolve, reject) {
             InspectorTest.evaluateInPage("triggerActions(sessionStorage)");
             let sessionStorage = WebInspector.storageManager.domStorageObjects.find((x) => !x.isLocalStorage());
             InspectorTest.expectThat(sessionStorage, "Should have a DOMStorageObject for sessionStorage.");
@@ -75,7 +78,7 @@ function test()
     suite.addTestCase({
         name: "TestLocalStorage",
         description: "Test backend generated DOMStorage added, removed, updated, and cleared events for localStorage.",
-        test: (resolve, reject) => {
+        test(resolve, reject) {
             InspectorTest.evaluateInPage("triggerActions(localStorage)");
             let localStorage = WebInspector.storageManager.domStorageObjects.find((x) => x.isLocalStorage());
             InspectorTest.expectThat(localStorage, "Should have a DOMStorageObject for localStorage.");