Title: [225814] trunk
- Revision
- 225814
- Author
- bb...@apple.com
- Date
- 2017-12-12 15:13:04 -0800 (Tue, 12 Dec 2017)
Log Message
Web Inspector: SyncTestSuite should complain if passed an async setup/test/teardown function
https://bugs.webkit.org/show_bug.cgi?id=180717
Reviewed by Devin Rousso.
Source/WebInspectorUI:
* UserInterface/Test/TestSuite.js:
(SyncTestSuite.prototype.addTestCase):
Raise an exception if test/setup/teardown is an async function. It won't work.
LayoutTests:
Add new test cases for more strict requirements for test case arguments.
* inspector/unit-tests/sync-test-suite-expected.txt:
* inspector/unit-tests/sync-test-suite.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (225813 => 225814)
--- trunk/LayoutTests/ChangeLog 2017-12-12 23:12:20 UTC (rev 225813)
+++ trunk/LayoutTests/ChangeLog 2017-12-12 23:13:04 UTC (rev 225814)
@@ -1,3 +1,15 @@
+2017-12-12 Brian Burg <bb...@apple.com>
+
+ Web Inspector: SyncTestSuite should complain if passed an async setup/test/teardown function
+ https://bugs.webkit.org/show_bug.cgi?id=180717
+
+ Reviewed by Devin Rousso.
+
+ Add new test cases for more strict requirements for test case arguments.
+
+ * inspector/unit-tests/sync-test-suite-expected.txt:
+ * inspector/unit-tests/sync-test-suite.html:
+
2017-12-12 Antoine Quint <grao...@apple.com>
[Web Animations] Expose promises on Animation interface
Modified: trunk/LayoutTests/inspector/unit-tests/sync-test-suite-expected.txt (225813 => 225814)
--- trunk/LayoutTests/inspector/unit-tests/sync-test-suite-expected.txt 2017-12-12 23:12:20 UTC (rev 225813)
+++ trunk/LayoutTests/inspector/unit-tests/sync-test-suite-expected.txt 2017-12-12 23:13:04 UTC (rev 225814)
@@ -13,6 +13,9 @@
PASS: should not be able to specify non-Function `teardown` parameter.
PASS: should not be able to specify non-Function `teardown` parameter.
PASS: should not be able to specify non-Function `teardown` parameter.
+PASS: should not be able to specify async `test` parameter.
+PASS: should not be able to specify async `setup` parameter.
+PASS: should not be able to specify async `teardown` parameter.
PASS: should not be able to run empty test suite.
== Running test suite: SyncTestSuite.RunTwiceSuite
Modified: trunk/LayoutTests/inspector/unit-tests/sync-test-suite.html (225813 => 225814)
--- trunk/LayoutTests/inspector/unit-tests/sync-test-suite.html 2017-12-12 23:12:20 UTC (rev 225813)
+++ trunk/LayoutTests/inspector/unit-tests/sync-test-suite.html 2017-12-12 23:13:04 UTC (rev 225814)
@@ -135,6 +135,36 @@
} catch (e) {
ProtocolTest.log("PASS: should not be able to specify non-Function `teardown` parameter.");
}
+ try {
+ badArgsSuite.addTestCase({
+ name: "foo",
+ async test() {},
+ });
+ ProtocolTest.log("FAIL: should not be able to specify async `test` parameter.");
+ } catch (e) {
+ ProtocolTest.log("PASS: should not be able to specify async `test` parameter.");
+ }
+ try {
+ badArgsSuite.addTestCase({
+ name: "foo",
+ async setup() {},
+ test() {},
+ });
+ ProtocolTest.log("FAIL: should not be able to specify async `setup` parameter.");
+ } catch (e) {
+ ProtocolTest.log("PASS: should not be able to specify async `setup` parameter.");
+ }
+ try {
+ badArgsSuite.addTestCase({
+ name: "foo",
+ test() {},
+ async teardown() {},
+ });
+ ProtocolTest.log("FAIL: should not be able to specify async `teardown` parameter.");
+ } catch (e) {
+ ProtocolTest.log("PASS: should not be able to specify async `teardown` parameter.");
+ }
+
let runEmptySuite = ProtocolTest.createSyncSuite("SyncTestSuite.RunEmptySuite");
try {
runEmptySuite.runTestCases();
Modified: trunk/Source/WebInspectorUI/ChangeLog (225813 => 225814)
--- trunk/Source/WebInspectorUI/ChangeLog 2017-12-12 23:12:20 UTC (rev 225813)
+++ trunk/Source/WebInspectorUI/ChangeLog 2017-12-12 23:13:04 UTC (rev 225814)
@@ -1,5 +1,16 @@
2017-12-12 Brian Burg <bb...@apple.com>
+ Web Inspector: SyncTestSuite should complain if passed an async setup/test/teardown function
+ https://bugs.webkit.org/show_bug.cgi?id=180717
+
+ Reviewed by Devin Rousso.
+
+ * UserInterface/Test/TestSuite.js:
+ (SyncTestSuite.prototype.addTestCase):
+ Raise an exception if test/setup/teardown is an async function. It won't work.
+
+2017-12-12 Brian Burg <bb...@apple.com>
+
Web Inspector: add InspectorTest.expectException() and use it
https://bugs.webkit.org/show_bug.cgi?id=180719
Modified: trunk/Source/WebInspectorUI/UserInterface/Test/TestSuite.js (225813 => 225814)
--- trunk/Source/WebInspectorUI/UserInterface/Test/TestSuite.js 2017-12-12 23:12:20 UTC (rev 225813)
+++ trunk/Source/WebInspectorUI/UserInterface/Test/TestSuite.js 2017-12-12 23:13:04 UTC (rev 225814)
@@ -175,6 +175,14 @@
SyncTestSuite = class SyncTestSuite extends TestSuite
{
+ addTestCase(testcase)
+ {
+ if ([testcase.setup, testcase.teardown, testcase.test].some((fn) => fn && fn[Symbol.toStringTag] === "AsyncFunction"))
+ throw new Error("Tried to pass a test case with an async `setup`, `test`, or `teardown` function, but this is a synchronous test suite.")
+
+ super.addTestCase(testcase);
+ }
+
runTestCasesAndFinish()
{
this.runTestCases();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes