<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[188598] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/188598">188598</a></dd>
<dt>Author</dt> <dd>bburg@apple.com</dd>
<dt>Date</dt> <dd>2015-08-18 14:53:23 -0700 (Tue, 18 Aug 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Web Inspector: load ProtocolTestStub from the WebInspectorUI bundle
https://bugs.webkit.org/show_bug.cgi?id=147955
Reviewed by Timothy Hatcher.
Source/WebInspectorUI:
Move ProtocolTestStub.{html,js} into the actual WebInspectorUI project.
* UserInterface/Base/TestStub.js: Renamed from LayoutTests/http/tests/inspector/resources/ProtocolTestStub.js.
* UserInterface/TestStub.html: Renamed from LayoutTests/http/tests/inspector/resources/ProtocolTestStub.html.
Tools:
To enable sharing of common test code between protocol and model tests,
start loading the protocol TestStub.js through the WebInspectorUI bundle.
This patch adds the read-only getter TestRunner.inspectorTestStubURL, which
protocol-test.js uses to load the inspector frontend stub into its iframe
from an arbitrary local file URL.
* DumpRenderTree/TestRunner.cpp:
(getInspectorTestStubURLCallback):
(TestRunner::staticValues):
* DumpRenderTree/TestRunner.h:
* DumpRenderTree/mac/TestRunnerMac.mm:
(SOFT_LINK_STAGED_FRAMEWORK):
(TestRunner::inspectorTestStubURL):
* DumpRenderTree/win/TestRunnerWin.cpp:
(TestRunner::inspectorTestStubURL):
* WebKitTestRunner/Configurations/Base.xcconfig:
Since WebKitTestRunner now includes WebCore private headers, also search
for the WebCore framework inside the WebKit umbrella framework.
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/InjectedBundle/efl/TestRunnerEfl.cpp:
(WTR::TestRunner::inspectorTestStubURL):
* WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp:
(WTR::TestRunner::inspectorTestStubURL):
* WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm:
(WTR::TestRunner::inspectorTestStubURL):
LayoutTests:
Since the inspector stub cannot open files that live in the LayoutTests
directory, adopt the test helper marshalling approach used by inspector.js.
Each helper must register its code for marshalling and explicitly put globals
on the window object.
Use script tags rather than importScript to include helpers in a test.
* TestExpectations: For now, skip inspector http tests. These should be rewritten
to use inspector-test.js, which does not run into cross-origin problems.
Rebaseline some test results to account for shifted line numbers (yuck).
* 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:
(ProtocolTestProxy.registerInitializer):
(log):
(runTest.runInitializationMethodsInFrontend):
(runTest.runTestMethodInFrontend):
(runTest):
* inspector/console/console-message.html:
* inspector/console/css-source-locations-expected.txt:
* inspector/console/css-source-locations.html:
* inspector/console/js-source-locations-expected.txt:
* inspector/console/js-source-locations.html:
* inspector/console/x-frame-options-message-expected.txt:
* inspector/console/x-frame-options-message.html:
* inspector/debugger/didSampleProbe-multiple-probes.html:
* inspector/debugger/setBreakpoint-actions.html:
* inspector/debugger/setBreakpoint-options-exception.html:
* inspector/dom/dom-search-expected.txt:
* inspector/dom/dom-search-with-context.html:
* inspector/dom/dom-search.html:
* inspector/dom/resources/dom-search-queries.js:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsTestExpectations">trunk/LayoutTests/TestExpectations</a></li>
<li><a href="#trunkLayoutTestshttptestsinspectordomresourcesInspectorDOMListenerjs">trunk/LayoutTests/http/tests/inspector/dom/resources/InspectorDOMListener.js</a></li>
<li><a href="#trunkLayoutTestshttptestsinspectorresourcesconsoletestjs">trunk/LayoutTests/http/tests/inspector/resources/console-test.js</a></li>
<li><a href="#trunkLayoutTestshttptestsinspectorresourcesprobetestjs">trunk/LayoutTests/http/tests/inspector/resources/probe-test.js</a></li>
<li><a href="#trunkLayoutTestshttptestsinspectorresourcesprotocoltestjs">trunk/LayoutTests/http/tests/inspector/resources/protocol-test.js</a></li>
<li><a href="#trunkLayoutTestsinspectorconsoleconsolemessagehtml">trunk/LayoutTests/inspector/console/console-message.html</a></li>
<li><a href="#trunkLayoutTestsinspectorconsolecsssourcelocationsexpectedtxt">trunk/LayoutTests/inspector/console/css-source-locations-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorconsolecsssourcelocationshtml">trunk/LayoutTests/inspector/console/css-source-locations.html</a></li>
<li><a href="#trunkLayoutTestsinspectorconsolejssourcelocationsexpectedtxt">trunk/LayoutTests/inspector/console/js-source-locations-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorconsolejssourcelocationshtml">trunk/LayoutTests/inspector/console/js-source-locations.html</a></li>
<li><a href="#trunkLayoutTestsinspectorconsolexframeoptionsmessageexpectedtxt">trunk/LayoutTests/inspector/console/x-frame-options-message-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorconsolexframeoptionsmessagehtml">trunk/LayoutTests/inspector/console/x-frame-options-message.html</a></li>
<li><a href="#trunkLayoutTestsinspectordebuggerdidSampleProbemultipleprobeshtml">trunk/LayoutTests/inspector/debugger/didSampleProbe-multiple-probes.html</a></li>
<li><a href="#trunkLayoutTestsinspectordebuggersetBreakpointactionshtml">trunk/LayoutTests/inspector/debugger/setBreakpoint-actions.html</a></li>
<li><a href="#trunkLayoutTestsinspectordebuggersetBreakpointoptionsexceptionhtml">trunk/LayoutTests/inspector/debugger/setBreakpoint-options-exception.html</a></li>
<li><a href="#trunkLayoutTestsinspectordomdomsearchexpectedtxt">trunk/LayoutTests/inspector/dom/dom-search-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectordomdomsearchwithcontexthtml">trunk/LayoutTests/inspector/dom/dom-search-with-context.html</a></li>
<li><a href="#trunkLayoutTestsinspectordomdomsearchhtml">trunk/LayoutTests/inspector/dom/dom-search.html</a></li>
<li><a href="#trunkLayoutTestsinspectordomresourcesdomsearchqueriesjs">trunk/LayoutTests/inspector/dom/resources/dom-search-queries.js</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreeTestRunnercpp">trunk/Tools/DumpRenderTree/TestRunner.cpp</a></li>
<li><a href="#trunkToolsDumpRenderTreeTestRunnerh">trunk/Tools/DumpRenderTree/TestRunner.h</a></li>
<li><a href="#trunkToolsDumpRenderTreemacTestRunnerMacmm">trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm</a></li>
<li><a href="#trunkToolsDumpRenderTreewinTestRunnerWincpp">trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerConfigurationsBasexcconfig">trunk/Tools/WebKitTestRunner/Configurations/Base.xcconfig</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleBindingsTestRunneridl">trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleTestRunnerh">trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleeflTestRunnerEflcpp">trunk/Tools/WebKitTestRunner/InjectedBundle/efl/TestRunnerEfl.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundlegtkTestRunnerGtkcpp">trunk/Tools/WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundlemacTestRunnerMacmm">trunk/Tools/WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceBaseTestStubjs">trunk/Source/WebInspectorUI/UserInterface/Base/TestStub.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTestStubhtml">trunk/Source/WebInspectorUI/UserInterface/TestStub.html</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestsinspectorresourcesProtocolTestStubhtml">trunk/LayoutTests/http/tests/inspector/resources/ProtocolTestStub.html</a></li>
<li><a href="#trunkLayoutTestshttptestsinspectorresourcesProtocolTestStubjs">trunk/LayoutTests/http/tests/inspector/resources/ProtocolTestStub.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/LayoutTests/ChangeLog        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -1,3 +1,46 @@
</span><ins>+2015-08-18 Brian Burg <bburg@apple.com>
+
+ Web Inspector: load ProtocolTestStub from the WebInspectorUI bundle
+ https://bugs.webkit.org/show_bug.cgi?id=147955
+
+ Reviewed by Timothy Hatcher.
+
+ Since the inspector stub cannot open files that live in the LayoutTests
+ directory, adopt the test helper marshalling approach used by inspector.js.
+ Each helper must register its code for marshalling and explicitly put globals
+ on the window object.
+
+ Use script tags rather than importScript to include helpers in a test.
+
+ * TestExpectations: For now, skip inspector http tests. These should be rewritten
+ to use inspector-test.js, which does not run into cross-origin problems.
+
+ Rebaseline some test results to account for shifted line numbers (yuck).
+
+ * 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:
+ (ProtocolTestProxy.registerInitializer):
+ (log):
+ (runTest.runInitializationMethodsInFrontend):
+ (runTest.runTestMethodInFrontend):
+ (runTest):
+ * inspector/console/console-message.html:
+ * inspector/console/css-source-locations-expected.txt:
+ * inspector/console/css-source-locations.html:
+ * inspector/console/js-source-locations-expected.txt:
+ * inspector/console/js-source-locations.html:
+ * inspector/console/x-frame-options-message-expected.txt:
+ * inspector/console/x-frame-options-message.html:
+ * inspector/debugger/didSampleProbe-multiple-probes.html:
+ * inspector/debugger/setBreakpoint-actions.html:
+ * inspector/debugger/setBreakpoint-options-exception.html:
+ * inspector/dom/dom-search-expected.txt:
+ * inspector/dom/dom-search-with-context.html:
+ * inspector/dom/dom-search.html:
+ * inspector/dom/resources/dom-search-queries.js:
+
</ins><span class="cx"> 2015-08-18 Myles C. Maxfield <mmaxfield@apple.com>
</span><span class="cx">
</span><span class="cx"> [Win] Test gardening after r188591
</span></span></pre></div>
<a id="trunkLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/TestExpectations (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/TestExpectations        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/LayoutTests/TestExpectations        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -94,6 +94,9 @@
</span><span class="cx">
</span><span class="cx"> webkit.org/b/129057 media/controls-styling-strict.html [ Pass Failure ]
</span><span class="cx">
</span><ins>+# These tests will be rewritten, just skip them until that time.
+webkit.org/b/148036 http/tests/inspector/ [ Skip ]
+
</ins><span class="cx"> webkit.org/b/129639 inspector/dom/dom-search-crash.html [ Skip ]
</span><span class="cx">
</span><span class="cx"> webkit.org/b/133761 inspector/debugger/breakpoint-action-detach.html [ Skip ]
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsinspectordomresourcesInspectorDOMListenerjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/inspector/dom/resources/InspectorDOMListener.js (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/inspector/dom/resources/InspectorDOMListener.js        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/LayoutTests/http/tests/inspector/dom/resources/InspectorDOMListener.js        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -27,7 +27,9 @@
</span><span class="cx"> * SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-function createDOMListener()
</del><ins>+ProtocolTestProxy.registerInitializer(function(){
+
+window.createDOMListener = function()
</ins><span class="cx"> {
</span><span class="cx"> var nodesById = {};
</span><span class="cx">
</span><span class="lines">@@ -101,3 +103,5 @@
</span><span class="cx"> collectNode: collectNode
</span><span class="cx"> };
</span><span class="cx"> }
</span><ins>+
+});
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsinspectorresourcesProtocolTestStubhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/http/tests/inspector/resources/ProtocolTestStub.html (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/inspector/resources/ProtocolTestStub.html        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/LayoutTests/http/tests/inspector/resources/ProtocolTestStub.html        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -1,30 +0,0 @@
</span><del>-<!--
-Copyright (C) 2012 Samsung Electronics. All rights reserved.
-Copyright (C) 2015 Apple Inc. All rights reserved.
-
-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.
--->
-<html>
-<head>
- <script type="text/javascript" src="ProtocolTestStub.js"></script>
-</head>
-</html>
</del></span></pre></div>
<a id="trunkLayoutTestshttptestsinspectorresourcesProtocolTestStubjs"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/http/tests/inspector/resources/ProtocolTestStub.js (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/inspector/resources/ProtocolTestStub.js        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/LayoutTests/http/tests/inspector/resources/ProtocolTestStub.js        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -1,498 +0,0 @@
</span><del>-/*
- * Copyright (C) 2012 Samsung Electronics. All rights reserved.
- * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
- *
- * 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.
- */
-InspectorFrontendAPI = {};
-
-InjectedTestHarness = class InjectedTestHarness
-{
- constructor()
- {
- this._logCount = 0;
- this.forceSyncDebugLogging = false;
- }
-
- completeTest()
- {
- throw new Error("Must be implemented by subclasses.");
- }
-
- addResult()
- {
- throw new Error("Must be implemented by subclasses.");
- }
-
- debugLog()
- {
- throw new Error("Must be implemented by subclasses.");
- }
-
- evaluateInPage(string, callback)
- {
- throw new Error("Must be implemented by subclasses.");
- }
-
- createAsyncSuite(name)
- {
- return new InjectedTestHarness.AsyncTestSuite(this, name);
- }
-
- createSyncSuite(name)
- {
- return new InjectedTestHarness.SyncTestSuite(this, name);
- }
-
- importScript(scriptName)
- {
- var xhr = new XMLHttpRequest();
- var isAsyncRequest = false;
- xhr.open("GET", scriptName, isAsyncRequest);
- xhr.send(null);
- if (xhr.status !== 0 && xhr.status !== 200)
- throw new Error("Invalid script URL: " + scriptName);
- var script = `// From InjectedTestHarness.importScript(${scriptName})
-try {
- ${xhr.responseText}
-} catch (e) {
- alert(${JSON.stringify("Error in: " + scriptName)});
- throw e;
-}`;
- window.eval(script);
- }
-
- get logCount()
- {
- return this._logCount;
- }
-
- log(message)
- {
- ++this._logCount;
-
- if (this.forceSyncDebugLogging)
- this.debugLog(message);
- else
- this.addResult(message);
- }
-
- assert(condition, message)
- {
- if (condition)
- return;
-
- let stringifiedMessage = typeof message !== "object" ? message : JSON.stringify(message);
- this.addResult("ASSERT: " + stringifiedMessage);
- }
-
- expectThat(condition, message)
- {
- let prefix = condition ? "PASS" : "FAIL";
- let stringifiedMessage = typeof message !== "object" ? message : JSON.stringify(message);
- this.addResult(prefix + ": " + stringifiedMessage);
- }
-}
-
-InjectedTestHarness.AsyncTestSuite = class AsyncTestSuite
-{
- constructor(harness, name) {
- if (!(harness instanceof InjectedTestHarness))
- throw new Error("Must pass the test's harness as the first argument.");
-
- if (!name || typeof name !== "string")
- throw new Error("Tried to create AsyncTestSuite without string suite name.");
-
- this.name = name;
- this._harness = harness;
-
- this.testcases = [];
- this.runCount = 0;
- this.failCount = 0;
- }
-
- get passCount()
- {
- return this.runCount - this.failCount;
- }
-
- get skipCount()
- {
- if (this.failCount)
- return this.testcases.length - this.runCount;
- else
- return 0;
- }
-
- addTestCase(testcase)
- {
- if (!testcase || !(testcase instanceof Object))
- throw new Error("Tried to add non-object test case.");
-
- if (typeof testcase.name !== "string")
- throw new Error("Tried to add test case without a name.");
-
- if (typeof testcase.test !== "function")
- throw new Error("Tried to add test case without `test` function.");
-
- this.testcases.push(testcase);
- }
-
- // Use this if the test file only has one suite, and no handling
- // of the promise returned by runTestCases() is needed.
- runTestCasesAndFinish()
- {
- function finish() {
- this._harness.completeTest();
- }
-
- this.runTestCases()
- .then(finish.bind(this))
- .catch(finish.bind(this));
- }
-
- runTestCases()
- {
- if (!this.testcases.length)
- throw new Error("Tried to call runTestCases() for suite with no test cases");
- if (this._startedRunning)
- throw new Error("Tried to call runTestCases() more than once.");
-
- this._startedRunning = true;
-
- this._harness.log("");
- this._harness.log("== Running test suite: " + this.name);
-
- // Avoid adding newlines if nothing was logged.
- var priorLogCount = this._harness.logCount;
- var suite = this;
- var result = this.testcases.reduce(function(chain, testcase, i) {
- return chain.then(function() {
- if (i > 0 && priorLogCount + 1 < suite._harness.logCount)
- suite._harness.log("");
-
- priorLogCount = suite._harness.logCount;
- suite._harness.log("-- Running test case: " + testcase.name);
- suite.runCount++;
- return new Promise(testcase.test);
- });
- }, Promise.resolve());
-
- return result.catch(function(e) {
- suite.failCount++;
- var message = e;
- if (e instanceof Error)
- message = e.message;
-
- if (typeof message !== "string")
- message = JSON.stringify(message);
-
- suite._harness.log("!! EXCEPTION: " + message);
- throw e; // Reject this promise by re-throwing the error.
- });
- }
-}
-
-InjectedTestHarness.SyncTestSuite = class SyncTestSuite
-{
- constructor(harness, name) {
- if (!(harness instanceof InjectedTestHarness))
- throw new Error("Must pass the test's harness as the first argument.");
-
- if (!name || typeof name !== "string")
- throw new Error("Tried to create SyncTestSuite without string suite name.");
-
- this.name = name;
- this._harness = harness;
-
- this.testcases = [];
- this.runCount = 0;
- this.failCount = 0;
- }
-
- get passCount()
- {
- return this.runCount - this.failCount;
- }
-
- get skipCount()
- {
- if (this.failCount)
- return this.testcases.length - this.runCount;
- else
- return 0;
- }
-
- addTestCase(testcase)
- {
- if (!testcase || !(testcase instanceof Object))
- throw new Error("Tried to add non-object test case.");
-
- if (typeof testcase.name !== "string")
- throw new Error("Tried to add test case without a name.");
-
- if (typeof testcase.test !== "function")
- throw new Error("Tried to add test case without `test` function.");
-
- this.testcases.push(testcase);
- }
-
- // Use this if the test file only has one suite.
- runTestCasesAndFinish()
- {
- this.runTestCases();
- this._harness.completeTest();
- }
-
- runTestCases()
- {
- if (!this.testcases.length)
- throw new Error("Tried to call runTestCases() for suite with no test cases");
- if (this._startedRunning)
- throw new Error("Tried to call runTestCases() more than once.");
-
- this._startedRunning = true;
-
- this._harness.log("");
- this._harness.log("== Running test suite: " + this.name);
-
- var priorLogCount = this._harness.logCount;
- var suite = this;
- for (var i = 0; i < this.testcases.length; i++) {
- var testcase = this.testcases[i];
- if (i > 0 && priorLogCount + 1 < this._harness.logCount)
- this._harness.log("");
-
- priorLogCount = this._harness.logCount;
-
- this._harness.log("-- Running test case: " + testcase.name);
- suite.runCount++;
- try {
- var result = testcase.test.call(null);
- if (result === false) {
- suite.failCount++;
- return false;
- }
- } catch (e) {
- suite.failCount++;
- var message = e;
- if (e instanceof Error)
- message = e.message;
- else
- e = new Error(e);
-
- if (typeof message !== "string")
- message = JSON.stringify(message);
-
- this._harness.log("!! EXCEPTION: " + message);
- return false;
- }
- }
-
- return true;
- }
-}
-
-class ProtocolTestHarness extends InjectedTestHarness
-{
- // InjectedTestHarness Overrides
-
- completeTest()
- {
- this.evaluateInPage("closeTest();");
- }
-
- addResult(message)
- {
- // Unfortunately, every string argument must be escaped because tests are not consistent
- // with respect to escaping with single or double quotes. Some exceptions use single quotes.
- var stringifiedMessage = typeof message !== "string" ? JSON.stringify(message) : message;
- this.evaluateInPage("log(unescape('" + escape(stringifiedMessage) + "'));");
- }
-
- debugLog(message)
- {
- var stringifiedMessage = typeof message !== "string" ? JSON.stringify(message) : message;
- this.evaluateInPage("debugLog(unescape('" + escape(stringifiedMessage) + "'));")
- }
-
- evaluateInPage(expression, callback)
- {
- let args = {
- method: "Runtime.evaluate",
- params: {expression}
- }
-
- if (typeof callback === "function")
- InspectorProtocol.sendCommand(args, callback);
- else
- return InspectorProtocol.awaitCommand(args);
- }
-}
-
-window.ProtocolTest = new ProtocolTestHarness();
-
-InspectorProtocol = {};
-InspectorProtocol._dispatchTable = [];
-InspectorProtocol._requestId = -1;
-InspectorProtocol.eventHandler = {};
-
-InspectorProtocol.dumpInspectorProtocolMessages = false;
-
-InspectorProtocol.sendCommand = function(methodOrObject, params, handler)
-{
- // Allow new-style arguments object, as in awaitCommand.
- var method = methodOrObject;
- if (typeof methodOrObject === "object")
- var {method, params, handler} = methodOrObject;
-
- this._dispatchTable[++this._requestId] = handler;
- var messageObject = {method, params, "id": this._requestId};
- this.sendMessage(messageObject);
-
- return this._requestId;
-}
-
-InspectorProtocol.awaitCommand = function(args)
-{
- var {method, params} = args;
- return new Promise(function(resolve, reject) {
- this._dispatchTable[++this._requestId] = {resolve, reject};
- var messageObject = {method, params, "id": this._requestId};
- this.sendMessage(messageObject);
- }.bind(this));
-}
-
-InspectorProtocol.awaitEvent = function(args)
-{
- var {event} = args;
- if (typeof event !== "string")
- throw new Error("Event must be a string.");
-
- return new Promise(function(resolve, reject) {
- InspectorProtocol.eventHandler[event] = function(message) {
- InspectorProtocol.eventHandler[event] = undefined;
- resolve(message);
- }
- });
-}
-
-InspectorProtocol.addEventListener = function(eventTypeOrObject, listener)
-{
- var event = eventTypeOrObject;
- if (typeof eventTypeOrObject === "object")
- var {event, listener} = eventTypeOrObject;
-
- if (typeof event !== "string")
- throw new Error("Event name must be a string.");
-
- if (typeof listener !== "function")
- throw new Error("Event listener must be callable.");
-
- // Convert to an array of listeners.
- var listeners = InspectorProtocol.eventHandler[event];
- if (!listeners)
- listeners = InspectorProtocol.eventHandler[event] = [];
- else if (typeof listeners === "function")
- listeners = InspectorProtocol.eventHandler[event] = [listeners];
-
- // Prevent registering multiple times.
- if (listeners.includes(listener))
- throw new Error("Cannot register the same listener more than once.");
-
- listeners.push(listener);
-}
-
-InspectorProtocol.sendMessage = function(messageObject)
-{
- // This matches the debug dumping in InspectorBackend, which is bypassed
- // by InspectorProtocol. Return messages should be dumped by InspectorBackend.
- if (InspectorProtocol.dumpInspectorProtocolMessages)
- console.log("frontend: " + JSON.stringify(messageObject));
-
- InspectorFrontendHost.sendMessageToBackend(JSON.stringify(messageObject));
-}
-
-InspectorProtocol.checkForError = function(responseObject)
-{
- if (responseObject.error) {
- ProtocolTest.log("PROTOCOL ERROR: " + JSON.stringify(responseObject.error));
- ProtocolTest.completeTest();
- throw "PROTOCOL ERROR";
- }
-}
-
-InspectorFrontendAPI.dispatchMessageAsync = function(messageObject)
-{
- // This matches the debug dumping in InspectorBackend, which is bypassed
- // by InspectorProtocol. Return messages should be dumped by InspectorBackend.
- if (InspectorProtocol.dumpInspectorProtocolMessages)
- console.log("backend: " + JSON.stringify(messageObject));
-
- // If the message has an id, then it is a reply to a command.
- var messageId = messageObject["id"];
- if (typeof messageId === "number") {
- var handler = InspectorProtocol._dispatchTable[messageId];
- if (!handler)
- return;
-
- if (typeof handler === "function")
- handler(messageObject);
- else if (typeof handler === "object") {
- var {resolve, reject} = handler;
- if ("error" in messageObject)
- reject(messageObject.error.message);
- else
- resolve(messageObject.result);
- }
- // Otherwise, it is an event.
- } else {
- var eventName = messageObject["method"];
- var handler = InspectorProtocol.eventHandler[eventName];
- if (!handler)
- return;
-
- if (typeof handler === "function")
- handler(messageObject);
- else if (handler instanceof Array) {
- handler.map(function(listener) {
- listener.call(null, messageObject);
- });
- } else if (typeof handler === "object") {
- var {resolve, reject} = handler;
- if ("error" in messageObject)
- reject(messageObject.error.message);
- else
- resolve(messageObject.result);
- }
- }
-}
-
-window.addEventListener("message", function(event) {
- try {
- eval(event.data);
- } catch (e) {
- alert(e.stack);
- ProtocolTest.completeTest();
- throw e;
- }
-});
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsinspectorresourcesconsoletestjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/inspector/resources/console-test.js (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/inspector/resources/console-test.js        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/LayoutTests/http/tests/inspector/resources/console-test.js        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -1,3 +1,5 @@
</span><ins>+ProtocolTestProxy.registerInitializer(function() {
+
</ins><span class="cx"> ProtocolTest.Console = {};
</span><span class="cx">
</span><span class="cx"> ProtocolTest.Console.sanitizeConsoleMessage = function(messageObject)
</span><span class="lines">@@ -73,3 +75,5 @@
</span><span class="cx"> }
</span><span class="cx"> });
</span><span class="cx"> }
</span><ins>+
+});
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsinspectorresourcesprobetestjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/inspector/resources/probe-test.js (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/inspector/resources/probe-test.js        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/LayoutTests/http/tests/inspector/resources/probe-test.js        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -1,3 +1,5 @@
</span><ins>+ProtocolTestProxy.registerInitializer(function() {
+
</ins><span class="cx"> ProtocolTest.Probe = {};
</span><span class="cx">
</span><span class="cx"> ProtocolTest.Probe.sanitizeProbeSample = function(messageObject)
</span><span class="lines">@@ -125,3 +127,5 @@
</span><span class="cx"> InspectorTest.log("Probe set's probe count: " + probeSet.probes.length);
</span><span class="cx"> });
</span><span class="cx"> }
</span><ins>+
+});
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsinspectorresourcesprotocoltestjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/inspector/resources/protocol-test.js (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/inspector/resources/protocol-test.js        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/LayoutTests/http/tests/inspector/resources/protocol-test.js        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -23,8 +23,22 @@
</span><span class="cx"> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
</span><span class="cx"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><del>-var outputElement;
</del><span class="cx">
</span><ins>+// This namespace is injected into every test page. Its functions are invoked by
+// ProtocolTest methods on the inspector page via InjectedTestHarness.
+ProtocolTestProxy = {};
+ProtocolTestProxy._initializers = [];
+
+// Helper scripts like `console-test.js` must register their initialization
+// function with this method so it will be marshalled to the inspector page.
+ProtocolTestProxy.registerInitializer = function(initializer)
+{
+ if (typeof initializer === "function")
+ this._initializers.push(initializer.toString());
+}
+
+let outputElement;
+
</ins><span class="cx"> /**
</span><span class="cx"> * Logs message to process stdout via alert (hopefully implemented with immediate flush).
</span><span class="cx"> * @param {string} text
</span><span class="lines">@@ -40,10 +54,10 @@
</span><span class="cx"> function log(text)
</span><span class="cx"> {
</span><span class="cx"> if (!outputElement) {
</span><del>- var intermediate = document.createElement("div");
</del><ins>+ let intermediate = document.createElement("div");
</ins><span class="cx"> document.body.appendChild(intermediate);
</span><span class="cx">
</span><del>- var intermediate2 = document.createElement("div");
</del><ins>+ let intermediate2 = document.createElement("div");
</ins><span class="cx"> intermediate.appendChild(intermediate2);
</span><span class="cx">
</span><span class="cx"> outputElement = document.createElement("div");
</span><span class="lines">@@ -77,27 +91,46 @@
</span><span class="cx"> testRunner.waitUntilDone();
</span><span class="cx"> testRunner.setCanOpenWindows(true);
</span><span class="cx">
</span><del>- var scriptTags = document.getElementsByTagName("script");
- var scriptUrlBasePath = "";
- for (var i = 0; i < scriptTags.length; ++i) {
- var index = scriptTags[i].src.lastIndexOf("/protocol-test.js");
- if (index > -1 ) {
- scriptUrlBasePath = scriptTags[i].src.slice(0, index);
- break;
</del><ins>+ let testFunction = window.test;
+ if (!(typeof testFunction === "function")) {
+ alert("Failed to send test() because it is not a function.");
+ testRunner.notifyDone();
+ }
+
+ let url = testRunner.inspectorTestStubURL;
+ if (!url) {
+ alert("Failed to obtain inspector test stub URL.");
+ testRunner.notifyDone();
+ }
+
+ function runInitializationMethodsInFrontend(initializers)
+ {
+ for (let initializer of initializers) {
+ try {
+ initializer();
+ } catch (e) {
+ ProtocolTest.log("Exception in test initialization: " + e, e.stack || "(no stack trace)");
+ ProtocolTest.completeTest();
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- var url = scriptUrlBasePath + "/ProtocolTestStub.html";
- var inspectorFrontend = window.internals.openDummyInspectorFrontend(url);
</del><ins>+ function runTestMethodInFrontend(testFunction)
+ {
+ try {
+ testFunction();
+ } catch (e) {
+ ProtocolTest.log("Exception during test execution: " + e, e.stack || "(no stack trace)");
+ ProtocolTest.completeTest();
+ }
+ }
+
+ let inspectorFrontend = window.internals.openDummyInspectorFrontend(url);
</ins><span class="cx"> inspectorFrontend.addEventListener("load", function(event) {
</span><del>- // FIXME: rename this 'test' global field across all tests.
- var testFunction = window.test;
- if (typeof testFunction === "function") {
- inspectorFrontend.postMessage("(" + testFunction.toString() +")();", "*");
- return;
- }
- // Kill waiting process if failed to send.
- alert("Failed to send test function");
- testRunner.notifyDone();
</del><ins>+ let initializationCodeString = `(${runInitializationMethodsInFrontend.toString()})([${ProtocolTestProxy._initializers}]);`;
+ let testFunctionCodeString = `(${runTestMethodInFrontend.toString()})(${testFunction.toString()});`;
+
+ inspectorFrontend.postMessage(initializationCodeString, "*");
+ inspectorFrontend.postMessage(testFunctionCodeString, "*");
</ins><span class="cx"> });
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorconsoleconsolemessagehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/console/console-message.html (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/console/console-message.html        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/LayoutTests/inspector/console/console-message.html        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -2,6 +2,7 @@
</span><span class="cx"> <html>
</span><span class="cx"> <head>
</span><span class="cx"> <script src="../../http/tests/inspector/resources/protocol-test.js"></script>
</span><ins>+<script src="../../http/tests/inspector/resources/console-test.js"></script>
</ins><span class="cx"> <script>
</span><span class="cx"> function generateSimpleConsoleMessages()
</span><span class="cx"> {
</span><span class="lines">@@ -14,7 +15,6 @@
</span><span class="cx">
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><del>- ProtocolTest.importScript("console-test.js");
</del><span class="cx">
</span><span class="cx"> var suite = ProtocolTest.createAsyncSuite("Console.MessagesFromCommandLineAPI");
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorconsolecsssourcelocationsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/console/css-source-locations-expected.txt (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/console/css-source-locations-expected.txt        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/LayoutTests/inspector/console/css-source-locations-expected.txt        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -1,8 +1,8 @@
</span><span class="cx"> Tests that CSS parser warnings from inline style tags and external stylesheets are sent to the console with correct line and column information.
</span><del>-{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:6:20"}
-{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:7:14"}
-{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:8:7"}
-{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:10:8"}
</del><ins>+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:7:20"}
+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:8:14"}
+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:9:7"}
+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:11:8"}
</ins><span class="cx"> {"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"errors.css:1:7"}
</span><span class="cx"> {"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"errors.css:1:29"}
</span><span class="cx"> {"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"errors.css:4:5"}
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorconsolecsssourcelocationshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/console/css-source-locations.html (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/console/css-source-locations.html        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/LayoutTests/inspector/console/css-source-locations.html        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -2,6 +2,7 @@
</span><span class="cx"> <html>
</span><span class="cx"> <head>
</span><span class="cx"> <script src="../../http/tests/inspector/resources/protocol-test.js"></script>
</span><ins>+<script src="../../http/tests/inspector/resources/console-test.js"></script>
</ins><span class="cx"> <link rel="stylesheet" href="resources/errors.css">
</span><span class="cx"> <style> div { * color: red; }</style>
</span><span class="cx"> <style>div { * color: red; }
</span><span class="lines">@@ -15,8 +16,6 @@
</span><span class="cx"> <script>
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><del>- ProtocolTest.importScript("console-test.js");
-
</del><span class="cx"> var consoleMessageCount = 0;
</span><span class="cx"> const expectedConsoleMessageCount = 7;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorconsolejssourcelocationsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/console/js-source-locations-expected.txt (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/console/js-source-locations-expected.txt        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/LayoutTests/inspector/console/js-source-locations-expected.txt        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -2,17 +2,17 @@
</span><span class="cx"> CONSOLE MESSAGE: line 1: warn script
</span><span class="cx"> CONSOLE MESSAGE: line 5: error script
</span><span class="cx"> CONSOLE MESSAGE: line 6: warn script
</span><del>-CONSOLE MESSAGE: line 6: TypeError: undefined is not an object (evaluating '[].x.x')
-CONSOLE MESSAGE: line 8: warn 1
-CONSOLE MESSAGE: line 8: error 1
-CONSOLE MESSAGE: line 9: error 2
</del><ins>+CONSOLE MESSAGE: line 7: TypeError: undefined is not an object (evaluating '[].x.x')
+CONSOLE MESSAGE: line 9: warn 1
+CONSOLE MESSAGE: line 9: error 1
+CONSOLE MESSAGE: line 10: error 2
</ins><span class="cx"> Tests that JavaScript errors and warnings from inline script tags and external files are sent to the console with correct line and column information.
</span><span class="cx"> {"source":"console-api","level":"error","text":"error script","location":"errors.js:1:14","parameters":[{"type":"string"}]}
</span><span class="cx"> {"source":"console-api","level":"warning","text":"warn script","location":"errors.js:1:44","parameters":[{"type":"string"}]}
</span><span class="cx"> {"source":"console-api","level":"error","text":"error script","location":"errors.js:5:18","parameters":[{"type":"string"}]}
</span><span class="cx"> {"source":"console-api","level":"warning","text":"warn script","location":"errors.js:6:17","parameters":[{"type":"string"}]}
</span><del>-{"source":"javascript","level":"error","text":"TypeError: undefined is not an object (evaluating '[].x.x')","location":"js-source-locations.html:6:18"}
-{"source":"console-api","level":"warning","text":"warn 1","location":"js-source-locations.html:8:13","parameters":[{"type":"string"}]}
-{"source":"console-api","level":"error","text":"error 1","location":"js-source-locations.html:8:38","parameters":[{"type":"string"}]}
-{"source":"console-api","level":"error","text":"error 2","location":"js-source-locations.html:9:17","parameters":[{"type":"string"}]}
</del><ins>+{"source":"javascript","level":"error","text":"TypeError: undefined is not an object (evaluating '[].x.x')","location":"js-source-locations.html:7:18"}
+{"source":"console-api","level":"warning","text":"warn 1","location":"js-source-locations.html:9:13","parameters":[{"type":"string"}]}
+{"source":"console-api","level":"error","text":"error 1","location":"js-source-locations.html:9:38","parameters":[{"type":"string"}]}
+{"source":"console-api","level":"error","text":"error 2","location":"js-source-locations.html:10:17","parameters":[{"type":"string"}]}
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorconsolejssourcelocationshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/console/js-source-locations.html (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/console/js-source-locations.html        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/LayoutTests/inspector/console/js-source-locations.html        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -2,6 +2,7 @@
</span><span class="cx"> <html>
</span><span class="cx"> <head>
</span><span class="cx"> <script src="../../http/tests/inspector/resources/protocol-test.js"></script>
</span><ins>+<script src="../../http/tests/inspector/resources/console-test.js"></script>
</ins><span class="cx"> <script src="resources/errors.js"></script>
</span><span class="cx"> <script> [].x.x </script>
</span><span class="cx"> <script>
</span><span class="lines">@@ -11,8 +12,6 @@
</span><span class="cx"> <script>
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><del>- ProtocolTest.importScript("console-test.js");
-
</del><span class="cx"> var consoleMessageCount = 0;
</span><span class="cx"> const expectedConsoleMessageCount = 8;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorconsolexframeoptionsmessageexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/console/x-frame-options-message-expected.txt (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/console/x-frame-options-message-expected.txt        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/LayoutTests/inspector/console/x-frame-options-message-expected.txt        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-CONSOLE MESSAGE: line 42: Refused to display 'x-frame-options-message.html' in a frame because it set 'X-Frame-Options' to 'deny'.
</del><ins>+CONSOLE MESSAGE: line 41: Refused to display 'x-frame-options-message.html' in a frame because it set 'X-Frame-Options' to 'deny'.
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> == Running test suite: Console.XFrameOptionsMessages
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorconsolexframeoptionsmessagehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/console/x-frame-options-message.html (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/console/x-frame-options-message.html        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/LayoutTests/inspector/console/x-frame-options-message.html        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -2,11 +2,10 @@
</span><span class="cx"> <html>
</span><span class="cx"> <head>
</span><span class="cx"> <script src="../../http/tests/inspector/resources/protocol-test.js"></script>
</span><ins>+<script src="../../http/tests/inspector/resources/console-test.js"></script>
</ins><span class="cx"> <script>
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><del>- ProtocolTest.importScript("console-test.js");
-
</del><span class="cx"> let suite = ProtocolTest.createAsyncSuite("Console.XFrameOptionsMessages");
</span><span class="cx">
</span><span class="cx"> ProtocolTest.Console.addTestCase(suite, {
</span></span></pre></div>
<a id="trunkLayoutTestsinspectordebuggerdidSampleProbemultipleprobeshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/debugger/didSampleProbe-multiple-probes.html (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/debugger/didSampleProbe-multiple-probes.html        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/LayoutTests/inspector/debugger/didSampleProbe-multiple-probes.html        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -1,12 +1,11 @@
</span><span class="cx"> <html>
</span><span class="cx"> <head>
</span><span class="cx"> <script src="../../http/tests/inspector/resources/protocol-test.js"></script>
</span><ins>+<script src="../../http/tests/inspector/resources/probe-test.js"></script>
</ins><span class="cx"> <script src="resources/breakpoint.js"></script>
</span><span class="cx"> <script>
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><del>- ProtocolTest.importScript("probe-test.js");
-
</del><span class="cx"> InspectorProtocol.sendCommand("Debugger.enable", {});
</span><span class="cx">
</span><span class="cx"> var samples = [];
</span></span></pre></div>
<a id="trunkLayoutTestsinspectordebuggersetBreakpointactionshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/debugger/setBreakpoint-actions.html (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/debugger/setBreakpoint-actions.html        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/LayoutTests/inspector/debugger/setBreakpoint-actions.html        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -1,13 +1,12 @@
</span><span class="cx"> <html>
</span><span class="cx"> <head>
</span><span class="cx"> <script src="../../http/tests/inspector/resources/protocol-test.js"></script>
</span><ins>+<script src="../../http/tests/inspector/resources/console-test.js"></script>
+<script src="../../http/tests/inspector/resources/probe-test.js"></script>
</ins><span class="cx"> <script src="resources/breakpoint.js"></script>
</span><span class="cx"> <script>
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><del>- ProtocolTest.importScript("console-test.js");
- ProtocolTest.importScript("probe-test.js");
-
</del><span class="cx"> InspectorProtocol.sendCommand("Console.enable", {});
</span><span class="cx"> InspectorProtocol.sendCommand("Debugger.enable", {});
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsinspectordebuggersetBreakpointoptionsexceptionhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/debugger/setBreakpoint-options-exception.html (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/debugger/setBreakpoint-options-exception.html        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/LayoutTests/inspector/debugger/setBreakpoint-options-exception.html        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -1,12 +1,11 @@
</span><span class="cx"> <html>
</span><span class="cx"> <head>
</span><span class="cx"> <script src="../../http/tests/inspector/resources/protocol-test.js"></script>
</span><ins>+<script src="../../http/tests/inspector/resources/console-test.js"></script>
</ins><span class="cx"> <script src="resources/breakpoint.js"></script>
</span><span class="cx"> <script>
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><del>- ProtocolTest.importScript("console-test.js");
-
</del><span class="cx"> InspectorProtocol.sendCommand("Console.enable", {});
</span><span class="cx"> InspectorProtocol.sendCommand("Debugger.enable", {});
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsinspectordomdomsearchexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/dom/dom-search-expected.txt (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/dom/dom-search-expected.txt        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/LayoutTests/inspector/dom/dom-search-expected.txt        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -48,11 +48,13 @@
</span><span class="cx"> === Query: ".body-inside-iframe" ===
</span><span class="cx"> Count: 0
</span><span class="cx"> === Query: "*" ===
</span><del>-Count: 12
</del><ins>+Count: 14
</ins><span class="cx"> html
</span><span class="cx"> head
</span><span class="cx"> script
</span><span class="cx"> script
</span><ins>+script
+script
</ins><span class="cx"> body.main-frame
</span><span class="cx"> p
</span><span class="cx"> iframe
</span></span></pre></div>
<a id="trunkLayoutTestsinspectordomdomsearchwithcontexthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/dom/dom-search-with-context.html (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/dom/dom-search-with-context.html        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/LayoutTests/inspector/dom/dom-search-with-context.html        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -1,11 +1,11 @@
</span><span class="cx"> <html>
</span><span class="cx"> <head>
</span><span class="cx"> <script type="text/javascript" src="../../http/tests/inspector/resources/protocol-test.js"></script>
</span><ins>+<script type="text/javascript" src="../../http/tests/inspector/dom/resources/InspectorDOMListener.js"></script>
</ins><span class="cx"> <script>
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><span class="cx"> // Create a DOM listener to convert nodeIds to tag names.
</span><del>- ProtocolTest.importScript("../dom/resources/InspectorDOMListener.js");
</del><span class="cx"> var dom = createDOMListener();
</span><span class="cx">
</span><span class="cx"> // Caching the output to avoid searching through the log.
</span></span></pre></div>
<a id="trunkLayoutTestsinspectordomdomsearchhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/dom/dom-search.html (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/dom/dom-search.html        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/LayoutTests/inspector/dom/dom-search.html        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -1,14 +1,13 @@
</span><span class="cx"> <html>
</span><span class="cx"> <head>
</span><span class="cx"> <script type="text/javascript" src="../../http/tests/inspector/resources/protocol-test.js"></script>
</span><ins>+<script type="text/javascript" src="../../http/tests/inspector/dom/resources/InspectorDOMListener.js"></script>
+<!-- Loading the queries from external file to avoid having them show up in the results. -->
+<script type="text/javascript" src="resources/dom-search-queries.js"></script>
</ins><span class="cx"> <script>
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><del>- // Loading the queries from external file to avoid having them show up in the results.
- ProtocolTest.importScript("../../../../inspector/dom/resources/dom-search-queries.js");
-
</del><span class="cx"> // Create a DOM listener to convert nodeIds to tag names.
</span><del>- ProtocolTest.importScript("../dom/resources/InspectorDOMListener.js");
</del><span class="cx"> var dom = createDOMListener();
</span><span class="cx">
</span><span class="cx"> // Caching the output to avoid searching through the log.
</span></span></pre></div>
<a id="trunkLayoutTestsinspectordomresourcesdomsearchqueriesjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/dom/resources/dom-search-queries.js (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/dom/resources/dom-search-queries.js        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/LayoutTests/inspector/dom/resources/dom-search-queries.js        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -1,6 +1,8 @@
</span><ins>+ProtocolTestProxy.registerInitializer(function() {
+
</ins><span class="cx"> // Having the queries in an external file, so that DOM search will not find the script when searching for values.
</span><span class="cx">
</span><del>-var domSearchQueries = [
</del><ins>+window.domSearchQueries = [
</ins><span class="cx"> "body",
</span><span class="cx"> "<body",
</span><span class="cx"> "body>",
</span><span class="lines">@@ -28,4 +30,6 @@
</span><span class="cx"> "/html/body",
</span><span class="cx"> "/html/body/@onload",
</span><span class="cx"> "/HTML/BODY"
</span><del>-];
</del><span class="cx">\ No newline at end of file
</span><ins>+];
+
+});
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/Source/WebInspectorUI/ChangeLog        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-08-18 Brian Burg <bburg@apple.com>
+
+ Web Inspector: load ProtocolTestStub from the WebInspectorUI bundle
+ https://bugs.webkit.org/show_bug.cgi?id=147955
+
+ Reviewed by Timothy Hatcher.
+
+ Move ProtocolTestStub.{html,js} into the actual WebInspectorUI project.
+
+ * UserInterface/Base/TestStub.js: Renamed from LayoutTests/http/tests/inspector/resources/ProtocolTestStub.js.
+ * UserInterface/TestStub.html: Renamed from LayoutTests/http/tests/inspector/resources/ProtocolTestStub.html.
+
</ins><span class="cx"> 2015-08-18 Devin Rousso <drousso@apple.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: Better keyboard shortcut to focus on the console prompt
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceBaseTestStubjsfromrev188597trunkLayoutTestshttptestsinspectorresourcesProtocolTestStubjs"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebInspectorUI/UserInterface/Base/TestStub.js (from rev 188597, trunk/LayoutTests/http/tests/inspector/resources/ProtocolTestStub.js) (0 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Base/TestStub.js         (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/TestStub.js        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -0,0 +1,480 @@
</span><ins>+/*
+ * Copyright (C) 2012 Samsung Electronics. All rights reserved.
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
+ *
+ * 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.
+ */
+InspectorFrontendAPI = {};
+
+InjectedTestHarness = class InjectedTestHarness
+{
+ constructor()
+ {
+ this._logCount = 0;
+ this.forceSyncDebugLogging = false;
+ }
+
+ completeTest()
+ {
+ throw new Error("Must be implemented by subclasses.");
+ }
+
+ addResult()
+ {
+ throw new Error("Must be implemented by subclasses.");
+ }
+
+ debugLog()
+ {
+ throw new Error("Must be implemented by subclasses.");
+ }
+
+ evaluateInPage(string, callback)
+ {
+ throw new Error("Must be implemented by subclasses.");
+ }
+
+ createAsyncSuite(name)
+ {
+ return new InjectedTestHarness.AsyncTestSuite(this, name);
+ }
+
+ createSyncSuite(name)
+ {
+ return new InjectedTestHarness.SyncTestSuite(this, name);
+ }
+
+ get logCount()
+ {
+ return this._logCount;
+ }
+
+ log(message)
+ {
+ ++this._logCount;
+
+ if (this.forceSyncDebugLogging)
+ this.debugLog(message);
+ else
+ this.addResult(message);
+ }
+
+ assert(condition, message)
+ {
+ if (condition)
+ return;
+
+ let stringifiedMessage = typeof message !== "object" ? message : JSON.stringify(message);
+ this.addResult("ASSERT: " + stringifiedMessage);
+ }
+
+ expectThat(condition, message)
+ {
+ let prefix = condition ? "PASS" : "FAIL";
+ let stringifiedMessage = typeof message !== "object" ? message : JSON.stringify(message);
+ this.addResult(prefix + ": " + stringifiedMessage);
+ }
+}
+
+InjectedTestHarness.AsyncTestSuite = class AsyncTestSuite
+{
+ constructor(harness, name) {
+ if (!(harness instanceof InjectedTestHarness))
+ throw new Error("Must pass the test's harness as the first argument.");
+
+ if (!name || typeof name !== "string")
+ throw new Error("Tried to create AsyncTestSuite without string suite name.");
+
+ this.name = name;
+ this._harness = harness;
+
+ this.testcases = [];
+ this.runCount = 0;
+ this.failCount = 0;
+ }
+
+ get passCount()
+ {
+ return this.runCount - this.failCount;
+ }
+
+ get skipCount()
+ {
+ if (this.failCount)
+ return this.testcases.length - this.runCount;
+ else
+ return 0;
+ }
+
+ addTestCase(testcase)
+ {
+ if (!testcase || !(testcase instanceof Object))
+ throw new Error("Tried to add non-object test case.");
+
+ if (typeof testcase.name !== "string")
+ throw new Error("Tried to add test case without a name.");
+
+ if (typeof testcase.test !== "function")
+ throw new Error("Tried to add test case without `test` function.");
+
+ this.testcases.push(testcase);
+ }
+
+ // Use this if the test file only has one suite, and no handling
+ // of the promise returned by runTestCases() is needed.
+ runTestCasesAndFinish()
+ {
+ function finish() {
+ this._harness.completeTest();
+ }
+
+ this.runTestCases()
+ .then(finish.bind(this))
+ .catch(finish.bind(this));
+ }
+
+ runTestCases()
+ {
+ if (!this.testcases.length)
+ throw new Error("Tried to call runTestCases() for suite with no test cases");
+ if (this._startedRunning)
+ throw new Error("Tried to call runTestCases() more than once.");
+
+ this._startedRunning = true;
+
+ this._harness.log("");
+ this._harness.log("== Running test suite: " + this.name);
+
+ // Avoid adding newlines if nothing was logged.
+ var priorLogCount = this._harness.logCount;
+ var suite = this;
+ var result = this.testcases.reduce(function(chain, testcase, i) {
+ return chain.then(function() {
+ if (i > 0 && priorLogCount + 1 < suite._harness.logCount)
+ suite._harness.log("");
+
+ priorLogCount = suite._harness.logCount;
+ suite._harness.log("-- Running test case: " + testcase.name);
+ suite.runCount++;
+ return new Promise(testcase.test);
+ });
+ }, Promise.resolve());
+
+ return result.catch(function(e) {
+ suite.failCount++;
+ var message = e;
+ if (e instanceof Error)
+ message = e.message;
+
+ if (typeof message !== "string")
+ message = JSON.stringify(message);
+
+ suite._harness.log("!! EXCEPTION: " + message);
+ throw e; // Reject this promise by re-throwing the error.
+ });
+ }
+}
+
+InjectedTestHarness.SyncTestSuite = class SyncTestSuite
+{
+ constructor(harness, name) {
+ if (!(harness instanceof InjectedTestHarness))
+ throw new Error("Must pass the test's harness as the first argument.");
+
+ if (!name || typeof name !== "string")
+ throw new Error("Tried to create SyncTestSuite without string suite name.");
+
+ this.name = name;
+ this._harness = harness;
+
+ this.testcases = [];
+ this.runCount = 0;
+ this.failCount = 0;
+ }
+
+ get passCount()
+ {
+ return this.runCount - this.failCount;
+ }
+
+ get skipCount()
+ {
+ if (this.failCount)
+ return this.testcases.length - this.runCount;
+ else
+ return 0;
+ }
+
+ addTestCase(testcase)
+ {
+ if (!testcase || !(testcase instanceof Object))
+ throw new Error("Tried to add non-object test case.");
+
+ if (typeof testcase.name !== "string")
+ throw new Error("Tried to add test case without a name.");
+
+ if (typeof testcase.test !== "function")
+ throw new Error("Tried to add test case without `test` function.");
+
+ this.testcases.push(testcase);
+ }
+
+ // Use this if the test file only has one suite.
+ runTestCasesAndFinish()
+ {
+ this.runTestCases();
+ this._harness.completeTest();
+ }
+
+ runTestCases()
+ {
+ if (!this.testcases.length)
+ throw new Error("Tried to call runTestCases() for suite with no test cases");
+ if (this._startedRunning)
+ throw new Error("Tried to call runTestCases() more than once.");
+
+ this._startedRunning = true;
+
+ this._harness.log("");
+ this._harness.log("== Running test suite: " + this.name);
+
+ var priorLogCount = this._harness.logCount;
+ var suite = this;
+ for (var i = 0; i < this.testcases.length; i++) {
+ var testcase = this.testcases[i];
+ if (i > 0 && priorLogCount + 1 < this._harness.logCount)
+ this._harness.log("");
+
+ priorLogCount = this._harness.logCount;
+
+ this._harness.log("-- Running test case: " + testcase.name);
+ suite.runCount++;
+ try {
+ var result = testcase.test.call(null);
+ if (result === false) {
+ suite.failCount++;
+ return false;
+ }
+ } catch (e) {
+ suite.failCount++;
+ var message = e;
+ if (e instanceof Error)
+ message = e.message;
+ else
+ e = new Error(e);
+
+ if (typeof message !== "string")
+ message = JSON.stringify(message);
+
+ this._harness.log("!! EXCEPTION: " + message);
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
+
+class ProtocolTestHarness extends InjectedTestHarness
+{
+ // InjectedTestHarness Overrides
+
+ completeTest()
+ {
+ this.evaluateInPage("closeTest();");
+ }
+
+ addResult(message)
+ {
+ // Unfortunately, every string argument must be escaped because tests are not consistent
+ // with respect to escaping with single or double quotes. Some exceptions use single quotes.
+ var stringifiedMessage = typeof message !== "string" ? JSON.stringify(message) : message;
+ this.evaluateInPage("log(unescape('" + escape(stringifiedMessage) + "'));");
+ }
+
+ debugLog(message)
+ {
+ var stringifiedMessage = typeof message !== "string" ? JSON.stringify(message) : message;
+ this.evaluateInPage("debugLog(unescape('" + escape(stringifiedMessage) + "'));")
+ }
+
+ evaluateInPage(expression, callback)
+ {
+ let args = {
+ method: "Runtime.evaluate",
+ params: {expression}
+ }
+
+ if (typeof callback === "function")
+ InspectorProtocol.sendCommand(args, callback);
+ else
+ return InspectorProtocol.awaitCommand(args);
+ }
+}
+
+window.ProtocolTest = new ProtocolTestHarness();
+
+InspectorProtocol = {};
+InspectorProtocol._dispatchTable = [];
+InspectorProtocol._requestId = -1;
+InspectorProtocol.eventHandler = {};
+
+InspectorProtocol.dumpInspectorProtocolMessages = false;
+
+InspectorProtocol.sendCommand = function(methodOrObject, params, handler)
+{
+ // Allow new-style arguments object, as in awaitCommand.
+ var method = methodOrObject;
+ if (typeof methodOrObject === "object")
+ var {method, params, handler} = methodOrObject;
+
+ this._dispatchTable[++this._requestId] = handler;
+ var messageObject = {method, params, "id": this._requestId};
+ this.sendMessage(messageObject);
+
+ return this._requestId;
+}
+
+InspectorProtocol.awaitCommand = function(args)
+{
+ var {method, params} = args;
+ return new Promise(function(resolve, reject) {
+ this._dispatchTable[++this._requestId] = {resolve, reject};
+ var messageObject = {method, params, "id": this._requestId};
+ this.sendMessage(messageObject);
+ }.bind(this));
+}
+
+InspectorProtocol.awaitEvent = function(args)
+{
+ var {event} = args;
+ if (typeof event !== "string")
+ throw new Error("Event must be a string.");
+
+ return new Promise(function(resolve, reject) {
+ InspectorProtocol.eventHandler[event] = function(message) {
+ InspectorProtocol.eventHandler[event] = undefined;
+ resolve(message);
+ }
+ });
+}
+
+InspectorProtocol.addEventListener = function(eventTypeOrObject, listener)
+{
+ var event = eventTypeOrObject;
+ if (typeof eventTypeOrObject === "object")
+ var {event, listener} = eventTypeOrObject;
+
+ if (typeof event !== "string")
+ throw new Error("Event name must be a string.");
+
+ if (typeof listener !== "function")
+ throw new Error("Event listener must be callable.");
+
+ // Convert to an array of listeners.
+ var listeners = InspectorProtocol.eventHandler[event];
+ if (!listeners)
+ listeners = InspectorProtocol.eventHandler[event] = [];
+ else if (typeof listeners === "function")
+ listeners = InspectorProtocol.eventHandler[event] = [listeners];
+
+ // Prevent registering multiple times.
+ if (listeners.includes(listener))
+ throw new Error("Cannot register the same listener more than once.");
+
+ listeners.push(listener);
+}
+
+InspectorProtocol.sendMessage = function(messageObject)
+{
+ // This matches the debug dumping in InspectorBackend, which is bypassed
+ // by InspectorProtocol. Return messages should be dumped by InspectorBackend.
+ if (InspectorProtocol.dumpInspectorProtocolMessages)
+ console.log("frontend: " + JSON.stringify(messageObject));
+
+ InspectorFrontendHost.sendMessageToBackend(JSON.stringify(messageObject));
+}
+
+InspectorProtocol.checkForError = function(responseObject)
+{
+ if (responseObject.error) {
+ ProtocolTest.log("PROTOCOL ERROR: " + JSON.stringify(responseObject.error));
+ ProtocolTest.completeTest();
+ throw "PROTOCOL ERROR";
+ }
+}
+
+InspectorFrontendAPI.dispatchMessageAsync = function(messageObject)
+{
+ // This matches the debug dumping in InspectorBackend, which is bypassed
+ // by InspectorProtocol. Return messages should be dumped by InspectorBackend.
+ if (InspectorProtocol.dumpInspectorProtocolMessages)
+ console.log("backend: " + JSON.stringify(messageObject));
+
+ // If the message has an id, then it is a reply to a command.
+ var messageId = messageObject["id"];
+ if (typeof messageId === "number") {
+ var handler = InspectorProtocol._dispatchTable[messageId];
+ if (!handler)
+ return;
+
+ if (typeof handler === "function")
+ handler(messageObject);
+ else if (typeof handler === "object") {
+ var {resolve, reject} = handler;
+ if ("error" in messageObject)
+ reject(messageObject.error.message);
+ else
+ resolve(messageObject.result);
+ }
+ // Otherwise, it is an event.
+ } else {
+ var eventName = messageObject["method"];
+ var handler = InspectorProtocol.eventHandler[eventName];
+ if (!handler)
+ return;
+
+ if (typeof handler === "function")
+ handler(messageObject);
+ else if (handler instanceof Array) {
+ handler.map(function(listener) {
+ listener.call(null, messageObject);
+ });
+ } else if (typeof handler === "object") {
+ var {resolve, reject} = handler;
+ if ("error" in messageObject)
+ reject(messageObject.error.message);
+ else
+ resolve(messageObject.result);
+ }
+ }
+}
+
+window.addEventListener("message", function(event) {
+ try {
+ eval(event.data);
+ } catch (e) {
+ alert(e.stack);
+ ProtocolTest.completeTest();
+ throw e;
+ }
+});
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTestStubhtmlfromrev188597trunkLayoutTestshttptestsinspectorresourcesProtocolTestStubhtml"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebInspectorUI/UserInterface/TestStub.html (from rev 188597, trunk/LayoutTests/http/tests/inspector/resources/ProtocolTestStub.html) (0 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/TestStub.html         (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/TestStub.html        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+<!--
+Copyright (C) 2015 Apple Inc. All rights reserved.
+
+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.
+-->
+<html>
+<head>
+ <script type="text/javascript" src="Base/TestStub.js"></script>
+</head>
+</html>
</ins></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/Tools/ChangeLog        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2015-08-18 Brian Burg <bburg@apple.com>
+
+ Web Inspector: load ProtocolTestStub from the WebInspectorUI bundle
+ https://bugs.webkit.org/show_bug.cgi?id=147955
+
+ Reviewed by Timothy Hatcher.
+
+ To enable sharing of common test code between protocol and model tests,
+ start loading the protocol TestStub.js through the WebInspectorUI bundle.
+
+ This patch adds the read-only getter TestRunner.inspectorTestStubURL, which
+ protocol-test.js uses to load the inspector frontend stub into its iframe
+ from an arbitrary local file URL.
+
+ * DumpRenderTree/TestRunner.cpp:
+ (getInspectorTestStubURLCallback):
+ (TestRunner::staticValues):
+ * DumpRenderTree/TestRunner.h:
+ * DumpRenderTree/mac/TestRunnerMac.mm:
+ (SOFT_LINK_STAGED_FRAMEWORK):
+ (TestRunner::inspectorTestStubURL):
+ * DumpRenderTree/win/TestRunnerWin.cpp:
+ (TestRunner::inspectorTestStubURL):
+ * WebKitTestRunner/Configurations/Base.xcconfig:
+ Since WebKitTestRunner now includes WebCore private headers, also search
+ for the WebCore framework inside the WebKit umbrella framework.
+
+ * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+ * WebKitTestRunner/InjectedBundle/TestRunner.h:
+ * WebKitTestRunner/InjectedBundle/efl/TestRunnerEfl.cpp:
+ (WTR::TestRunner::inspectorTestStubURL):
+ * WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp:
+ (WTR::TestRunner::inspectorTestStubURL):
+ * WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm:
+ (WTR::TestRunner::inspectorTestStubURL):
+
</ins><span class="cx"> 2015-08-18 Filip Pizlo <fpizlo@apple.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed, fix GTK build.
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeTestRunnercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/TestRunner.cpp (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/TestRunner.cpp        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/Tools/DumpRenderTree/TestRunner.cpp        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -1790,6 +1790,13 @@
</span><span class="cx"> return JSValueMakeString(context, titleDirection.get());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static JSValueRef getInspectorTestStubURLCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
+ JSRetainPtr<JSStringRef> url(Adopt, controller->inspectorTestStubURL());
+ return JSValueMakeString(context, url.get());
+}
+
</ins><span class="cx"> static bool setGlobalFlagCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
</span><span class="cx"> {
</span><span class="cx"> TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
</span><span class="lines">@@ -1983,6 +1990,7 @@
</span><span class="cx"> { "titleTextDirection", getTitleTextDirectionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx"> { "databaseDefaultQuota", getDatabaseDefaultQuotaCallback, setDatabaseDefaultQuotaCallback, kJSPropertyAttributeNone },
</span><span class="cx"> { "databaseMaxQuota", getDatabaseMaxQuotaCallback, setDatabaseMaxQuotaCallback, kJSPropertyAttributeNone },
</span><ins>+ { "inspectorTestStubURL", getInspectorTestStubURLCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</ins><span class="cx"> { 0, 0, 0, 0 }
</span><span class="cx"> };
</span><span class="cx"> return staticValues;
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeTestRunnerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/TestRunner.h (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/TestRunner.h        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/Tools/DumpRenderTree/TestRunner.h        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -308,6 +308,8 @@
</span><span class="cx"> void showWebInspector();
</span><span class="cx"> void closeWebInspector();
</span><span class="cx"> void evaluateInWebInspector(JSStringRef script);
</span><ins>+ JSStringRef inspectorTestStubURL();
+
</ins><span class="cx"> void evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script);
</span><span class="cx"> void evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, JSObjectRef globalObject, JSStringRef script);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreemacTestRunnerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx"> #import <JavaScriptCore/JSStringRef.h>
</span><span class="cx"> #import <JavaScriptCore/JSStringRefCF.h>
</span><span class="cx"> #import <WebCore/GeolocationPosition.h>
</span><ins>+#import <WebCore/SoftLinking.h>
</ins><span class="cx"> #import <WebKit/DOMDocument.h>
</span><span class="cx"> #import <WebKit/DOMElement.h>
</span><span class="cx"> #import <WebKit/DOMHTMLInputElementPrivate.h>
</span><span class="lines">@@ -88,6 +89,8 @@
</span><span class="cx"> #import <WebKit/WebDOMOperationsPrivate.h>
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+SOFT_LINK_STAGED_FRAMEWORK(WebInspectorUI, PrivateFrameworks, A)
+
</ins><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx"> @interface CommandValidationTarget : NSObject <NSValidatedUserInterfaceItem>
</span><span class="cx"> {
</span><span class="lines">@@ -780,6 +783,23 @@
</span><span class="cx"> [[[mainFrame webView] inspector] evaluateInFrontend:nil script:scriptNS];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+JSStringRef TestRunner::inspectorTestStubURL()
+{
+ // Call the soft link framework function to dlopen it, then CFBundleGetBundleWithIdentifier will work.
+ WebInspectorUILibrary();
+
+ CFBundleRef inspectorBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebInspectorUI"));
+ if (!inspectorBundle)
+ return nullptr;
+
+ RetainPtr<CFURLRef> url = adoptCF(CFBundleCopyResourceURL(inspectorBundle, CFSTR("TestStub"), CFSTR("html"), NULL));
+ if (!url)
+ return nullptr;
+
+ CFStringRef urlString = CFURLGetString(url.get());
+ return JSStringCreateWithCFString(urlString);
+}
+
</ins><span class="cx"> typedef HashMap<unsigned, RetainPtr<WebScriptWorld> > WorldMap;
</span><span class="cx"> static WorldMap& worldMap()
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreewinTestRunnerWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -1093,6 +1093,15 @@
</span><span class="cx"> inspectorPrivate->evaluateInFrontend(bstrT(script).GetBSTR());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+JSStringRef TestRunner::inspectorTestStubURL()
+{
+ // FIXME: Implement this to support Web Inspector tests using `protocol-test.js`.
+ // See https://bugs.webkit.org/show_bug.cgi?id=148025.
+ printf("ERROR: TestRunner::inspectorTestStubURL() not implemented\n");
+
+ return nullptr;
+}
+
</ins><span class="cx"> typedef HashMap<unsigned, COMPtr<IWebScriptWorld> > WorldMap;
</span><span class="cx"> static WorldMap& worldMap()
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerConfigurationsBasexcconfig"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/Configurations/Base.xcconfig (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/Configurations/Base.xcconfig        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/Tools/WebKitTestRunner/Configurations/Base.xcconfig        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx"> WEBKIT_UMBRELLA_FRAMEWORKS_DIR = $(SDKROOT)$(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Versions/A/Frameworks;
</span><span class="cx"> WEBCORE_PRIVATE_HEADERS_DIR = $(WEBKIT_UMBRELLA_FRAMEWORKS_DIR)/WebCore.framework/PrivateHeaders;
</span><span class="cx">
</span><del>-FRAMEWORK_SEARCH_PATHS = $(inherited) $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks;
</del><ins>+FRAMEWORK_SEARCH_PATHS = $(inherited) $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Versions/A/Frameworks;
</ins><span class="cx">
</span><span class="cx"> WEBKIT_SYSTEM_INTERFACE_LIBRARY = WebKitSystemInterface
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleBindingsTestRunneridl"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -125,6 +125,7 @@
</span><span class="cx"> void showWebInspector();
</span><span class="cx"> void closeWebInspector();
</span><span class="cx"> void evaluateInWebInspector(DOMString script);
</span><ins>+ readonly attribute DOMString inspectorTestStubURL;
</ins><span class="cx">
</span><span class="cx"> void setPOSIXLocale(DOMString locale);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleTestRunnerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -199,6 +199,7 @@
</span><span class="cx"> void showWebInspector();
</span><span class="cx"> void closeWebInspector();
</span><span class="cx"> void evaluateInWebInspector(JSStringRef script);
</span><ins>+ JSRetainPtr<JSStringRef> inspectorTestStubURL();
</ins><span class="cx">
</span><span class="cx"> void setPOSIXLocale(JSStringRef);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleeflTestRunnerEflcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/efl/TestRunnerEfl.cpp (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/efl/TestRunnerEfl.cpp        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/efl/TestRunnerEfl.cpp        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -23,7 +23,9 @@
</span><span class="cx"> #include "InjectedBundle.h"
</span><span class="cx"> #include <Ecore.h>
</span><span class="cx"> #include <JavaScriptCore/OpaqueJSString.h>
</span><ins>+#include <WebCore/EflInspectorUtilities.h>
</ins><span class="cx"> #include <wtf/text/CString.h>
</span><ins>+#include <wtf/text/StringBuilder.h>
</ins><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="cx">
</span><span class="cx"> namespace WTR {
</span><span class="lines">@@ -82,4 +84,14 @@
</span><span class="cx"> return JSStringCreateWithUTF8CString(fullPathToUrl.utf8().data());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+JSRetainPtr<JSStringRef> TestRunner::inspectorTestStubURL()
+{
+ StringBuilder builder;
+ builder.append("file://");
+ builder.append(WebCore::inspectorResourcePath());
+ builder.appendLiteral("/TestStub.html");
+
+ return JSStringCreateWithUTF8CString(builder.toString().utf8().data());
+}
+
</ins><span class="cx"> } // namespace WTR
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundlegtkTestRunnerGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -67,4 +67,9 @@
</span><span class="cx"> return JSStringCreateWithUTF8CString(testURI.get());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+JSRetainPtr<JSStringRef> TestRunner::inspectorTestStubURL()
+{
+ return JSStringCreateWithUTF8CString("resource:///org/webkitgtk/inspector/UserInterface/TestStub.html");
+}
+
</ins><span class="cx"> } // namespace WTR
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundlemacTestRunnerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm (188597 => 188598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm        2015-08-18 21:45:29 UTC (rev 188597)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm        2015-08-18 21:53:23 UTC (rev 188598)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2010 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2010, 2015 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -23,10 +23,15 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#include "TestRunner.h"
</del><ins>+#import "config.h"
+#import "TestRunner.h"
</ins><span class="cx">
</span><del>-#include "InjectedBundle.h"
</del><ins>+#import "InjectedBundle.h"
+#import <JavaScriptCore/JSStringRefCF.h>
+#import <WebCore/SoftLinking.h>
</ins><span class="cx">
</span><ins>+SOFT_LINK_STAGED_FRAMEWORK(WebInspectorUI, PrivateFrameworks, A)
+
</ins><span class="cx"> namespace WTR {
</span><span class="cx">
</span><span class="cx"> void TestRunner::platformInitialize()
</span><span class="lines">@@ -62,4 +67,21 @@
</span><span class="cx"> return JSStringRetain(url); // Do nothing on mac.
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+JSRetainPtr<JSStringRef> TestRunner::inspectorTestStubURL()
+{
+ // Call the soft link framework function to dlopen it, then CFBundleGetBundleWithIdentifier will work.
+ WebInspectorUILibrary();
+
+ CFBundleRef inspectorBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebInspectorUI"));
+ if (!inspectorBundle)
+ return nullptr;
+
+ RetainPtr<CFURLRef> url = adoptCF(CFBundleCopyResourceURL(inspectorBundle, CFSTR("TestStub"), CFSTR("html"), NULL));
+ if (!url)
+ return nullptr;
+
+ CFStringRef urlString = CFURLGetString(url.get());
+ return adopt(JSStringCreateWithCFString(urlString));
+}
+
</ins><span class="cx"> } // namespace WTR
</span></span></pre>
</div>
</div>
</body>
</html>