Web Inspector: split TestStub.js into multiple files and modernize it
authorbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Aug 2015 21:51:45 +0000 (21:51 +0000)
committerbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Aug 2015 21:51:45 +0000 (21:51 +0000)
commitec4b109b0a1e8d7f0215af532e62447b7502fe85
tree59172f8c1daa60bba3c75832bb4c4157baaf7a2a
parentd0ba948310a1cdef3ddc1e61cfbb24c2f1fd1fdd
Web Inspector: split TestStub.js into multiple files and modernize it
https://bugs.webkit.org/show_bug.cgi?id=148077

Reviewed by Timothy Hatcher.
Source/WebInspectorUI:

Since we want to share files between the two harnesses, split some of the parts
into different files so not everything has to be included at once.

Rename InjectedTestHarness to just TestHarness. Update some code to use
ES6 features where appropriate. Put test classes into Test/ directory.

* UserInterface/Base/TestStub.js: Removed.
* UserInterface/Test.html:
* UserInterface/Test/InspectorProtocol.js: Added.
(InspectorProtocol.sendCommand):
(InspectorProtocol.awaitCommand):
(InspectorProtocol.awaitEvent.):
(InspectorProtocol.awaitEvent):
(InspectorProtocol.addEventListener):
(InspectorProtocol.sendMessage):
(InspectorProtocol.checkForError):
(InspectorProtocol.dispatchMessageFromBackend):
* UserInterface/Test/ProtocolTestHarness.js: Added.
(ProtocolTestHarness.prototype.completeTest):
(ProtocolTestHarness.prototype.addResult):
(ProtocolTestHarness.prototype.debugLog):
(ProtocolTestHarness.prototype.evaluateInPage):
(ProtocolTestHarness):
* UserInterface/Test/Test.js: Renamed from Source/WebInspectorUI/UserInterface/Base/Test.js.
(WebInspector.loaded):
(WebInspector.contentLoaded):
(WebInspector.UIString):
(WebInspector.updateDockedState):
(WebInspector.updateDockingAvailability):
(InspectorTest.EventDispatcher.prototype.dispatchEvent):
(InspectorTest.EventDispatcher):
(InspectorTest.log):
(InspectorTest.assert):
(InspectorTest.expectThat):
(InspectorTest.debugLog):
(InspectorTest.expectNoError):
(InspectorTest.completeTest):
(InspectorTest.evaluateInPage):
(InspectorTest.addResult):
(InspectorTest._resendResults):
(InspectorTest.testPageDidLoad):
(InspectorTest.reloadPage):
(InspectorTest.reportUncaughtException):
* UserInterface/Test/TestHarness.js: Added.
(TestHarness):
(TestHarness.prototype.completeTest):
(TestHarness.prototype.addResult):
(TestHarness.prototype.debugLog):
(TestHarness.prototype.evaluateInPage):
(TestHarness.prototype.createAsyncSuite):
(TestHarness.prototype.createSyncSuite):
(TestHarness.prototype.get logCount):
(TestHarness.prototype.log):
(TestHarness.prototype.assert):
(TestHarness.prototype.expectThat):
* UserInterface/Test/TestStub.js: Added.
* UserInterface/Test/TestSuite.js: Added.
(TestSuite):
(TestSuite.prototype.runTestCasesAndFinish):
(TestSuite.prototype.runTestCases):
(TestSuite.prototype.get passCount):
(TestSuite.prototype.get skipCount):
(TestSuite.prototype.addTestCase):
(AsyncTestSuite.prototype.runTestCasesAndFinish.finish):
(AsyncTestSuite.prototype.runTestCasesAndFinish):
(AsyncTestSuite.prototype.runTestCases):
(AsyncTestSuite):
(SyncTestSuite.prototype.runTestCasesAndFinish):
(SyncTestSuite.prototype.runTestCases):
(SyncTestSuite):
* UserInterface/TestStub.html:

LayoutTests:

Add the prefix 'TestPage' to everything in protocol-test.js. Continue
exporting it to the global namespace for backwards compatibility, too.

Rename some things to match changes in the test harness. Tighten up
preconditions for test suite and test case names. Sprinkle some ES6.

* http/tests/inspector/dom/resources/InspectorDOMListener.js:
* http/tests/inspector/resources/console-test.js:
* http/tests/inspector/resources/probe-test.js:
* http/tests/inspector/resources/protocol-test.js:
(TestPage.registerInitializer):
(TestPage.debugLog.window.debugLog):
(TestPage.log.window.log):
(TestPage.closeTest.window.closeTest):
(TestPage.runTest.window.runTest):
(ProtocolTestProxy.registerInitializer): Deleted.
(debugLog): Deleted.
(log): Deleted.
(closeTest): Deleted.
(runTest): Deleted.
* inspector/dom/resources/dom-search-queries.js:
* inspector/unit-tests/async-test-suite.html:
* inspector/unit-tests/sync-test-suite.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/dom/resources/InspectorDOMListener.js
LayoutTests/http/tests/inspector/resources/console-test.js
LayoutTests/http/tests/inspector/resources/probe-test.js
LayoutTests/http/tests/inspector/resources/protocol-test.js
LayoutTests/inspector/dom/resources/dom-search-queries.js
LayoutTests/inspector/unit-tests/async-test-suite-expected.txt
LayoutTests/inspector/unit-tests/async-test-suite.html
LayoutTests/inspector/unit-tests/sync-test-suite-expected.txt
LayoutTests/inspector/unit-tests/sync-test-suite.html
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/TestStub.js [deleted file]
Source/WebInspectorUI/UserInterface/Test.html
Source/WebInspectorUI/UserInterface/Test/InspectorProtocol.js [new file with mode: 0644]
Source/WebInspectorUI/UserInterface/Test/ProtocolTestHarness.js [new file with mode: 0644]
Source/WebInspectorUI/UserInterface/Test/Test.js [moved from Source/WebInspectorUI/UserInterface/Base/Test.js with 100% similarity]
Source/WebInspectorUI/UserInterface/Test/TestHarness.js [new file with mode: 0644]
Source/WebInspectorUI/UserInterface/Test/TestStub.js [new file with mode: 0644]
Source/WebInspectorUI/UserInterface/Test/TestSuite.js [new file with mode: 0644]
Source/WebInspectorUI/UserInterface/TestStub.html