haikuwebkit/Source/WebInspectorUI/UserInterface/TestStub.html

61 lines
2.5 KiB
HTML
Raw Permalink Normal View History

Web Inspector: implement testing harness for pure protocol tests. https://bugs.webkit.org/show_bug.cgi?id=90675 Patch by Vivek Galatage <vivekgalatage@gmail.com> on 2012-09-24 Reviewed by Yury Semikhatsky. .: Added export symbols required for Gtk+ to support the Inspector Protocol testing harness. * Source/autotools/symbols.filter: Source/WebCore: Implementing the testing harness as the APIs of Internals object not only reduced platform specific patching of DRTs but also minimized the the effort required to open up the new dummy inspector Frontend. The openDummyInspectorFrontend method will return the handle to newly created DOMWindow. This DOMWindow object can be utilized inside the test case to communicate using postMessage WebAPI. The newly created DOMWindow will host the protocol-test.html which will seed the necessary JS libraries to communicate with the InspectorBackend. Test: inspector-protocol/css-getSupportedCSSProperties.html * WebCore.exp.in: * WebCore.gypi: * inspector/InspectorClient.h: (InspectorClient): * testing/Internals.cpp: (InspectorFrontendClientDummy): (WebCore::InspectorFrontendClientDummy::~InspectorFrontendClientDummy): (WebCore): (WebCore::InspectorFrontendClientDummy::InspectorFrontendClientDummy): (InspectorFrontendChannelDummy): (WebCore::InspectorFrontendChannelDummy::~InspectorFrontendChannelDummy): (WebCore::InspectorFrontendChannelDummy::InspectorFrontendChannelDummy): (WebCore::InspectorFrontendChannelDummy::sendMessageToFrontend): (WebCore::Internals::consoleMessageArgumentCounts): (WebCore::Internals::openDummyInspectorFrontend): (WebCore::Internals::closeDummyInspectorFrontend): * testing/Internals.h: (WebCore): (Internals): * testing/Internals.idl: Source/WebKit2: Adding the export symbol definitions required on Apple Windows and WinCairo ports to support Inspector Protocol testing harness. * win/WebKit2.def: * win/WebKit2CFLite.def: LayoutTests: Adding the resources required for the dummy frontend page to load minimal frontend. These resources provide the mechanism to talk to the Inspector Backend. Adding the inspector-protocol folder to host the relevant test cases utilizing the inspector protocol test harness. Added an example test case for getting all supported CSS properties using the inspector protocol and searching for a particular property being supported. * http/tests/inspector-protocol: Added. * http/tests/inspector-protocol/resources: Added. * http/tests/inspector-protocol/resources/InspectorTest.js: Added. (InspectorTest.sendCommand): (WebInspector.dispatchMessageFromBackend): (InspectorTest.log): (InspectorTest.completeTest): * http/tests/inspector-protocol/resources/protocol-test.html: Added. * http/tests/inspector-protocol/resources/protocol-test.js: Added. (log): (closeTest): (runTest): * inspector-protocol: Added. * inspector-protocol/css-getSupportedCSSProperties-expected.txt: Added. * inspector-protocol/css-getSupportedCSSProperties.html: Added. Canonical link: https://commits.webkit.org/115380@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@129346 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-09-24 11:38:00 +00:00
<!--
Web Inspector: move http/tests/inspector-protocol/ contents to http/tests/inspector/ https://bugs.webkit.org/show_bug.cgi?id=147739 Patch by Brian Burg <bburg@apple.com> on 2015-08-06 Reviewed by Timothy Hatcher. Start merging inspector-protocol/ directory into inspector/, starting with http tests. This patch puts the few http tests into their own domain directories. Files related to the test harness have been moved to the appropriate resources/ directory. Update all inspector tests to the new paths. Lastly, rename InspectorTest.js and protocol-test.html to ProtocolTestStub, to make it obvious that these files are only used by the protocol test harness. * http/tests/inspector/console/access-inspected-object-expected.txt: Renamed from LayoutTests/http/tests/inspector-protocol/access-inspected-object-expected.txt. * http/tests/inspector/console/access-inspected-object.html: Renamed from LayoutTests/http/tests/inspector-protocol/access-inspected-object.html. * http/tests/inspector/css/bad-mime-type.html: * http/tests/inspector/dom/resources/InspectorDOMListener.js: Renamed from LayoutTests/http/tests/inspector-protocol/resources/InspectorDOMListener.js. * http/tests/inspector/page/loading-iframe-document-node-expected.txt: Renamed from LayoutTests/http/tests/inspector-protocol/loading-iframe-document-node-expected.txt. * http/tests/inspector/page/loading-iframe-document-node.html: Renamed from LayoutTests/http/tests/inspector-protocol/loading-iframe-document-node.html. * http/tests/inspector/page/resources/slow-test-page.html: Renamed from LayoutTests/http/tests/inspector-protocol/resources/slow-test-page.html. * http/tests/inspector/page/resources/test-page.html: Renamed from LayoutTests/http/tests/inspector-protocol/resources/test-page.html. * http/tests/inspector/replay/document-last-modified-fallback-value.html: * http/tests/inspector/resources/ProtocolTestStub.html: Renamed from LayoutTests/http/tests/inspector-protocol/resources/protocol-test.html. * http/tests/inspector/resources/ProtocolTestStub.js: Renamed from LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js. * http/tests/inspector/resources/inspector-test.js: Renamed from LayoutTests/http/tests/inspector/inspector-test.js. * http/tests/inspector/resources/protocol-test.js: Renamed from LayoutTests/http/tests/inspector-protocol/resources/protocol-test.js. * inspector-protocol/async-test-suite.html: * inspector-protocol/console/console-message.html: * inspector-protocol/console/css-source-locations.html: Fix references to console helpers. * inspector-protocol/console/js-source-locations.html: * inspector-protocol/console/x-frame-options-message.html: * inspector-protocol/css/getSupportedCSSProperties.html: * inspector-protocol/debugger/breakpoint-action-detach.html: * inspector-protocol/debugger/breakpoint-action-with-exception.html: * inspector-protocol/debugger/breakpoint-condition-detach.html: * inspector-protocol/debugger/breakpoint-condition-with-bad-script.html: * inspector-protocol/debugger/breakpoint-condition-with-exception.html: * inspector-protocol/debugger/breakpoint-eval-with-exception.html: * inspector-protocol/debugger/breakpoint-inside-conditons-and-actions.html: * inspector-protocol/debugger/call-frame-function-name.html: * inspector-protocol/debugger/call-frame-this-host.html: * inspector-protocol/debugger/call-frame-this-nonstrict.html: * inspector-protocol/debugger/call-frame-this-strict.html: * inspector-protocol/debugger/debugger-statement.html: * inspector-protocol/debugger/didSampleProbe-multiple-probes.html: * inspector-protocol/debugger/hit-breakpoint-from-console.html: * inspector-protocol/debugger/nested-inspectors.html: * inspector-protocol/debugger/pause-dedicated-worker.html: * inspector-protocol/debugger/pause-on-assert.html: * inspector-protocol/debugger/regress-133182.html: * inspector-protocol/debugger/removeBreakpoint.html: * inspector-protocol/debugger/searchInContent-linebreaks.html: * inspector-protocol/debugger/setBreakpoint-actions.html: * inspector-protocol/debugger/setBreakpoint-autoContinue.html: * inspector-protocol/debugger/setBreakpoint-column.html: * inspector-protocol/debugger/setBreakpoint-condition.html: * inspector-protocol/debugger/setBreakpoint-dfg-and-modify-local.html: * inspector-protocol/debugger/setBreakpoint-dfg-callee-and-examine-dfg-local.html: * inspector-protocol/debugger/setBreakpoint-dfg.html: * inspector-protocol/debugger/setBreakpoint-options-exception.html: * inspector-protocol/debugger/setBreakpoint.html: * inspector-protocol/debugger/setBreakpointByUrl-sourceURL.html: * inspector-protocol/debugger/setPauseOnExceptions-all.html: * inspector-protocol/debugger/setPauseOnExceptions-none.html: * inspector-protocol/debugger/setPauseOnExceptions-uncaught.html: * inspector-protocol/debugger/setVariableValue.html: * inspector-protocol/debugger/terminate-dedicated-worker-while-paused.html: * inspector-protocol/dom-debugger/node-removed.html: * inspector-protocol/dom/dom-remove-events.html: * inspector-protocol/dom/dom-search-crash.html: * inspector-protocol/dom/dom-search-with-context.html: * inspector-protocol/dom/dom-search.html: * inspector-protocol/dom/focus.html: * inspector-protocol/dom/getAccessibilityPropertiesForNode.html: * inspector-protocol/dom/getAccessibilityPropertiesForNode_liveRegion.html: * inspector-protocol/dom/getAccessibilityPropertiesForNode_mouseEventNodeId.html: * inspector-protocol/dom/highlight-flow-with-no-region.html: * inspector-protocol/dom/remove-multiple-nodes.html: * inspector-protocol/dom/request-child-nodes-depth.html: * inspector-protocol/layers/layers-anonymous.html: * inspector-protocol/layers/layers-blending-compositing-reasons.html: * inspector-protocol/layers/layers-compositing-reasons.html: * inspector-protocol/layers/layers-for-node.html: * inspector-protocol/layers/layers-generated-content.html: * inspector-protocol/layers/layers-reflected-content.html: * inspector-protocol/page/archive.html: * inspector-protocol/page/frameScheduledNavigation.html: * inspector-protocol/page/frameStartedLoading.html: * inspector-protocol/page/javascriptDialogEvents.html: * inspector-protocol/page/setEmulatedMedia.html: * inspector-protocol/runtime/getProperties.html: * inspector-protocol/sync-test-suite.html: * inspector/console/command-line-api.html: * inspector/console/console-api.html: * inspector/console/console-table.html: * inspector/css/get-system-fonts.html: * inspector/css/matched-style-properties.html: * inspector/css/modify-rule-selector.html: * inspector/css/pseudo-element-matches-for-pseudo-element-node.html: * inspector/css/pseudo-element-matches.html: * inspector/css/selector-dynamic-specificity.html: * inspector/css/selector-specificity.html: * inspector/css/stylesheet-with-mutations.html: * inspector/debugger/break-on-exception-catch.html: * inspector/debugger/break-on-exception-finally.html: * inspector/debugger/break-on-exception-native.html: * inspector/debugger/break-on-exception-throw-in-promise-rethrow-in-catch.html: * inspector/debugger/break-on-exception-throw-in-promise-then-with-catch.html: * inspector/debugger/break-on-exception-throw-in-promise-then.html: * inspector/debugger/break-on-exception-throw-in-promise-with-catch.html: * inspector/debugger/break-on-exception-throw-in-promise.html: * inspector/debugger/break-on-exception-window-onerror.html: * inspector/debugger/break-on-exception.html: * inspector/debugger/break-on-uncaught-exception-catch.html: * inspector/debugger/break-on-uncaught-exception-finally.html: * inspector/debugger/break-on-uncaught-exception-native.html: * inspector/debugger/break-on-uncaught-exception-throw-in-promise-rethrow-in-catch.html: * inspector/debugger/break-on-uncaught-exception-throw-in-promise-then-with-catch.html: * inspector/debugger/break-on-uncaught-exception-throw-in-promise-then.html: * inspector/debugger/break-on-uncaught-exception-throw-in-promise-with-catch.html: * inspector/debugger/break-on-uncaught-exception-throw-in-promise.html: * inspector/debugger/break-on-uncaught-exception-window-onerror.html: * inspector/debugger/break-on-uncaught-exception.html: * inspector/debugger/breakpoint-action-eval.html: * inspector/debugger/breakpoint-columns.html: * inspector/debugger/breakpoint-scope.html: * inspector/debugger/command-line-api-exception-nested-catch.html: * inspector/debugger/command-line-api-exception.html: * inspector/debugger/js-stacktrace.html: * inspector/debugger/pause-reason.html: * inspector/debugger/probe-manager-add-remove-actions.html: * inspector/debugger/search-scripts-expected.txt: * inspector/debugger/search-scripts.html: * inspector/dom/content-flow-content-nodes.html: * inspector/dom/content-flow-content-removal.html: * inspector/dom/content-flow-list.html: * inspector/dom/content-node-region-info.html: * inspector/dom/highlight-shape-outside-margin.html: * inspector/dom/highlight-shape-outside.html: * inspector/dom/highlightSelector.html: * inspector/dom/pseudo-element-dynamic.html: * inspector/dom/pseudo-element-static.html: * inspector/dom/template-content.html: * inspector/event-listener-set.html: * inspector/event-listener.html: * inspector/model/parse-script-syntax-tree.html: * inspector/model/remote-object-get-properties.html: * inspector/model/remote-object-weak-collection.html: * inspector/model/remote-object.html: * inspector/page/main-frame-resource.html: * inspector/protocol-promise-result.html: * inspector/replay/javascript-date-now.html: * inspector/replay/javascript-random-seed.html: * inspector/replay/window-navigator-plugins-memoized.html: * inspector/test-harness-trivially-works.html: * inspector/timeline/debugger-paused-while-recording.html: * inspector/timeline/exception-in-injected-script-while-recording.html: * inspector/timeline/recording-start-stop-timestamps.html: * platform/efl/TestExpectations: * platform/gtk/TestExpectations: * platform/ios-simulator-wk1/TestExpectations: * platform/ios-simulator-wk2/TestExpectations: Canonical link: https://commits.webkit.org/165829@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188059 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-08-06 21:17:03 +00:00
Copyright (C) 2015 Apple Inc. All rights reserved.
Web Inspector: implement testing harness for pure protocol tests. https://bugs.webkit.org/show_bug.cgi?id=90675 Patch by Vivek Galatage <vivekgalatage@gmail.com> on 2012-09-24 Reviewed by Yury Semikhatsky. .: Added export symbols required for Gtk+ to support the Inspector Protocol testing harness. * Source/autotools/symbols.filter: Source/WebCore: Implementing the testing harness as the APIs of Internals object not only reduced platform specific patching of DRTs but also minimized the the effort required to open up the new dummy inspector Frontend. The openDummyInspectorFrontend method will return the handle to newly created DOMWindow. This DOMWindow object can be utilized inside the test case to communicate using postMessage WebAPI. The newly created DOMWindow will host the protocol-test.html which will seed the necessary JS libraries to communicate with the InspectorBackend. Test: inspector-protocol/css-getSupportedCSSProperties.html * WebCore.exp.in: * WebCore.gypi: * inspector/InspectorClient.h: (InspectorClient): * testing/Internals.cpp: (InspectorFrontendClientDummy): (WebCore::InspectorFrontendClientDummy::~InspectorFrontendClientDummy): (WebCore): (WebCore::InspectorFrontendClientDummy::InspectorFrontendClientDummy): (InspectorFrontendChannelDummy): (WebCore::InspectorFrontendChannelDummy::~InspectorFrontendChannelDummy): (WebCore::InspectorFrontendChannelDummy::InspectorFrontendChannelDummy): (WebCore::InspectorFrontendChannelDummy::sendMessageToFrontend): (WebCore::Internals::consoleMessageArgumentCounts): (WebCore::Internals::openDummyInspectorFrontend): (WebCore::Internals::closeDummyInspectorFrontend): * testing/Internals.h: (WebCore): (Internals): * testing/Internals.idl: Source/WebKit2: Adding the export symbol definitions required on Apple Windows and WinCairo ports to support Inspector Protocol testing harness. * win/WebKit2.def: * win/WebKit2CFLite.def: LayoutTests: Adding the resources required for the dummy frontend page to load minimal frontend. These resources provide the mechanism to talk to the Inspector Backend. Adding the inspector-protocol folder to host the relevant test cases utilizing the inspector protocol test harness. Added an example test case for getting all supported CSS properties using the inspector protocol and searching for a particular property being supported. * http/tests/inspector-protocol: Added. * http/tests/inspector-protocol/resources: Added. * http/tests/inspector-protocol/resources/InspectorTest.js: Added. (InspectorTest.sendCommand): (WebInspector.dispatchMessageFromBackend): (InspectorTest.log): (InspectorTest.completeTest): * http/tests/inspector-protocol/resources/protocol-test.html: Added. * http/tests/inspector-protocol/resources/protocol-test.js: Added. (log): (closeTest): (runTest): * inspector-protocol: Added. * inspector-protocol/css-getSupportedCSSProperties-expected.txt: Added. * inspector-protocol/css-getSupportedCSSProperties.html: Added. Canonical link: https://commits.webkit.org/115380@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@129346 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-09-24 11:38:00 +00:00
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
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: Canonical link: https://commits.webkit.org/166297@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188639 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-08-19 16:14:04 +00:00
<!DOCTYPE html>
Web Inspector: implement testing harness for pure protocol tests. https://bugs.webkit.org/show_bug.cgi?id=90675 Patch by Vivek Galatage <vivekgalatage@gmail.com> on 2012-09-24 Reviewed by Yury Semikhatsky. .: Added export symbols required for Gtk+ to support the Inspector Protocol testing harness. * Source/autotools/symbols.filter: Source/WebCore: Implementing the testing harness as the APIs of Internals object not only reduced platform specific patching of DRTs but also minimized the the effort required to open up the new dummy inspector Frontend. The openDummyInspectorFrontend method will return the handle to newly created DOMWindow. This DOMWindow object can be utilized inside the test case to communicate using postMessage WebAPI. The newly created DOMWindow will host the protocol-test.html which will seed the necessary JS libraries to communicate with the InspectorBackend. Test: inspector-protocol/css-getSupportedCSSProperties.html * WebCore.exp.in: * WebCore.gypi: * inspector/InspectorClient.h: (InspectorClient): * testing/Internals.cpp: (InspectorFrontendClientDummy): (WebCore::InspectorFrontendClientDummy::~InspectorFrontendClientDummy): (WebCore): (WebCore::InspectorFrontendClientDummy::InspectorFrontendClientDummy): (InspectorFrontendChannelDummy): (WebCore::InspectorFrontendChannelDummy::~InspectorFrontendChannelDummy): (WebCore::InspectorFrontendChannelDummy::InspectorFrontendChannelDummy): (WebCore::InspectorFrontendChannelDummy::sendMessageToFrontend): (WebCore::Internals::consoleMessageArgumentCounts): (WebCore::Internals::openDummyInspectorFrontend): (WebCore::Internals::closeDummyInspectorFrontend): * testing/Internals.h: (WebCore): (Internals): * testing/Internals.idl: Source/WebKit2: Adding the export symbol definitions required on Apple Windows and WinCairo ports to support Inspector Protocol testing harness. * win/WebKit2.def: * win/WebKit2CFLite.def: LayoutTests: Adding the resources required for the dummy frontend page to load minimal frontend. These resources provide the mechanism to talk to the Inspector Backend. Adding the inspector-protocol folder to host the relevant test cases utilizing the inspector protocol test harness. Added an example test case for getting all supported CSS properties using the inspector protocol and searching for a particular property being supported. * http/tests/inspector-protocol: Added. * http/tests/inspector-protocol/resources: Added. * http/tests/inspector-protocol/resources/InspectorTest.js: Added. (InspectorTest.sendCommand): (WebInspector.dispatchMessageFromBackend): (InspectorTest.log): (InspectorTest.completeTest): * http/tests/inspector-protocol/resources/protocol-test.html: Added. * http/tests/inspector-protocol/resources/protocol-test.js: Added. (log): (closeTest): (runTest): * inspector-protocol: Added. * inspector-protocol/css-getSupportedCSSProperties-expected.txt: Added. * inspector-protocol/css-getSupportedCSSProperties.html: Added. Canonical link: https://commits.webkit.org/115380@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@129346 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-09-24 11:38:00 +00:00
<html>
<head>
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: Canonical link: https://commits.webkit.org/166297@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188639 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-08-19 16:14:04 +00:00
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--
These resources should match the order and groups used in Main.html and Test.html.
-->
<script src="Base/WebInspector.js"></script>
Web Inspector: use weak collections for holding event listeners https://bugs.webkit.org/show_bug.cgi?id=196956 Reviewed by Brian Burg. Source/WebInspectorUI: Replace the `ListMultimap`/`LinkedList` with a `Multimap` for holding listener data: ``` Map<String eventType, Set<{Function listener, WeakRef thisObject}>> _listeners; ``` This preserves addition order while also not strongly holding any `thisObject` so they can be GCed (and remove the `listener` along with it). * UserInterface/Base/Object.js: (WI.Object.addEventListener): (WI.Object.singleFireEventListener): (WI.Object.awaitEvent): (WI.Object.removeEventListener): (WI.Object.prototype.singleFireEventListener): (WI.Object.prototype.removeEventListener): (WI.Object.prototype.dispatchEventToListeners.dispatch): (WI.Object.hasEventListeners): (WI.Object.activelyListeningObjectsWithPrototype): Added. (WI.Object.prototype.activelyListeningObjectsWithPrototype): Added. * UserInterface/Base/SearchUtilities.js: (WI.SearchUtilities.createSettings): (WI.SearchUtilities.createSettingsButton): * UserInterface/Base/Main.js: (WI.loaded): (WI.contentLoaded): * UserInterface/Models/Resource.js: (WI.Resource.prototype.requestContent): * UserInterface/Controllers/RuntimeManager.js: (WI.RuntimeManager): * UserInterface/Views/AuditTestCaseContentView.js: (WI.AuditTestCaseContentView.prototype.showRunningPlaceholder): * UserInterface/Views/AuditTestContentView.js: (WI.AuditTestContentView.prototype.showNoResultPlaceholder): * UserInterface/Views/AuditTestGroupContentView.js: (WI.AuditTestGroupContentView.prototype.showRunningPlaceholder): * UserInterface/Views/CodeMirrorEditor.js: (WI.CodeMirrorEditor.create): * UserInterface/Debug/Bootstrap.js: (WI.runBootstrapOperations): * UserInterface/Views/ConsoleDrawer.js: (WI.ConsoleDrawer): * UserInterface/Views/ConsoleMessageView.js: (WI.ConsoleMessageView.prototype.clearSessionState): (WI.ConsoleMessageView.prototype._appendSavedResultIndex): (WI.ConsoleMessageView.prototype._rootPropertyPathForObject): * UserInterface/Views/ContentBrowser.js: (WI.ContentBrowser): (WI.ContentBrowser.prototype.async handleFindNextShortcut): (WI.ContentBrowser.prototype.async handleFindPreviousShortcut): * UserInterface/Views/HeapSnapshotContentView.js: (WI.HeapSnapshotContentView): * UserInterface/Views/LogContentView.js: (WI.LogContentView): * UserInterface/Views/MediaTimelineOverviewGraph.js: (WI.MediaTimelineOverviewGraph.prototype._processRecord): * UserInterface/Views/NetworkDetailView.js: (WI.NetworkDetailView.prototype.initialLayout): * UserInterface/Views/ObjectTreeView.js: (WI.ObjectTreeView.prototype.addShowMoreIfNeeded): * UserInterface/Views/SearchSidebarPanel.js: (WI.SearchSidebarPanel): (WI.SearchSidebarPanel.prototype.closed): (WI.SearchSidebarPanel.prototype.performSearch): * UserInterface/Views/SettingEditor.js: (WI.SettingEditor.createForSetting): * UserInterface/Views/SettingsTabContentView.js: (WI.SettingsTabContentView.prototype._createGeneralSettingsView): (WI.SettingsTabContentView.prototype._createConsoleSettingsView): (WI.SettingsTabContentView.prototype._createExperimentalSettingsView.listenForChange): (WI.SettingsTabContentView.prototype._createExperimentalSettingsView): (WI.SettingsTabContentView.prototype._createDebugSettingsView): * UserInterface/Views/ShaderProgramContentView.js: (WI.ShaderProgramContentView): * UserInterface/Views/SourcesNavigationSidebarPanel.js: (WI.SourcesNavigationSidebarPanel): (WI.SourcesNavigationSidebarPanel.prototype.closed): (WI.SourcesNavigationSidebarPanel.prototype.createContentTreeOutline): * UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js: (WI.SpreadsheetCSSStyleDeclarationSection.prototype.initialLayout): * UserInterface/Views/SpreadsheetStyleProperty.js: (WI.SpreadsheetStyleProperty.prototype._createInlineSwatch): * UserInterface/Views/ThreadTreeElement.js: (WI.ThreadTreeElement.prototype._updateStatus): * UserInterface/Views/TimelineTreeElement.js: (WI.TimelineTreeElement.prototype._showCloseButton): Update callers of `WI.Object.prototype.addEventListener` to always pass a `thisObject`. This is especially important for inlined `listener`, as there needs to be a strong reference to some "longer lived" `thisObject` (which is held by a `WeakRef`) in order for the `listener` to not be GCed. * UserInterface/Models/DOMNodeStyles.js: (WI.DOMNodeStyles): (WI.DOMNodeStyles.prototype._parseStyleDeclarationPayload): (WI.DOMNodeStyles.prototype._parseRulePayload): (WI.DOMNodeStyles.prototype._handleCSSStyleSheetContentDidChange): Added. (WI.DOMNodeStyles.prototype._styleSheetContentDidChange): Deleted. * UserInterface/Views/TimelineRecordingProgressView.js: (WI.TimelineRecordingProgressView): (WI.TimelineRecordingProgressView.prototype.set visible): (WI.TimelineRecordingProgressView.prototype._updateState): Use a global event listener instead of adding event listeners to specific objects as it's already likely that all the objects would be listened to anyways. * UserInterface/Models/DOMTree.js: (WI.DOMTree.prototype.disconnect): * UserInterface/Controllers/ApplicationCacheManager.js: (WI.ApplicationCacheManager.prototype.disable): * UserInterface/Controllers/CallFrameTreeController.js: (WI.CallFrameTreeController.prototype.disconnect): * UserInterface/Controllers/DOMStorageManager.js: (WI.DOMStorageManager.prototype.disable): * UserInterface/Controllers/DatabaseManager.js: (WI.DatabaseManager.prototype.disable): * UserInterface/Controllers/IndexedDBManager.js: (WI.IndexedDBManager.prototype.disable): * UserInterface/Controllers/TimelineManager.js: (WI.TimelineManager.prototype.capturingStopped): * UserInterface/Views/ApplicationCacheDetailsSidebarPanel.js: (WI.ApplicationCacheDetailsSidebarPanel.prototype.closed): * UserInterface/Views/ApplicationCacheFrameContentView.js: (WI.ApplicationCacheFrameContentView.prototype.closed): * UserInterface/Views/AuditNavigationSidebarPanel.js: (WI.AuditNavigationSidebarPanel.prototype.closed): * UserInterface/Views/AuditTreeElement.js: (WI.AuditTreeElement.prototype.ondetach): * UserInterface/Views/CPUTimelineView.js: (WI.CPUTimelineView.prototype.closed): * UserInterface/Views/CanvasContentView.js: (WI.CanvasContentView.prototype.detached): * UserInterface/Views/CanvasOverviewContentView.js: (WI.CanvasOverviewContentView.prototype.detached): * UserInterface/Views/CanvasSidebarPanel.js: (WI.CanvasSidebarPanel.prototype.set canvas): (WI.CanvasSidebarPanel.prototype.set recording): (WI.CanvasSidebarPanel.prototype.hidden): * UserInterface/Views/ClusterContentView.js: (WI.ClusterContentView.prototype.closed): * UserInterface/Views/CollectionContentView.js: (WI.CollectionContentView.prototype.removeContentViewForItem): (WI.CollectionContentView.prototype.detached): * UserInterface/Views/ContentBrowserTabContentView.js: (WI.ContentBrowserTabContentView.prototype.hidden): (WI.ContentBrowserTabContentView.prototype.closed): * UserInterface/Views/DOMNodeDetailsSidebarPanel.js: (WI.DOMNodeDetailsSidebarPanel.prototype.closed): * UserInterface/Views/DOMTreeContentView.js: (WI.DOMTreeContentView.prototype.closed): * UserInterface/Views/DOMTreeUpdater.js: (WI.DOMTreeUpdater.prototype.close): * UserInterface/Views/ElementsTabContentView.js: (WI.ElementsTabContentView.prototype.closed): * UserInterface/Views/FrameDOMTreeContentView.js: (WI.FrameDOMTreeContentView.prototype.closed): * UserInterface/Views/GeneralStyleDetailsSidebarPanel.js: (WI.GeneralStyleDetailsSidebarPanel.prototype.removeEventListeners): * UserInterface/Views/HeapAllocationsTimelineView.js: (WI.HeapAllocationsTimelineView): (WI.HeapAllocationsTimelineView.prototype.closed): * UserInterface/Views/ImageResourceContentView.js: (WI.ImageResourceContentView.prototype.closed): Deleted. * UserInterface/Views/InlineSwatch.js: (WI.InlineSwatch.prototype.didDismissPopover): * UserInterface/Views/LayoutTimelineView.js: (WI.LayoutTimelineView.prototype.closed): * UserInterface/Views/LocalResourceOverrideWarningView.js: (WI.LocalResourceOverrideWarningView.prototype.detached): * UserInterface/Views/MemoryTimelineView.js: (WI.MemoryTimelineView.prototype.closed): * UserInterface/Views/MultipleScopeBarItem.js: (WI.MultipleScopeBarItem.prototype.set scopeBarItems): * UserInterface/Views/NavigationSidebarPanel.js: (WI.NavigationSidebarPanel.prototype.closed): * UserInterface/Views/NetworkTimelineView.js: (WI.NetworkTimelineView.prototype.closed): * UserInterface/Views/OverviewTimelineView.js: (WI.OverviewTimelineView.prototype.closed): * UserInterface/Views/ProbeDetailsSidebarPanel.js: (WI.ProbeDetailsSidebarPanel.prototype.closed): * UserInterface/Views/QuickConsole.js: (WI.QuickConsole.prototype.closed): * UserInterface/Views/RecordingContentView.js: (WI.RecordingContentView.prototype._handleRecordingProcessedAction): * UserInterface/Views/RenderingFrameTimelineView.js: (WI.RenderingFrameTimelineView.prototype.closed): * UserInterface/Views/ResourceCollectionContentView.js: (WI.ResourceCollectionContentView.prototype.detached): (WI.ResourceCollectionContentView.prototype.contentViewRemoved): * UserInterface/Views/ResourceContentView.js: (WI.ResourceContentView.prototype.closed): * UserInterface/Views/ResourceDetailsSidebarPanel.js: (WI.ResourceDetailsSidebarPanel.prototype.set resource): (WI.ResourceDetailsSidebarPanel.prototype._applyResourceEventListeners): (WI.ResourceDetailsSidebarPanel.prototype._handleResourceInitiatedResourcesDidChange): Added. * UserInterface/Views/ResourceHeadersContentView.js: (WI.ResourceHeadersContentView.prototype.closed): * UserInterface/Views/ResourceSecurityContentView.js: (WI.ResourceSecurityContentView.prototype.closed): * UserInterface/Views/ResourceSizesContentView.js: (WI.ResourceSizesContentView.prototype.closed): * UserInterface/Views/ResourceTimingContentView.js: (WI.ResourceTimingContentView.prototype.closed): * UserInterface/Views/ScopeChainDetailsSidebarPanel.js: (WI.ScopeChainDetailsSidebarPanel.prototype._generateCallFramesSection): (WI.ScopeChainDetailsSidebarPanel.prototype._generateWatchExpressionsSection): (WI.ScopeChainDetailsSidebarPanel.prototype.closed): * UserInterface/Views/ScriptContentView.js: (WI.ScriptContentView.prototype.closed): * UserInterface/Views/ScriptDetailsTimelineView.js: (WI.ScriptDetailsTimelineView.prototype.closed): * UserInterface/Views/ScriptProfileTimelineView.js: (WI.ScriptProfileTimelineView.prototype.closed): * UserInterface/Views/SourceCodeTextEditor.js: (WI.SourceCodeTextEditor.prototype.close): (WI.SourceCodeTextEditor.prototype._showPopover): (WI.SourceCodeTextEditor.prototype._showPopoverForObject): (WI.SourceCodeTextEditor.prototype._dismissPopover): (WI.SourceCodeTextEditor.prototype._trackPopoverEvents): Deleted. * UserInterface/Views/StorageSidebarPanel.js: (WI.StorageSidebarPanel.prototype.closed): * UserInterface/Views/TextResourceContentView.js: (WI.TextResourceContentView.prototype.closed): * UserInterface/Views/TimelineOverview.js: (WI.TimelineOverview.prototype.closed): * UserInterface/Views/TimelineRecordingContentView.js: (WI.TimelineRecordingContentView): (WI.TimelineRecordingContentView.prototype.closed): (WI.TimelineRecordingContentView.prototype._recordingUnloaded): * UserInterface/Views/TimelineRuler.js: (WI.TimelineRuler.prototype.clearMarkers): * UserInterface/Views/TimelineTabContentView.js: (WI.TimelineTabContentView.prototype.closed): * UserInterface/Views/TreeOutlineGroup.js: (WI.TreeOutlineGroup.prototype.itemRemoved): Replace the `removeEventListener(null, null, this)` pattern by instead having callers remove each event listener explicitly. This is a safer design as it can avoid situations where parent classes inadvertently remove event listeners added by subclasses. For objects with lots of event listeners this is also more efficient as it doesn't require as much iteration. * UserInterface/Views/RecordingActionTreeElement.js: (WI.RecordingActionTreeElement): (WI.RecordingActionTreeElement.prototype._handleValidityChanged): Use `singleFireEventListener` where possible. * UserInterface/Controllers/DebuggerManager.js: (WI.DebuggerManager.prototype.pause): (WI.DebuggerManager.prototype.resume): (WI.DebuggerManager.prototype.stepNext): (WI.DebuggerManager.prototype.stepOver): (WI.DebuggerManager.prototype.stepInto): (WI.DebuggerManager.prototype.stepOut): * UserInterface/Views/BreakpointTreeElement.js: (WI.BreakpointTreeElement.prototype.onattach): (WI.BreakpointTreeElement.prototype.ondetach): (WI.BreakpointTreeElement.prototype.get listenerSet): Deleted. * UserInterface/Views/DataGrid.js: (WI.DataGrid.prototype.insertColumn): (WI.DataGrid.prototype.removeColumn): * UserInterface/Views/JavaScriptBreakpointTreeElement.js: (WI.JavaScriptBreakpointTreeElement): (WI.JavaScriptBreakpointTreeElement.prototype.onattach): (WI.JavaScriptBreakpointTreeElement.prototype.ondetach): * UserInterface/Views/ProbeSetDataGrid.js: (WI.ProbeSetDataGrid): (WI.ProbeSetDataGrid.prototype.closed): (WI.ProbeSetDataGrid.prototype._setupData): (WI.ProbeSetDataGrid.prototype._teardownData): * UserInterface/Views/ProbeSetDetailsSection.js: (WI.ProbeSetDetailsSection): (WI.ProbeSetDetailsSection.prototype.closed): Remove the legacy `WI.EventListener` and `WI.EventListenerSet` as they basically do the same thing as `WI.Object` with extra steps. * UserInterface/Models/WebSocketResource.js: * UserInterface/Proxies/HeapSnapshotWorkerProxy.js: * UserInterface/Controllers/TargetManager.js: * UserInterface/Views/DataGridNode.js: (WI.DataGridNode.prototype.collapse): (WI.DataGridNode.prototype.expand): (WI.DataGridNode.prototype.reveal): (WI.DataGridNode.prototype.traverseNextNode): (WI.DataGridNode.prototype.traversePreviousNode): * UserInterface/Views/HeapSnapshotClassDataGridNode.js: (WI.HeapSnapshotClassDataGridNode): (WI.HeapSnapshotClassDataGridNode.prototype._populate): * UserInterface/Views/HeapSnapshotInstanceDataGridNode.js: (WI.HeapSnapshotInstanceDataGridNode): * UserInterface/Views/ProfileDataGridNode.js: (WI.ProfileDataGridNode): (WI.ProfileDataGridNode.prototype._populate): * UserInterface/Views/ProfileNodeDataGridNode.js: (WI.ProfileNodeDataGridNode): (WI.ProfileNodeDataGridNode.prototype._populate): * UserInterface/Views/TreeOutline.js: * UserInterface/Workers/HeapSnapshot/HeapSnapshotWorker.js: (HeapSnapshotWorker.prototype.createSnapshot): Ensure that all event names are strings defined on the class `Event` object. * UserInterface/Views/Sidebar.js: (WI.Sidebar.prototype.set selectedSidebarPanel): Drive-by: fix an issue where `hidden` is called twice, once from the selected sidebar panel being changed and then again when that sidebar panel is removed. * .eslintrc: * UserInterface/Base/EventListener.js: Removed. * UserInterface/Base/EventListenerSet.js: Removed. * UserInterface/Base/LinkedList.js: Removed. * UserInterface/Base/ListMultimap.js: Removed. * UserInterface/Main.html: * UserInterface/Test.html: * UserInterface/TestStub.html: * Tools/SourceMaps/index.html: LayoutTests: * http/tests/inspector/dom/disconnect-dom-tree-after-main-frame-navigation.html: Use newly named `WI.Object.prototype.activelyListeningObjectsWithPrototype` instead of the previously named `WI.Object.prototype.retainedObjectsWithPrototype` since `WI.Object` doesn't retain any `thisObject` anymore. * inspector/debugger/setPauseOnMicrotasks.html: Only remove the event listener if it didn't fire. * inspector/dom/setEventListenerDisabled.html: No need to remove the event listener as calling `reject` after a `Promise` is already settled won't have any effect. * inspector/unit-tests/event-listener.html: Removed. * inspector/unit-tests/event-listener-expected.txt: Removed. * inspector/unit-tests/event-listener-set.html: Removed. * inspector/unit-tests/event-listener-set-expected.txt: Removed. Remove the legacy `WI.EventListener` and `WI.EventListenerSet` as they basically do the same thing as `WI.Object` with extra steps. * inspector/unit-tests/linked-list.html: Removed. * inspector/unit-tests/linked-list-expected.txt: Removed. * inspector/unit-tests/list-multimap.html: Removed. * inspector/unit-tests/list-multimap-expected.txt: Removed. Remove `LinkedList` and `ListMultimap` as they're no longer used. * platform/gtk/TestExpectations: Canonical link: https://commits.webkit.org/231203@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269359 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-11-04 11:30:05 +00:00
<script src="Base/Multimap.js"></script>
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: Canonical link: https://commits.webkit.org/166297@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188639 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-08-19 16:14:04 +00:00
<script src="Base/Object.js"></script>
Web Inspector: Hook the sampling profiler into the Timelines UI https://bugs.webkit.org/show_bug.cgi?id=152766 <rdar://problem/24066360> Reviewed by Joseph Pecoraro. Source/JavaScriptCore: This patch adds some necessary functions to SamplingProfiler::StackFrame to allow it to give data to the Inspector for the timelines UI. i.e, the sourceID of the executable of a stack frame. This patch also swaps in the SamplingProfiler in place of the LegacyProfiler inside InspectorScriptProfilerAgent. It adds the necessary protocol data to allow the SamplingProfiler's data to hook into the timelines UI. * debugger/Debugger.cpp: (JSC::Debugger::setProfilingClient): (JSC::Debugger::willEvaluateScript): (JSC::Debugger::didEvaluateScript): (JSC::Debugger::toggleBreakpoint): * debugger/Debugger.h: * debugger/ScriptProfilingScope.h: (JSC::ScriptProfilingScope::ScriptProfilingScope): (JSC::ScriptProfilingScope::~ScriptProfilingScope): * inspector/agents/InspectorScriptProfilerAgent.cpp: (Inspector::InspectorScriptProfilerAgent::willDestroyFrontendAndBackend): (Inspector::InspectorScriptProfilerAgent::startTracking): (Inspector::InspectorScriptProfilerAgent::stopTracking): (Inspector::InspectorScriptProfilerAgent::isAlreadyProfiling): (Inspector::InspectorScriptProfilerAgent::willEvaluateScript): (Inspector::InspectorScriptProfilerAgent::didEvaluateScript): (Inspector::InspectorScriptProfilerAgent::addEvent): (Inspector::buildSamples): (Inspector::InspectorScriptProfilerAgent::trackingComplete): (Inspector::buildAggregateCallInfoInspectorObject): Deleted. (Inspector::buildInspectorObject): Deleted. (Inspector::buildProfileInspectorObject): Deleted. * inspector/agents/InspectorScriptProfilerAgent.h: * inspector/protocol/ScriptProfiler.json: * jsc.cpp: (functionSamplingProfilerStackTraces): * runtime/SamplingProfiler.cpp: (JSC::SamplingProfiler::start): (JSC::SamplingProfiler::stop): (JSC::SamplingProfiler::clearData): (JSC::SamplingProfiler::StackFrame::displayName): (JSC::SamplingProfiler::StackFrame::displayNameForJSONTests): (JSC::SamplingProfiler::StackFrame::startLine): (JSC::SamplingProfiler::StackFrame::startColumn): (JSC::SamplingProfiler::StackFrame::sourceID): (JSC::SamplingProfiler::StackFrame::url): (JSC::SamplingProfiler::stackTraces): (JSC::SamplingProfiler::stackTracesAsJSON): (JSC::displayName): Deleted. (JSC::SamplingProfiler::stacktracesAsJSON): Deleted. * runtime/SamplingProfiler.h: (JSC::SamplingProfiler::StackFrame::StackFrame): (JSC::SamplingProfiler::getLock): (JSC::SamplingProfiler::setTimingInterval): (JSC::SamplingProfiler::totalTime): (JSC::SamplingProfiler::setStopWatch): (JSC::SamplingProfiler::stackTraces): Deleted. * tests/stress/sampling-profiler-anonymous-function.js: (platformSupportsSamplingProfiler.baz): (platformSupportsSamplingProfiler): * tests/stress/sampling-profiler-basic.js: (platformSupportsSamplingProfiler.nothing): (platformSupportsSamplingProfiler.top): * tests/stress/sampling-profiler/samplingProfiler.js: (doesTreeHaveStackTrace): Source/WebInspectorUI: The main change in this patch is to swap in the SamplingProfiler in place of the LegacyProfiler. To do this, we've created a data structure called CallingContextTree which aggregates the SamplingProfiler's data into an easy to manage tree. To see how the data structure works, consider the following program: ``` function bar() { // run code here for a long time. } function baz() { // run code here for a long time. } function foo() { bar(); baz(); } foo(); ``` From this program, we will create a tree like this: (program) | | foo | | / \ / \ bar baz From this type of tree, we can easily create a CPUProfile payload object. Because the Timelines UI knows how to interact with the CPUProfile object and display it, we currently map the tree to this object to make it trivially easy to display the SamplingProfiler's data. In the future, we may want to find ways to work directly with the CallingContextTree instead of mapping it into another object. * Localizations/en.lproj/localizedStrings.js: * UserInterface/Controllers/TimelineManager.js: * UserInterface/Main.html: * UserInterface/Models/CallingContextTree.js: Added. * UserInterface/Models/ScriptInstrument.js: * UserInterface/Protocol/ScriptProfilerObserver.js: * UserInterface/TestStub.html: * UserInterface/Views/ScriptTimelineView.js: LayoutTests: * inspector/sampling-profiler: Added. * inspector/sampling-profiler/basic-expected.txt: Added. * inspector/sampling-profiler/basic.html: Added. * inspector/sampling-profiler/call-frame-with-dom-functions-expected.txt: Added. * inspector/sampling-profiler/call-frame-with-dom-functions.html: Added. * inspector/sampling-profiler/eval-source-url-expected.txt: Added. * inspector/sampling-profiler/eval-source-url.html: Added. * inspector/sampling-profiler/many-call-frames-expected.txt: Added. * inspector/sampling-profiler/many-call-frames.html: Added. * inspector/sampling-profiler/named-function-expression-expected.txt: Added. * inspector/sampling-profiler/named-function-expression.html: Added. * inspector/script-profiler/event-type-API-expected.txt: * inspector/script-profiler/event-type-API.html: * inspector/script-profiler/event-type-Microtask-expected.txt: * inspector/script-profiler/event-type-Microtask.html: * inspector/script-profiler/event-type-Other-expected.txt: * inspector/script-profiler/event-type-Other.html: * inspector/script-profiler/tracking-expected.txt: * inspector/script-profiler/tracking.html: Canonical link: https://commits.webkit.org/171359@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195376 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-01-20 21:51:00 +00:00
<script src="Base/Utilities.js"></script>
<script src="Models/CallingContextTree.js"></script>
<script src="Models/CallingContextTreeNode.js"></script>
<script src="Models/WrappedPromise.js"></script>
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: Canonical link: https://commits.webkit.org/166297@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188639 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-08-19 16:14:04 +00:00
<script src="Test/TestSuite.js"></script>
<script src="Test/TestHarness.js"></script>
<script src="Test/ProtocolTestHarness.js"></script>
REGRESSION: Web Inspector: Opening inspector crashes page if there are empty resources https://bugs.webkit.org/show_bug.cgi?id=180787 <rdar://problem/35934838> Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-12-13 Reviewed by Brian Burg. Source/JavaScriptCore: * inspector/ContentSearchUtilities.cpp: (Inspector::ContentSearchUtilities::findMagicComment): For empty / null strings just return. There is no use trying to search them for a long common syntax. Source/WebInspectorUI: * UserInterface/Test/TestUtilities.js: Add a generic sanitizeURL used by many tests. * UserInterface/TestStub.html: Include TestUtilities. LayoutTests: * inspector/page/resources/empty.css: Added. * inspector/page/resources/empty.js: Added. * inspector/page/empty-or-missing-resources-expected.txt: Added. * inspector/page/empty-or-missing-resources.html: Added. Test no crashes inspecting a page with empty/missing resources. Previously the test would crash. * inspector/canvas/recording-webgl-snapshots.html: * inspector/canvas/resources/create-context-utilities.js: * inspector/canvas/resources/recording-utilities.js: * inspector/css/getAllStyleSheets.html: * inspector/css/stylesheet-events-basic.html: * inspector/css/stylesheet-events-imports.html: * inspector/css/stylesheet-events-multiple-documents.html: * inspector/worker/console-basic.html: * inspector/worker/debugger-scripts.html: * inspector/worker/resources-in-worker.html: * inspector/worker/runtime-basic.html: * inspector/worker/worker-create-and-terminate.html: Promote sanitizeURL to a TestUtility function since it is common. Canonical link: https://commits.webkit.org/196694@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225892 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-14 04:47:34 +00:00
<script src="Test/TestUtilities.js"></script>
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: Canonical link: https://commits.webkit.org/166297@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188639 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-08-19 16:14:04 +00:00
<script src="Test/InspectorProtocol.js"></script>
<script src="Test/TestStub.js"></script>
<script>
Web Inspector: add TestHarness option to tee all commands to system console https://bugs.webkit.org/show_bug.cgi?id=148181 Reviewed by Joseph Pecoraro. Source/WebCore: * inspector/InspectorFrontendHost.cpp: (WebCore::InspectorFrontendHost::unbufferedLog): Remove log prefix so output to stderr can be diffed against expected results without processing. Source/WebInspectorUI: It is currently difficult to trace what's going on when a test times out on a buildbot instance. The existing option for forcing debug logging can still drop messages that don't make it from the inspector to the test page. This patch adds an option which logs all TestHarness commands directly to stderr in the Inspector instance using InspectorFrontendHost::unbufferedLog. Clean up how existing harness logging code calls into each other. Extract the stringifying code that is duplicated everywhere. * UserInterface/Test.html: Reorganize options and add new option. * UserInterface/Test/FrontendTestHarness.js: (FrontendTestHarness.prototype.completeTest): (FrontendTestHarness.prototype.addResult): (FrontendTestHarness.prototype.debugLog): (FrontendTestHarness.prototype.testPageDidLoad): (FrontendTestHarness.prototype._resendResults): (FrontendTestHarness): * UserInterface/Test/ProtocolTestHarness.js: (ProtocolTestHarness.prototype.completeTest): (ProtocolTestHarness.prototype.addResult): (ProtocolTestHarness.prototype.debugLog): * UserInterface/Test/TestHarness.js: (TestHarness.prototype.log): (TestHarness.prototype.assert): (TestHarness.prototype.expectThat): (TestHarness.messageAsString): (TestHarness): * UserInterface/TestStub.html: Reorganize options and add new option. Canonical link: https://commits.webkit.org/166341@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188687 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-08-20 16:43:53 +00:00
// Debug logging is synchronous on the test page.
ProtocolTest.forceDebugLogging = false;
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: Canonical link: https://commits.webkit.org/166297@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188639 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-08-19 16:14:04 +00:00
Web Inspector: add TestHarness option to tee all commands to system console https://bugs.webkit.org/show_bug.cgi?id=148181 Reviewed by Joseph Pecoraro. Source/WebCore: * inspector/InspectorFrontendHost.cpp: (WebCore::InspectorFrontendHost::unbufferedLog): Remove log prefix so output to stderr can be diffed against expected results without processing. Source/WebInspectorUI: It is currently difficult to trace what's going on when a test times out on a buildbot instance. The existing option for forcing debug logging can still drop messages that don't make it from the inspector to the test page. This patch adds an option which logs all TestHarness commands directly to stderr in the Inspector instance using InspectorFrontendHost::unbufferedLog. Clean up how existing harness logging code calls into each other. Extract the stringifying code that is duplicated everywhere. * UserInterface/Test.html: Reorganize options and add new option. * UserInterface/Test/FrontendTestHarness.js: (FrontendTestHarness.prototype.completeTest): (FrontendTestHarness.prototype.addResult): (FrontendTestHarness.prototype.debugLog): (FrontendTestHarness.prototype.testPageDidLoad): (FrontendTestHarness.prototype._resendResults): (FrontendTestHarness): * UserInterface/Test/ProtocolTestHarness.js: (ProtocolTestHarness.prototype.completeTest): (ProtocolTestHarness.prototype.addResult): (ProtocolTestHarness.prototype.debugLog): * UserInterface/Test/TestHarness.js: (TestHarness.prototype.log): (TestHarness.prototype.assert): (TestHarness.prototype.expectThat): (TestHarness.messageAsString): (TestHarness): * UserInterface/TestStub.html: Reorganize options and add new option. Canonical link: https://commits.webkit.org/166341@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188687 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-08-20 16:43:53 +00:00
// Tee all TestHarness commands to stderr from within the Inspector.
ProtocolTest.dumpActivityToSystemConsole = false;
// Best used in combination with dumpActivityToSystemConsole.
Web Inspector: no need to allocate protocolErrors array for every dispatched backend command https://bugs.webkit.org/show_bug.cgi?id=146466 Reviewed by Joseph Pecoraro. Source/JavaScriptCore: Clean up some of the backend dispatcher code, with a focus on eliminating useless allocations of objects in the common case when no protocol errors happen. This is done by saving the current id of each request as it is being processed by the backend dispatcher, and tagging any subsequent errors with that id. This also means we don't have to thread the requestId except in the async command code path. This patch also lifts some common code shared between all generated backend command implementatations into the per-domain dispatch method instead. This reduces generated code size. To be consistent, this patch standardizes on calling the id of a backend message its 'requestId'. Requests can be handled synchronously or asynchronously (triggered via the 'async' property). No new tests, covered by existing protocol tests. * inspector/InspectorBackendDispatcher.cpp: (Inspector::BackendDispatcher::CallbackBase::CallbackBase): Split the two code paths for reporting success and failure. (Inspector::BackendDispatcher::CallbackBase::sendFailure): (Inspector::BackendDispatcher::CallbackBase::sendSuccess): Renamed from sendIfActive. (Inspector::BackendDispatcher::dispatch): Reset counters and current requestId before dispatching. No need to manually thread the requestId to all reportProtocolError calls. (Inspector::BackendDispatcher::hasProtocolErrors): Added. (Inspector::BackendDispatcher::sendResponse): (Inspector::BackendDispatcher::sendPendingErrors): Send any saved protocol errors to the frontend. Always send a 'data' member with all of the errors, even if there's just one. We might want to add more information about errors later. (Inspector::BackendDispatcher::reportProtocolError): Enqueue a protocol error to be sent later. (Inspector::BackendDispatcher::getPropertyValue): Remove useless type parameters and nuke most of the type conversion methods. Use std::function types instead of function pointer types. (Inspector::castToInteger): Added. (Inspector::castToNumber): Added. (Inspector::BackendDispatcher::getInteger): (Inspector::BackendDispatcher::getDouble): (Inspector::BackendDispatcher::getString): (Inspector::BackendDispatcher::getBoolean): (Inspector::BackendDispatcher::getObject): (Inspector::BackendDispatcher::getArray): (Inspector::BackendDispatcher::getValue): (Inspector::getPropertyValue): Deleted. (Inspector::AsMethodBridges::asInteger): Deleted. (Inspector::AsMethodBridges::asDouble): Deleted. (Inspector::AsMethodBridges::asString): Deleted. (Inspector::AsMethodBridges::asBoolean): Deleted. (Inspector::AsMethodBridges::asObject): Deleted. (Inspector::AsMethodBridges::asArray): Deleted. (Inspector::AsMethodBridges::asValue): Deleted. * inspector/InspectorBackendDispatcher.h: * inspector/scripts/codegen/cpp_generator_templates.py: Extract 'params' object in domain dispatch method. Omit requestIds where possible. Convert dispatch tables to use NeverDestroyed. Check the protocol error count to decide whether to abort the dispatch or not, rather than allocating our own errors array. * inspector/scripts/codegen/cpp_generator_templates.py: (void): * inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py: Revert to passing RefPtr<InspectorObject> since parameters are now being passed rather than the message object. Some commands do not require parameters. * inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py: (CppBackendDispatcherImplementationGenerator.generate_output): (CppBackendDispatcherImplementationGenerator._generate_small_dispatcher_switch_implementation_for_domain): (CppBackendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_command): * inspector/scripts/codegen/generate_objc_backend_dispatcher_header.py: (ObjCBackendDispatcherHeaderGenerator._generate_objc_handler_declaration_for_command): * inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py: (ObjCConfigurationImplementationGenerator._generate_handler_implementation_for_command): (ObjCConfigurationImplementationGenerator._generate_success_block_for_command): * inspector/scripts/codegen/objc_generator_templates.py: Rebaseline some protocol generator tests. * inspector/scripts/tests/expected/commands-with-async-attribute.json-result: * inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result: * inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result: * inspector/scripts/tests/expected/enum-values.json-result: * inspector/scripts/tests/expected/events-with-optional-parameters.json-result: * inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result: * inspector/scripts/tests/expected/same-type-id-different-domain.json-result: * inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result: * inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result: * inspector/scripts/tests/expected/type-declaration-array-type.json-result: * inspector/scripts/tests/expected/type-declaration-enum-type.json-result: * inspector/scripts/tests/expected/type-declaration-object-type.json-result: * inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result: Source/WebInspectorUI: * UserInterface/TestStub.html: Fix a typo, this property exists on ProtocolTest. LayoutTests: * inspector/protocol/backend-dispatcher-argument-errors-expected.txt: * inspector/protocol/backend-dispatcher-argument-errors.html: Stringify the 'data' member before dumping, since it now contains JSON. Rebaseline it. Canonical link: https://commits.webkit.org/166571@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188965 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-08-26 14:34:38 +00:00
ProtocolTest.dumpInspectorProtocolMessages = false;
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: Canonical link: https://commits.webkit.org/166297@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188639 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-08-19 16:14:04 +00:00
</script>
Web Inspector: implement testing harness for pure protocol tests. https://bugs.webkit.org/show_bug.cgi?id=90675 Patch by Vivek Galatage <vivekgalatage@gmail.com> on 2012-09-24 Reviewed by Yury Semikhatsky. .: Added export symbols required for Gtk+ to support the Inspector Protocol testing harness. * Source/autotools/symbols.filter: Source/WebCore: Implementing the testing harness as the APIs of Internals object not only reduced platform specific patching of DRTs but also minimized the the effort required to open up the new dummy inspector Frontend. The openDummyInspectorFrontend method will return the handle to newly created DOMWindow. This DOMWindow object can be utilized inside the test case to communicate using postMessage WebAPI. The newly created DOMWindow will host the protocol-test.html which will seed the necessary JS libraries to communicate with the InspectorBackend. Test: inspector-protocol/css-getSupportedCSSProperties.html * WebCore.exp.in: * WebCore.gypi: * inspector/InspectorClient.h: (InspectorClient): * testing/Internals.cpp: (InspectorFrontendClientDummy): (WebCore::InspectorFrontendClientDummy::~InspectorFrontendClientDummy): (WebCore): (WebCore::InspectorFrontendClientDummy::InspectorFrontendClientDummy): (InspectorFrontendChannelDummy): (WebCore::InspectorFrontendChannelDummy::~InspectorFrontendChannelDummy): (WebCore::InspectorFrontendChannelDummy::InspectorFrontendChannelDummy): (WebCore::InspectorFrontendChannelDummy::sendMessageToFrontend): (WebCore::Internals::consoleMessageArgumentCounts): (WebCore::Internals::openDummyInspectorFrontend): (WebCore::Internals::closeDummyInspectorFrontend): * testing/Internals.h: (WebCore): (Internals): * testing/Internals.idl: Source/WebKit2: Adding the export symbol definitions required on Apple Windows and WinCairo ports to support Inspector Protocol testing harness. * win/WebKit2.def: * win/WebKit2CFLite.def: LayoutTests: Adding the resources required for the dummy frontend page to load minimal frontend. These resources provide the mechanism to talk to the Inspector Backend. Adding the inspector-protocol folder to host the relevant test cases utilizing the inspector protocol test harness. Added an example test case for getting all supported CSS properties using the inspector protocol and searching for a particular property being supported. * http/tests/inspector-protocol: Added. * http/tests/inspector-protocol/resources: Added. * http/tests/inspector-protocol/resources/InspectorTest.js: Added. (InspectorTest.sendCommand): (WebInspector.dispatchMessageFromBackend): (InspectorTest.log): (InspectorTest.completeTest): * http/tests/inspector-protocol/resources/protocol-test.html: Added. * http/tests/inspector-protocol/resources/protocol-test.js: Added. (log): (closeTest): (runTest): * inspector-protocol: Added. * inspector-protocol/css-getSupportedCSSProperties-expected.txt: Added. * inspector-protocol/css-getSupportedCSSProperties.html: Added. Canonical link: https://commits.webkit.org/115380@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@129346 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-09-24 11:38:00 +00:00
</head>
</html>