Changeset 188598 in webkit


Ignore:
Timestamp:
Aug 18, 2015, 2:53:23 PM (10 years ago)
Author:
BJ Burg
Message:

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:
Location:
trunk
Files:
32 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r188597 r188598  
     12015-08-18  Brian Burg  <bburg@apple.com>
     2
     3        Web Inspector: load ProtocolTestStub from the WebInspectorUI bundle
     4        https://bugs.webkit.org/show_bug.cgi?id=147955
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        Since the inspector stub cannot open files that live in the LayoutTests
     9        directory, adopt the test helper marshalling approach used by inspector.js.
     10        Each helper must register its code for marshalling and explicitly put globals
     11        on the window object.
     12
     13        Use script tags rather than importScript to include helpers in a test.
     14
     15        * TestExpectations: For now, skip inspector http tests. These should be rewritten
     16        to use inspector-test.js, which does not run into cross-origin problems.
     17
     18        Rebaseline some test results to account for shifted line numbers (yuck).
     19
     20        * http/tests/inspector/dom/resources/InspectorDOMListener.js:
     21        * http/tests/inspector/resources/console-test.js:
     22        * http/tests/inspector/resources/probe-test.js:
     23        * http/tests/inspector/resources/protocol-test.js:
     24        (ProtocolTestProxy.registerInitializer):
     25        (log):
     26        (runTest.runInitializationMethodsInFrontend):
     27        (runTest.runTestMethodInFrontend):
     28        (runTest):
     29        * inspector/console/console-message.html:
     30        * inspector/console/css-source-locations-expected.txt:
     31        * inspector/console/css-source-locations.html:
     32        * inspector/console/js-source-locations-expected.txt:
     33        * inspector/console/js-source-locations.html:
     34        * inspector/console/x-frame-options-message-expected.txt:
     35        * inspector/console/x-frame-options-message.html:
     36        * inspector/debugger/didSampleProbe-multiple-probes.html:
     37        * inspector/debugger/setBreakpoint-actions.html:
     38        * inspector/debugger/setBreakpoint-options-exception.html:
     39        * inspector/dom/dom-search-expected.txt:
     40        * inspector/dom/dom-search-with-context.html:
     41        * inspector/dom/dom-search.html:
     42        * inspector/dom/resources/dom-search-queries.js:
     43
    1442015-08-18  Myles C. Maxfield  <mmaxfield@apple.com>
    245
  • trunk/LayoutTests/TestExpectations

    r188579 r188598  
    9494
    9595webkit.org/b/129057 media/controls-styling-strict.html [ Pass Failure ]
     96
     97# These tests will be rewritten, just skip them until that time.
     98webkit.org/b/148036 http/tests/inspector/ [ Skip ]
    9699
    97100webkit.org/b/129639 inspector/dom/dom-search-crash.html [ Skip ]
  • trunk/LayoutTests/http/tests/inspector/dom/resources/InspectorDOMListener.js

    r188579 r188598  
    2828 */
    2929
    30 function createDOMListener()
     30ProtocolTestProxy.registerInitializer(function(){
     31
     32window.createDOMListener = function()
    3133{
    3234    var nodesById = {};
     
    102104    };
    103105}
     106
     107});
  • trunk/LayoutTests/http/tests/inspector/resources/console-test.js

    r188579 r188598  
     1ProtocolTestProxy.registerInitializer(function() {
     2
    13ProtocolTest.Console = {};
    24
     
    7476    });
    7577}
     78
     79});
  • trunk/LayoutTests/http/tests/inspector/resources/probe-test.js

    r188579 r188598  
     1ProtocolTestProxy.registerInitializer(function() {
     2
    13ProtocolTest.Probe = {};
    24
     
    126128    });
    127129}
     130
     131});
  • trunk/LayoutTests/http/tests/inspector/resources/protocol-test.js

    r188579 r188598  
    2424 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2525 */
    26 var outputElement;
     26
     27// This namespace is injected into every test page. Its functions are invoked by
     28// ProtocolTest methods on the inspector page via InjectedTestHarness.
     29ProtocolTestProxy = {};
     30ProtocolTestProxy._initializers = [];
     31
     32// Helper scripts like `console-test.js` must register their initialization
     33// function with this method so it will be marshalled to the inspector page.
     34ProtocolTestProxy.registerInitializer = function(initializer)
     35{
     36    if (typeof initializer === "function")
     37        this._initializers.push(initializer.toString());
     38}
     39
     40let outputElement;
    2741
    2842/**
     
    4155{
    4256    if (!outputElement) {
    43         var intermediate = document.createElement("div");
     57        let intermediate = document.createElement("div");
    4458        document.body.appendChild(intermediate);
    4559
    46         var intermediate2 = document.createElement("div");
     60        let intermediate2 = document.createElement("div");
    4761        intermediate.appendChild(intermediate2);
    4862
     
    7892    testRunner.setCanOpenWindows(true);
    7993
    80     var scriptTags = document.getElementsByTagName("script");
    81     var scriptUrlBasePath = "";
    82     for (var i = 0; i < scriptTags.length; ++i) {
    83         var index = scriptTags[i].src.lastIndexOf("/protocol-test.js");
    84         if (index > -1 ) {
    85             scriptUrlBasePath = scriptTags[i].src.slice(0, index);
    86             break;
     94    let testFunction = window.test;
     95    if (!(typeof testFunction === "function")) {
     96        alert("Failed to send test() because it is not a function.");
     97        testRunner.notifyDone();
     98    }
     99
     100    let url = testRunner.inspectorTestStubURL;
     101    if (!url) {
     102        alert("Failed to obtain inspector test stub URL.");
     103        testRunner.notifyDone();
     104    }
     105
     106    function runInitializationMethodsInFrontend(initializers)
     107    {
     108        for (let initializer of initializers) {
     109            try {
     110                initializer();
     111            } catch (e) {
     112                ProtocolTest.log("Exception in test initialization: " + e, e.stack || "(no stack trace)");
     113                ProtocolTest.completeTest();
     114            }
    87115        }
    88116    }
    89117
    90     var url = scriptUrlBasePath + "/ProtocolTestStub.html";
    91     var inspectorFrontend = window.internals.openDummyInspectorFrontend(url);
     118    function runTestMethodInFrontend(testFunction)
     119    {
     120        try {
     121            testFunction();
     122        } catch (e) {
     123            ProtocolTest.log("Exception during test execution: " + e, e.stack || "(no stack trace)");
     124            ProtocolTest.completeTest();
     125        }
     126    }
     127
     128    let inspectorFrontend = window.internals.openDummyInspectorFrontend(url);
    92129    inspectorFrontend.addEventListener("load", function(event) {
    93         // FIXME: rename this 'test' global field across all tests.
    94         var testFunction = window.test;
    95         if (typeof testFunction === "function") {
    96             inspectorFrontend.postMessage("(" + testFunction.toString() +")();", "*");
    97             return;
    98         }
    99         // Kill waiting process if failed to send.
    100         alert("Failed to send test function");
    101         testRunner.notifyDone();
     130        let initializationCodeString = `(${runInitializationMethodsInFrontend.toString()})([${ProtocolTestProxy._initializers}]);`;
     131        let testFunctionCodeString = `(${runTestMethodInFrontend.toString()})(${testFunction.toString()});`;
     132
     133        inspectorFrontend.postMessage(initializationCodeString, "*");
     134        inspectorFrontend.postMessage(testFunctionCodeString, "*");
    102135    });
    103136}
  • trunk/LayoutTests/inspector/console/console-message.html

    r188579 r188598  
    33<head>
    44<script src="../../http/tests/inspector/resources/protocol-test.js"></script>
     5<script src="../../http/tests/inspector/resources/console-test.js"></script>
    56<script>
    67function generateSimpleConsoleMessages()
     
    1516function test()
    1617{
    17     ProtocolTest.importScript("console-test.js");
    1818
    1919    var suite = ProtocolTest.createAsyncSuite("Console.MessagesFromCommandLineAPI");
  • trunk/LayoutTests/inspector/console/css-source-locations-expected.txt

    r188579 r188598  
    11Tests that CSS parser warnings from inline style tags and external stylesheets are sent to the console with correct line and column information.
    2 {"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:6:20"}
    3 {"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:7:14"}
    4 {"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:8:7"}
    5 {"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:10:8"}
     2{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:7:20"}
     3{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:8:14"}
     4{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:9:7"}
     5{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:11:8"}
    66{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"errors.css:1:7"}
    77{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"errors.css:1:29"}
  • trunk/LayoutTests/inspector/console/css-source-locations.html

    r188579 r188598  
    33<head>
    44<script src="../../http/tests/inspector/resources/protocol-test.js"></script>
     5<script src="../../http/tests/inspector/resources/console-test.js"></script>
    56<link rel="stylesheet" href="resources/errors.css">
    67  <style>    div { * color: red; }</style>
     
    1617function test()
    1718{
    18     ProtocolTest.importScript("console-test.js");
    19 
    2019    var consoleMessageCount = 0;
    2120    const expectedConsoleMessageCount = 7;
  • trunk/LayoutTests/inspector/console/js-source-locations-expected.txt

    r188579 r188598  
    33CONSOLE MESSAGE: line 5: error script
    44CONSOLE MESSAGE: line 6: warn script
    5 CONSOLE MESSAGE: line 6: TypeError: undefined is not an object (evaluating '[].x.x')
    6 CONSOLE MESSAGE: line 8: warn 1
    7 CONSOLE MESSAGE: line 8: error 1
    8 CONSOLE MESSAGE: line 9: error 2
     5CONSOLE MESSAGE: line 7: TypeError: undefined is not an object (evaluating '[].x.x')
     6CONSOLE MESSAGE: line 9: warn 1
     7CONSOLE MESSAGE: line 9: error 1
     8CONSOLE MESSAGE: line 10: error 2
    99Tests that JavaScript errors and warnings from inline script tags and external files are sent to the console with correct line and column information.
    1010{"source":"console-api","level":"error","text":"error script","location":"errors.js:1:14","parameters":[{"type":"string"}]}
     
    1212{"source":"console-api","level":"error","text":"error script","location":"errors.js:5:18","parameters":[{"type":"string"}]}
    1313{"source":"console-api","level":"warning","text":"warn script","location":"errors.js:6:17","parameters":[{"type":"string"}]}
    14 {"source":"javascript","level":"error","text":"TypeError: undefined is not an object (evaluating '[].x.x')","location":"js-source-locations.html:6:18"}
    15 {"source":"console-api","level":"warning","text":"warn 1","location":"js-source-locations.html:8:13","parameters":[{"type":"string"}]}
    16 {"source":"console-api","level":"error","text":"error 1","location":"js-source-locations.html:8:38","parameters":[{"type":"string"}]}
    17 {"source":"console-api","level":"error","text":"error 2","location":"js-source-locations.html:9:17","parameters":[{"type":"string"}]}
     14{"source":"javascript","level":"error","text":"TypeError: undefined is not an object (evaluating '[].x.x')","location":"js-source-locations.html:7:18"}
     15{"source":"console-api","level":"warning","text":"warn 1","location":"js-source-locations.html:9:13","parameters":[{"type":"string"}]}
     16{"source":"console-api","level":"error","text":"error 1","location":"js-source-locations.html:9:38","parameters":[{"type":"string"}]}
     17{"source":"console-api","level":"error","text":"error 2","location":"js-source-locations.html:10:17","parameters":[{"type":"string"}]}
    1818
  • trunk/LayoutTests/inspector/console/js-source-locations.html

    r188579 r188598  
    33<head>
    44<script src="../../http/tests/inspector/resources/protocol-test.js"></script>
     5<script src="../../http/tests/inspector/resources/console-test.js"></script>
    56<script src="resources/errors.js"></script>
    67  <script>   [].x.x   </script>
     
    1213function test()
    1314{
    14     ProtocolTest.importScript("console-test.js");
    15 
    1615    var consoleMessageCount = 0;
    1716    const expectedConsoleMessageCount = 8;
  • trunk/LayoutTests/inspector/console/x-frame-options-message-expected.txt

    r188579 r188598  
    1 CONSOLE MESSAGE: line 42: Refused to display 'x-frame-options-message.html' in a frame because it set 'X-Frame-Options' to 'deny'.
     1CONSOLE MESSAGE: line 41: Refused to display 'x-frame-options-message.html' in a frame because it set 'X-Frame-Options' to 'deny'.
    22
    33
  • trunk/LayoutTests/inspector/console/x-frame-options-message.html

    r188579 r188598  
    33<head>
    44<script src="../../http/tests/inspector/resources/protocol-test.js"></script>
     5<script src="../../http/tests/inspector/resources/console-test.js"></script>
    56<script>
    67function test()
    78{
    8     ProtocolTest.importScript("console-test.js");
    9 
    109    let suite = ProtocolTest.createAsyncSuite("Console.XFrameOptionsMessages");
    1110
  • trunk/LayoutTests/inspector/debugger/didSampleProbe-multiple-probes.html

    r188579 r188598  
    22<head>
    33<script src="../../http/tests/inspector/resources/protocol-test.js"></script>
     4<script src="../../http/tests/inspector/resources/probe-test.js"></script>
    45<script src="resources/breakpoint.js"></script>
    56<script>
    67function test()
    78{
    8     ProtocolTest.importScript("probe-test.js");
    9 
    109    InspectorProtocol.sendCommand("Debugger.enable", {});
    1110
  • trunk/LayoutTests/inspector/debugger/setBreakpoint-actions.html

    r188579 r188598  
    22<head>
    33<script src="../../http/tests/inspector/resources/protocol-test.js"></script>
     4<script src="../../http/tests/inspector/resources/console-test.js"></script>
     5<script src="../../http/tests/inspector/resources/probe-test.js"></script>
    46<script src="resources/breakpoint.js"></script>
    57<script>
    68function test()
    79{
    8     ProtocolTest.importScript("console-test.js");
    9     ProtocolTest.importScript("probe-test.js");
    10 
    1110    InspectorProtocol.sendCommand("Console.enable", {});
    1211    InspectorProtocol.sendCommand("Debugger.enable", {});
  • trunk/LayoutTests/inspector/debugger/setBreakpoint-options-exception.html

    r188579 r188598  
    22<head>
    33<script src="../../http/tests/inspector/resources/protocol-test.js"></script>
     4<script src="../../http/tests/inspector/resources/console-test.js"></script>
    45<script src="resources/breakpoint.js"></script>
    56<script>
    67function test()
    78{
    8     ProtocolTest.importScript("console-test.js");
    9 
    109    InspectorProtocol.sendCommand("Console.enable", {});
    1110    InspectorProtocol.sendCommand("Debugger.enable", {});
  • trunk/LayoutTests/inspector/dom/dom-search-expected.txt

    r188579 r188598  
    4949Count: 0
    5050=== Query: "*" ===
    51 Count: 12
     51Count: 14
    5252html
    5353head
     54script
     55script
    5456script
    5557script
  • trunk/LayoutTests/inspector/dom/dom-search-with-context.html

    r188579 r188598  
    22<head>
    33<script type="text/javascript" src="../../http/tests/inspector/resources/protocol-test.js"></script>
     4<script type="text/javascript" src="../../http/tests/inspector/dom/resources/InspectorDOMListener.js"></script>
    45<script>
    56function test()
    67{
    78    // Create a DOM listener to convert nodeIds to tag names.
    8     ProtocolTest.importScript("../dom/resources/InspectorDOMListener.js");
    99    var dom = createDOMListener();
    1010
  • trunk/LayoutTests/inspector/dom/dom-search.html

    r188579 r188598  
    22<head>
    33<script type="text/javascript" src="../../http/tests/inspector/resources/protocol-test.js"></script>
     4<script type="text/javascript" src="../../http/tests/inspector/dom/resources/InspectorDOMListener.js"></script>
     5<!-- Loading the queries from external file to avoid having them show up in the results. -->
     6<script type="text/javascript" src="resources/dom-search-queries.js"></script>
    47<script>
    58function test()
    69{
    7     // Loading the queries from external file to avoid having them show up in the results.
    8     ProtocolTest.importScript("../../../../inspector/dom/resources/dom-search-queries.js");
    9 
    1010    // Create a DOM listener to convert nodeIds to tag names.
    11     ProtocolTest.importScript("../dom/resources/InspectorDOMListener.js");
    1211    var dom = createDOMListener();
    1312
  • trunk/LayoutTests/inspector/dom/resources/dom-search-queries.js

    r188579 r188598  
     1ProtocolTestProxy.registerInitializer(function() {
     2
    13// Having the queries in an external file, so that DOM search will not find the script when searching for values.
    24
    3 var domSearchQueries = [
     5window.domSearchQueries = [
    46    "body",
    57    "<body",
     
    3032    "/HTML/BODY"
    3133];
     34
     35});
  • trunk/Source/WebInspectorUI/ChangeLog

    r188586 r188598  
     12015-08-18  Brian Burg  <bburg@apple.com>
     2
     3        Web Inspector: load ProtocolTestStub from the WebInspectorUI bundle
     4        https://bugs.webkit.org/show_bug.cgi?id=147955
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        Move ProtocolTestStub.{html,js} into the actual WebInspectorUI project.
     9
     10        * UserInterface/Base/TestStub.js: Renamed from LayoutTests/http/tests/inspector/resources/ProtocolTestStub.js.
     11        * UserInterface/TestStub.html: Renamed from LayoutTests/http/tests/inspector/resources/ProtocolTestStub.html.
     12
    1132015-08-18  Devin Rousso  <drousso@apple.com>
    214
  • trunk/Source/WebInspectorUI/UserInterface/Base/TestStub.js

    r188597 r188598  
    6464    }
    6565
    66     importScript(scriptName)
    67     {
    68         var xhr = new XMLHttpRequest();
    69         var isAsyncRequest = false;
    70         xhr.open("GET", scriptName, isAsyncRequest);
    71         xhr.send(null);
    72         if (xhr.status !== 0 && xhr.status !== 200)
    73             throw new Error("Invalid script URL: " + scriptName);
    74         var script = `// From InjectedTestHarness.importScript(${scriptName})
    75 try {
    76     ${xhr.responseText}
    77 } catch (e) {
    78     alert(${JSON.stringify("Error in: " + scriptName)});
    79     throw e;
    80 }`;
    81         window.eval(script);
    82     }
    83 
    8466    get logCount()
    8567    {
  • trunk/Source/WebInspectorUI/UserInterface/TestStub.html

    r188597 r188598  
    11<!--
    2 Copyright (C) 2012 Samsung Electronics. All rights reserved.
    32Copyright (C) 2015 Apple Inc. All rights reserved.
    43
     
    2625<html>
    2726<head>
    28     <script type="text/javascript" src="ProtocolTestStub.js"></script>
     27    <script type="text/javascript" src="Base/TestStub.js"></script>
    2928</head>
    3029</html>
  • trunk/Tools/ChangeLog

    r188596 r188598  
     12015-08-18  Brian Burg  <bburg@apple.com>
     2
     3        Web Inspector: load ProtocolTestStub from the WebInspectorUI bundle
     4        https://bugs.webkit.org/show_bug.cgi?id=147955
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        To enable sharing of common test code between protocol and model tests,
     9        start loading the protocol TestStub.js through the WebInspectorUI bundle.
     10
     11        This patch adds the read-only getter TestRunner.inspectorTestStubURL, which
     12        protocol-test.js uses to load the inspector frontend stub into its iframe
     13        from an arbitrary local file URL.
     14
     15        * DumpRenderTree/TestRunner.cpp:
     16        (getInspectorTestStubURLCallback):
     17        (TestRunner::staticValues):
     18        * DumpRenderTree/TestRunner.h:
     19        * DumpRenderTree/mac/TestRunnerMac.mm:
     20        (SOFT_LINK_STAGED_FRAMEWORK):
     21        (TestRunner::inspectorTestStubURL):
     22        * DumpRenderTree/win/TestRunnerWin.cpp:
     23        (TestRunner::inspectorTestStubURL):
     24        * WebKitTestRunner/Configurations/Base.xcconfig:
     25        Since WebKitTestRunner now includes WebCore private headers, also search
     26        for the WebCore framework inside the WebKit umbrella framework.
     27
     28        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
     29        * WebKitTestRunner/InjectedBundle/TestRunner.h:
     30        * WebKitTestRunner/InjectedBundle/efl/TestRunnerEfl.cpp:
     31        (WTR::TestRunner::inspectorTestStubURL):
     32        * WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp:
     33        (WTR::TestRunner::inspectorTestStubURL):
     34        * WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm:
     35        (WTR::TestRunner::inspectorTestStubURL):
     36
    1372015-08-18  Filip Pizlo  <fpizlo@apple.com>
    238
  • trunk/Tools/DumpRenderTree/TestRunner.cpp

    r188579 r188598  
    17911791}
    17921792
     1793static JSValueRef getInspectorTestStubURLCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
     1794{
     1795    TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
     1796    JSRetainPtr<JSStringRef> url(Adopt, controller->inspectorTestStubURL());
     1797    return JSValueMakeString(context, url.get());
     1798}
     1799
    17931800static bool setGlobalFlagCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
    17941801{
     
    19841991        { "databaseDefaultQuota", getDatabaseDefaultQuotaCallback, setDatabaseDefaultQuotaCallback, kJSPropertyAttributeNone },
    19851992        { "databaseMaxQuota", getDatabaseMaxQuotaCallback, setDatabaseMaxQuotaCallback, kJSPropertyAttributeNone },
     1993        { "inspectorTestStubURL", getInspectorTestStubURLCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    19861994        { 0, 0, 0, 0 }
    19871995    };
  • trunk/Tools/DumpRenderTree/TestRunner.h

    r188579 r188598  
    309309    void closeWebInspector();
    310310    void evaluateInWebInspector(JSStringRef script);
     311    JSStringRef inspectorTestStubURL();
     312
    311313    void evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script);
    312314    void evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, JSObjectRef globalObject, JSStringRef script);
  • trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm

    r188579 r188598  
    4444#import <JavaScriptCore/JSStringRefCF.h>
    4545#import <WebCore/GeolocationPosition.h>
     46#import <WebCore/SoftLinking.h>
    4647#import <WebKit/DOMDocument.h>
    4748#import <WebKit/DOMElement.h>
     
    8990#endif
    9091
     92SOFT_LINK_STAGED_FRAMEWORK(WebInspectorUI, PrivateFrameworks, A)
     93
    9194#if !PLATFORM(IOS)
    9295@interface CommandValidationTarget : NSObject <NSValidatedUserInterfaceItem>
     
    781784}
    782785
     786JSStringRef TestRunner::inspectorTestStubURL()
     787{
     788    // Call the soft link framework function to dlopen it, then CFBundleGetBundleWithIdentifier will work.
     789    WebInspectorUILibrary();
     790
     791    CFBundleRef inspectorBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebInspectorUI"));
     792    if (!inspectorBundle)
     793        return nullptr;
     794
     795    RetainPtr<CFURLRef> url = adoptCF(CFBundleCopyResourceURL(inspectorBundle, CFSTR("TestStub"), CFSTR("html"), NULL));
     796    if (!url)
     797        return nullptr;
     798
     799    CFStringRef urlString = CFURLGetString(url.get());
     800    return JSStringCreateWithCFString(urlString);
     801}
     802
    783803typedef HashMap<unsigned, RetainPtr<WebScriptWorld> > WorldMap;
    784804static WorldMap& worldMap()
  • trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp

    r188579 r188598  
    10941094}
    10951095
     1096JSStringRef TestRunner::inspectorTestStubURL()
     1097{
     1098    // FIXME: Implement this to support Web Inspector tests using `protocol-test.js`.
     1099    // See https://bugs.webkit.org/show_bug.cgi?id=148025.
     1100    printf("ERROR: TestRunner::inspectorTestStubURL() not implemented\n");
     1101
     1102    return nullptr;
     1103}
     1104
    10961105typedef HashMap<unsigned, COMPtr<IWebScriptWorld> > WorldMap;
    10971106static WorldMap& worldMap()
  • trunk/Tools/WebKitTestRunner/Configurations/Base.xcconfig

    r184845 r188598  
    5757WEBCORE_PRIVATE_HEADERS_DIR = $(WEBKIT_UMBRELLA_FRAMEWORKS_DIR)/WebCore.framework/PrivateHeaders;
    5858
    59 FRAMEWORK_SEARCH_PATHS = $(inherited) $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks;
     59FRAMEWORK_SEARCH_PATHS = $(inherited) $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Versions/A/Frameworks;
    6060
    6161WEBKIT_SYSTEM_INTERFACE_LIBRARY = WebKitSystemInterface
  • trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl

    r188579 r188598  
    126126    void closeWebInspector();
    127127    void evaluateInWebInspector(DOMString script);
     128    readonly attribute DOMString inspectorTestStubURL;
    128129
    129130    void setPOSIXLocale(DOMString locale);
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h

    r188579 r188598  
    200200    void closeWebInspector();
    201201    void evaluateInWebInspector(JSStringRef script);
     202    JSRetainPtr<JSStringRef> inspectorTestStubURL();
    202203
    203204    void setPOSIXLocale(JSStringRef);
  • trunk/Tools/WebKitTestRunner/InjectedBundle/efl/TestRunnerEfl.cpp

    r188579 r188598  
    2424#include <Ecore.h>
    2525#include <JavaScriptCore/OpaqueJSString.h>
     26#include <WebCore/EflInspectorUtilities.h>
    2627#include <wtf/text/CString.h>
     28#include <wtf/text/StringBuilder.h>
    2729#include <wtf/text/WTFString.h>
    2830
     
    8385}
    8486
     87JSRetainPtr<JSStringRef> TestRunner::inspectorTestStubURL()
     88{
     89    StringBuilder builder;
     90    builder.append("file://");
     91    builder.append(WebCore::inspectorResourcePath());
     92    builder.appendLiteral("/TestStub.html");
     93
     94    return JSStringCreateWithUTF8CString(builder.toString().utf8().data());
     95}
     96
    8597} // namespace WTR
  • trunk/Tools/WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp

    r188579 r188598  
    6868}
    6969
     70JSRetainPtr<JSStringRef> TestRunner::inspectorTestStubURL()
     71{
     72    return JSStringCreateWithUTF8CString("resource:///org/webkitgtk/inspector/UserInterface/TestStub.html");
     73}
     74
    7075} // namespace WTR
  • trunk/Tools/WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm

    r188579 r188598  
    11/*
    2  * Copyright (C) 2010 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010, 2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #include "TestRunner.h"
     26#import "config.h"
     27#import "TestRunner.h"
    2728
    28 #include "InjectedBundle.h"
     29#import "InjectedBundle.h"
     30#import <JavaScriptCore/JSStringRefCF.h>
     31#import <WebCore/SoftLinking.h>
     32
     33SOFT_LINK_STAGED_FRAMEWORK(WebInspectorUI, PrivateFrameworks, A)
    2934
    3035namespace WTR {
     
    6368}
    6469
     70JSRetainPtr<JSStringRef> TestRunner::inspectorTestStubURL()
     71{
     72    // Call the soft link framework function to dlopen it, then CFBundleGetBundleWithIdentifier will work.
     73    WebInspectorUILibrary();
     74
     75    CFBundleRef inspectorBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebInspectorUI"));
     76    if (!inspectorBundle)
     77        return nullptr;
     78
     79    RetainPtr<CFURLRef> url = adoptCF(CFBundleCopyResourceURL(inspectorBundle, CFSTR("TestStub"), CFSTR("html"), NULL));
     80    if (!url)
     81        return nullptr;
     82
     83    CFStringRef urlString = CFURLGetString(url.get());
     84    return adopt(JSStringCreateWithCFString(urlString));
     85}
     86
    6587} // namespace WTR
Note: See TracChangeset for help on using the changeset viewer.