Title: [226153] trunk
Revision
226153
Author
[email protected]
Date
2017-12-19 15:53:02 -0800 (Tue, 19 Dec 2017)

Log Message

Web Inspector: InspectorTest.expectException does not handle implicitly resolved async functions correctly
https://bugs.webkit.org/show_bug.cgi?id=180944

Reviewed by Joseph Pecoraro.

Source/WebInspectorUI:

* UserInterface/Test/TestHarness.js:
(TestHarness.prototype.expectException):
Don't chain .catch after we might have just returned a rejected promise.

LayoutTests:

Add a new test case for implicitly resolved async functions passed to expectException.
Rebaseline one existing test that had a failing assertion that progresses with
this change. I didn't notice it because the assertion just prior is expected to fail.

* inspector/unit-tests/test-harness-expect-functions-async-expected.txt:
* inspector/unit-tests/test-harness-expect-functions-async.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (226152 => 226153)


--- trunk/LayoutTests/ChangeLog	2017-12-19 23:50:04 UTC (rev 226152)
+++ trunk/LayoutTests/ChangeLog	2017-12-19 23:53:02 UTC (rev 226153)
@@ -1,3 +1,17 @@
+2017-12-19  Brian Burg  <[email protected]>
+
+        Web Inspector: InspectorTest.expectException does not handle implicitly resolved async functions correctly
+        https://bugs.webkit.org/show_bug.cgi?id=180944
+
+        Reviewed by Joseph Pecoraro.
+
+        Add a new test case for implicitly resolved async functions passed to expectException.
+        Rebaseline one existing test that had a failing assertion that progresses with
+        this change. I didn't notice it because the assertion just prior is expected to fail.
+
+        * inspector/unit-tests/test-harness-expect-functions-async-expected.txt:
+        * inspector/unit-tests/test-harness-expect-functions-async.html:
+
 2017-12-19  Jer Noble  <[email protected]>
 
         Playing media elements which call "pause(); play()" will have the play promise rejected.

Modified: trunk/LayoutTests/inspector/unit-tests/test-harness-expect-functions-async-expected.txt (226152 => 226153)


--- trunk/LayoutTests/inspector/unit-tests/test-harness-expect-functions-async-expected.txt	2017-12-19 23:50:04 UTC (rev 226152)
+++ trunk/LayoutTests/inspector/unit-tests/test-harness-expect-functions-async-expected.txt	2017-12-19 23:53:02 UTC (rev 226153)
@@ -30,7 +30,12 @@
 FAIL: Should produce an exception.
     Expected: not null
     Actual: null
-PASS: Should produce an exception.
-42
-FAIL: The returned promise should not resolve since an expected exception was not raised.
+PASS: Rejected value should be the returned value.
 
+-- Running test case: expectException.AsyncWorkThatResolvesImplicitly
+The following assertion is expected to fail.
+FAIL: Should produce an exception.
+    Expected: not null
+    Actual: null
+PASS: Implicitly resolved value should be undefined.
+

Modified: trunk/LayoutTests/inspector/unit-tests/test-harness-expect-functions-async.html (226152 => 226153)


--- trunk/LayoutTests/inspector/unit-tests/test-harness-expect-functions-async.html	2017-12-19 23:50:04 UTC (rev 226152)
+++ trunk/LayoutTests/inspector/unit-tests/test-harness-expect-functions-async.html	2017-12-19 23:53:02 UTC (rev 226153)
@@ -80,6 +80,22 @@
         }
     });
 
+    suite.addTestCase({
+        name: "expectException.AsyncWorkThatResolvesImplicitly",
+        async test() {
+            InspectorTest.log("The following assertion is expected to fail.");
+
+            let returnValue = 42;
+            await InspectorTest.expectException(async () => {
+                1 + 1;
+            }).then(() => {
+                InspectorTest.fail("The returned promise should not resolve since an expected exception was not raised.");
+            }).catch((resolvedValue) => {
+                InspectorTest.expectEqual(resolvedValue, undefined, "Implicitly resolved value should be undefined.");
+            });
+        }
+    });
+
     suite.runTestCasesAndFinish();
 }
 </script>

Modified: trunk/Source/WebInspectorUI/ChangeLog (226152 => 226153)


--- trunk/Source/WebInspectorUI/ChangeLog	2017-12-19 23:50:04 UTC (rev 226152)
+++ trunk/Source/WebInspectorUI/ChangeLog	2017-12-19 23:53:02 UTC (rev 226153)
@@ -1,3 +1,14 @@
+2017-12-19  Brian Burg  <[email protected]>
+
+        Web Inspector: InspectorTest.expectException does not handle implicitly resolved async functions correctly
+        https://bugs.webkit.org/show_bug.cgi?id=180944
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Test/TestHarness.js:
+        (TestHarness.prototype.expectException):
+        Don't chain .catch after we might have just returned a rejected promise.
+
 2017-12-19  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: Network Table - Update the Time column to include the total duration not just the download duration

Modified: trunk/Source/WebInspectorUI/UserInterface/Test/TestHarness.js (226152 => 226153)


--- trunk/Source/WebInspectorUI/UserInterface/Test/TestHarness.js	2017-12-19 23:50:04 UTC (rev 226152)
+++ trunk/Source/WebInspectorUI/UserInterface/Test/TestHarness.js	2017-12-19 23:53:02 UTC (rev 226153)
@@ -218,7 +218,7 @@
                 return result.then((resolvedValue) => {
                     expectAndDumpError(null);
                     return Promise.reject(resolvedValue);
-                }).catch((e) => {
+                }, (e) => { // Don't chain the .catch as it will log the value we just rejected.
                     expectAndDumpError(e);
                     return Promise.resolve(e);
                 });
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to