Web Inspector: implement testing harness for pure protocol tests.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Sep 2012 11:38:00 +0000 (11:38 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Sep 2012 11:38:00 +0000 (11:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=90675

Patch by Vivek Galatage <vivekgalatage@gmail.com> on 2012-09-24
Reviewed by Yury Semikhatsky.

.:

Added export symbols required for Gtk+ to support the Inspector Protocol
testing harness.

* Source/autotools/symbols.filter:

Source/WebCore:

Implementing the testing harness as the APIs of Internals object not
only reduced platform specific patching of DRTs but also minimized the
the effort required to open up the new dummy inspector Frontend.

The openDummyInspectorFrontend method will return the handle to newly
created DOMWindow. This DOMWindow object can be utilized inside the test
case to communicate using postMessage WebAPI.

The newly created DOMWindow will host the protocol-test.html which
will seed the necessary JS libraries to communicate with the
InspectorBackend.

Test: inspector-protocol/css-getSupportedCSSProperties.html

* WebCore.exp.in:
* WebCore.gypi:
* inspector/InspectorClient.h:
(InspectorClient):
* testing/Internals.cpp:
(InspectorFrontendClientDummy):
(WebCore::InspectorFrontendClientDummy::~InspectorFrontendClientDummy):
(WebCore):
(WebCore::InspectorFrontendClientDummy::InspectorFrontendClientDummy):
(InspectorFrontendChannelDummy):
(WebCore::InspectorFrontendChannelDummy::~InspectorFrontendChannelDummy):
(WebCore::InspectorFrontendChannelDummy::InspectorFrontendChannelDummy):
(WebCore::InspectorFrontendChannelDummy::sendMessageToFrontend):
(WebCore::Internals::consoleMessageArgumentCounts):
(WebCore::Internals::openDummyInspectorFrontend):
(WebCore::Internals::closeDummyInspectorFrontend):
* testing/Internals.h:
(WebCore):
(Internals):
* testing/Internals.idl:

Source/WebKit2:

Adding the export symbol definitions required on Apple Windows and WinCairo
ports to support Inspector Protocol testing harness.

* win/WebKit2.def:
* win/WebKit2CFLite.def:

LayoutTests:

Adding the resources required for the dummy frontend page to load minimal
frontend. These resources provide the mechanism to talk to the Inspector Backend.

Adding the inspector-protocol folder to host the relevant test cases
utilizing the inspector protocol test harness. Added an example test
case for getting all supported CSS properties using the inspector
protocol and searching for a particular property being supported.

* http/tests/inspector-protocol: Added.
* http/tests/inspector-protocol/resources: Added.
* http/tests/inspector-protocol/resources/InspectorTest.js: Added.
(InspectorTest.sendCommand):
(WebInspector.dispatchMessageFromBackend):
(InspectorTest.log):
(InspectorTest.completeTest):
* http/tests/inspector-protocol/resources/protocol-test.html: Added.
* http/tests/inspector-protocol/resources/protocol-test.js: Added.
(log):
(closeTest):
(runTest):
* inspector-protocol: Added.
* inspector-protocol/css-getSupportedCSSProperties-expected.txt: Added.
* inspector-protocol/css-getSupportedCSSProperties.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@129346 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
ChangeLog
LayoutTests/ChangeLog
LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js [new file with mode: 0644]
LayoutTests/http/tests/inspector-protocol/resources/protocol-test.html [new file with mode: 0644]
LayoutTests/http/tests/inspector-protocol/resources/protocol-test.js [new file with mode: 0644]
LayoutTests/inspector-protocol/css-getSupportedCSSProperties-expected.txt [new file with mode: 0644]
LayoutTests/inspector-protocol/css-getSupportedCSSProperties.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.gypi
Source/WebCore/inspector/InspectorClient.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebKit2/ChangeLog
Source/WebKit2/win/WebKit2.def
Source/WebKit2/win/WebKit2CFLite.def
Source/autotools/symbols.filter

index 5f59746..431f632 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2012-09-24  Vivek Galatage  <vivekgalatage@gmail.com>
+
+        Web Inspector: implement testing harness for pure protocol tests.
+        https://bugs.webkit.org/show_bug.cgi?id=90675
+
+        Reviewed by Yury Semikhatsky.
+
+        Added export symbols required for Gtk+ to support the Inspector Protocol
+        testing harness.
+
+        * Source/autotools/symbols.filter:
+
 2012-09-24  Simon Hausmann  <simon.hausmann@digia.com>
 
         [Qt] Fix build with latest Qt 5
index 0c7d871..5760693 100644 (file)
@@ -1,3 +1,34 @@
+2012-09-24  Vivek Galatage  <vivekgalatage@gmail.com>
+
+        Web Inspector: implement testing harness for pure protocol tests.
+        https://bugs.webkit.org/show_bug.cgi?id=90675
+
+        Reviewed by Yury Semikhatsky.
+
+        Adding the resources required for the dummy frontend page to load minimal 
+        frontend. These resources provide the mechanism to talk to the Inspector Backend.
+        
+        Adding the inspector-protocol folder to host the relevant test cases
+        utilizing the inspector protocol test harness. Added an example test
+        case for getting all supported CSS properties using the inspector
+        protocol and searching for a particular property being supported.
+
+        * http/tests/inspector-protocol: Added.
+        * http/tests/inspector-protocol/resources: Added.
+        * http/tests/inspector-protocol/resources/InspectorTest.js: Added.
+        (InspectorTest.sendCommand):
+        (WebInspector.dispatchMessageFromBackend):
+        (InspectorTest.log):
+        (InspectorTest.completeTest):
+        * http/tests/inspector-protocol/resources/protocol-test.html: Added.
+        * http/tests/inspector-protocol/resources/protocol-test.js: Added.
+        (log):
+        (closeTest):
+        (runTest):
+        * inspector-protocol: Added.
+        * inspector-protocol/css-getSupportedCSSProperties-expected.txt: Added.
+        * inspector-protocol/css-getSupportedCSSProperties.html: Added.
+
 2012-09-24  Keishi Hattori  <keishi@webkit.org>
 
         REGRESSION(r127727): Calendar picker focus doesn't loop in calendar-picker.html
diff --git a/LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js b/LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js
new file mode 100644 (file)
index 0000000..ed4fab3
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. 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.
+ */
+WebInspector = {};
+
+InspectorTest = {};
+InspectorTest._dispatchTable = [];
+InspectorTest._requestId = -1;
+
+/**
+ * @param {string} method
+ * @param {object} params
+ * @param {function({object} messageObject)=} handler
+ */
+InspectorTest.sendCommand = function(method, params, handler)
+{
+    this._dispatchTable[++this._requestId] = handler;
+
+    var messageObject = { "method": method,
+                          "params": params,
+                          "id": this._requestId };
+
+    InspectorFrontendHost.sendMessageToBackend(JSON.stringify(messageObject));
+
+    return this._requestId;
+}
+
+/**
+ * @param {object} messageObject
+ */
+WebInspector.dispatchMessageFromBackend = function(messageObject)
+{
+    var messageId = messageObject["id"];
+    if (typeof messageId === "number") {
+        var handler = InspectorTest._dispatchTable[messageId];
+        if (handler && typeof handler === "function")
+            handler(messageObject);
+    }
+}
+
+/**
+* @param {string} message
+*/
+InspectorTest.log = function(message)
+{
+    this.sendCommand("Runtime.evaluate", { "expression": "log(\"" + message + "\");"} );
+}
+
+InspectorTest.completeTest = function()
+{
+    this.sendCommand("Runtime.evaluate", { "expression": "closeTest();"} );
+}
+
+window.addEventListener("message", function(event) {
+    eval(event.data);
+});
diff --git a/LayoutTests/http/tests/inspector-protocol/resources/protocol-test.html b/LayoutTests/http/tests/inspector-protocol/resources/protocol-test.html
new file mode 100644 (file)
index 0000000..e73440b
--- /dev/null
@@ -0,0 +1,29 @@
+<!--
+Copyright (C) 2012 Samsung Electronics. 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="InspectorTest.js"></script>
+</head>
+</html>
diff --git a/LayoutTests/http/tests/inspector-protocol/resources/protocol-test.js b/LayoutTests/http/tests/inspector-protocol/resources/protocol-test.js
new file mode 100644 (file)
index 0000000..0d0015d
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. 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.
+ */
+var outputElement;
+
+/**
+ * @param {string} text
+ */
+function log(text)
+{
+    if (!outputElement) {
+        var intermediate = document.createElement("div");
+        document.body.appendChild(intermediate);
+
+        var intermediate2 = document.createElement("div");
+        intermediate.appendChild(intermediate2);
+
+        outputElement = document.createElement("div");
+        outputElement.className = "output";
+        outputElement.id = "output";
+        outputElement.style.whiteSpace = "pre";
+        intermediate2.appendChild(outputElement);
+    }
+    outputElement.appendChild(document.createTextNode(text));
+    outputElement.appendChild(document.createElement("br"));
+}
+
+function closeTest()
+{
+    window.internals.closeDummyInspectorFrontend();
+    testRunner.notifyDone();
+}
+
+function runTest()
+{
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+    testRunner.setCanOpenWindows(true);
+
+    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;
+        }
+    }
+
+    var url = scriptUrlBasePath + "/protocol-test.html";
+    var inspectorFrontend = window.internals.openDummyInspectorFrontend(url);
+
+    inspectorFrontend.addEventListener("load", function(event) {
+        inspectorFrontend.postMessage("(" + test.toString() +")();", "*");
+    });
+}
diff --git a/LayoutTests/inspector-protocol/css-getSupportedCSSProperties-expected.txt b/LayoutTests/inspector-protocol/css-getSupportedCSSProperties-expected.txt
new file mode 100644 (file)
index 0000000..af0b2cc
--- /dev/null
@@ -0,0 +1,2 @@
+box-shadow is supported
+
diff --git a/LayoutTests/inspector-protocol/css-getSupportedCSSProperties.html b/LayoutTests/inspector-protocol/css-getSupportedCSSProperties.html
new file mode 100644 (file)
index 0000000..3d46d48
--- /dev/null
@@ -0,0 +1,35 @@
+<html>
+<head>
+<script type="text/javascript" src="../http/tests/inspector-protocol/resources/protocol-test.js"></script>
+<script>
+function test()
+{
+    function handleSupportedCSSProperties(messageObject)
+    {
+        if ("error" in messageObject)
+            InspectorTest.log(messageObject.error.message);
+        else {
+            var cssProperty = "box-shadow";
+            var entries = messageObject["result"]["cssProperties"];
+
+            for (var i = 0; i < entries.length; ++i) {
+                if (entries[i].name === cssProperty) {
+                    InspectorTest.log(entries[i].name + " is supported");
+                    break;
+                }
+            }
+
+            if (i === entries.length)
+                InspectorTest.log(cssProperty + " is NOT supported");
+        }
+
+        InspectorTest.completeTest();
+    }
+
+    InspectorTest.sendCommand("CSS.getSupportedCSSProperties", {}, handleSupportedCSSProperties);
+}
+</script>
+</head>
+<body onLoad="runTest();">
+</body>
+</html>
index 3e2f2c7..bd08675 100644 (file)
@@ -1,3 +1,45 @@
+2012-09-24  Vivek Galatage  <vivekgalatage@gmail.com>
+
+        Web Inspector: implement testing harness for pure protocol tests.
+        https://bugs.webkit.org/show_bug.cgi?id=90675
+
+        Reviewed by Yury Semikhatsky.
+
+        Implementing the testing harness as the APIs of Internals object not
+        only reduced platform specific patching of DRTs but also minimized the
+        the effort required to open up the new dummy inspector Frontend. 
+        
+        The openDummyInspectorFrontend method will return the handle to newly 
+        created DOMWindow. This DOMWindow object can be utilized inside the test 
+        case to communicate using postMessage WebAPI.
+        
+        The newly created DOMWindow will host the protocol-test.html which
+        will seed the necessary JS libraries to communicate with the
+        InspectorBackend.
+
+        Test: inspector-protocol/css-getSupportedCSSProperties.html
+
+        * WebCore.exp.in:
+        * WebCore.gypi:
+        * inspector/InspectorClient.h:
+        (InspectorClient):
+        * testing/Internals.cpp:
+        (InspectorFrontendClientDummy):
+        (WebCore::InspectorFrontendClientDummy::~InspectorFrontendClientDummy):
+        (WebCore):
+        (WebCore::InspectorFrontendClientDummy::InspectorFrontendClientDummy):
+        (InspectorFrontendChannelDummy):
+        (WebCore::InspectorFrontendChannelDummy::~InspectorFrontendChannelDummy):
+        (WebCore::InspectorFrontendChannelDummy::InspectorFrontendChannelDummy):
+        (WebCore::InspectorFrontendChannelDummy::sendMessageToFrontend):
+        (WebCore::Internals::consoleMessageArgumentCounts):
+        (WebCore::Internals::openDummyInspectorFrontend):
+        (WebCore::Internals::closeDummyInspectorFrontend):
+        * testing/Internals.h:
+        (WebCore):
+        (Internals):
+        * testing/Internals.idl:
+
 2012-09-24  Keishi Hattori  <keishi@webkit.org>
 
         REGRESSION(r127727): Calendar picker focus doesn't loop in calendar-picker.html
index dff830d..58c504d 100644 (file)
@@ -2235,6 +2235,7 @@ __ZN7WebCore16HTMLInputElement25selectColorInColorChooserERKNS_5ColorE
 __ZN7WebCore15InspectorClient31doDispatchMessageOnFrontendPageEPNS_4PageERKN3WTF6StringE
 __ZN7WebCore17InspectorCounters12counterValueENS0_11CounterTypeE
 __ZN7WebCore19InspectorController15profilerEnabledEv
+__ZN7WebCore19InspectorController15connectFrontendEPNS_24InspectorFrontendChannelE
 __ZN7WebCore19InspectorController18disconnectFrontendEv
 __ZN7WebCore19InspectorController18setProfilerEnabledEb
 __ZN7WebCore19InspectorController25evaluateForTestInFrontendElRKN3WTF6StringE
@@ -2273,7 +2274,11 @@ __ZN7WebCore28InspectorFrontendClientLocal27setTimelineProfilingEnabledEb
 __ZN7WebCore28InspectorFrontendClientLocal31constrainedAttachedWindowHeightEjj
 __ZN7WebCore28InspectorFrontendClientLocalC2EPNS_19InspectorControllerEPNS_4PageEN3WTF10PassOwnPtrINS0_8SettingsEEE
 __ZN7WebCore28InspectorFrontendClientLocalD2Ev
+__ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_9DOMWindowE
+__ZN7WebCore9DOMWindow4openERKN3WTF6StringERKNS1_12AtomicStringES4_PS0_S8_
+__ZN7WebCore9DOMWindow5closeEPNS_22ScriptExecutionContextE
 __ZNK7WebCore19InspectorController13drawHighlightERNS_15GraphicsContextE
+__ZNK7WebCore9DOMWindow8documentEv
 #endif
 
 #if ENABLE(INSPECTOR) && PLATFORM(IOS)
index e8af673..a62bae2 100644 (file)
           'testing/MallocStatistics.idl',
         ],
         'webcore_test_support_files': [
+            'inspector/InspectorFrontendClientLocal.cpp',
+            'inspector/InspectorFrontendClientLocal.h',
             'testing/v8/WebCoreTestSupport.cpp',
             'testing/v8/WebCoreTestSupport.h',
             'testing/js/WebCoreTestSupport.cpp',
index fc8d024..e8d2659 100644 (file)
@@ -71,7 +71,7 @@ public:
 
     virtual bool supportsFrameInstrumentation() { return false; }
 
-    bool doDispatchMessageOnFrontendPage(Page* frontendPage, const String& message);
+    static bool doDispatchMessageOnFrontendPage(Page* frontendPage, const String& message);
 };
 
 } // namespace WebCore
index 3afb334..ab72ac0 100644 (file)
@@ -32,6 +32,7 @@
 #include "ClientRectList.h"
 #include "ComposedShadowTreeWalker.h"
 #include "DOMStringList.h"
+#include "DOMWindow.h"
 #include "Document.h"
 #include "DocumentMarker.h"
 #include "DocumentMarkerController.h"
 #include "HTMLNames.h"
 #include "HTMLTextAreaElement.h"
 #include "HistoryItem.h"
+#include "InspectorClient.h"
 #include "InspectorConsoleAgent.h"
 #include "InspectorController.h"
 #include "InspectorCounters.h"
+#include "InspectorFrontendChannel.h"
+#include "InspectorFrontendClientLocal.h"
 #include "InspectorInstrumentation.h"
 #include "InspectorOverlay.h"
 #include "InstrumentingAgents.h"
@@ -105,6 +109,50 @@ namespace WebCore {
 
 using namespace HTMLNames;
 
+class InspectorFrontendClientDummy : public InspectorFrontendClientLocal {
+public:
+    InspectorFrontendClientDummy(InspectorController*, Page*);
+    virtual ~InspectorFrontendClientDummy() { }
+    virtual void attachWindow() OVERRIDE { }
+    virtual void detachWindow() OVERRIDE { }
+
+    virtual String localizedStringsURL() OVERRIDE { return String(); }
+    virtual String hiddenPanels() OVERRIDE { return String(); }
+
+    virtual void bringToFront() OVERRIDE { }
+    virtual void closeWindow() OVERRIDE { }
+
+    virtual void inspectedURLChanged(const String&) OVERRIDE { }
+
+protected:
+    virtual void setAttachedWindowHeight(unsigned) OVERRIDE { }
+};
+
+InspectorFrontendClientDummy::InspectorFrontendClientDummy(InspectorController* controller, Page* page)
+    : InspectorFrontendClientLocal(controller, page, adoptPtr(new InspectorFrontendClientLocal::Settings()))
+{
+}
+
+class InspectorFrontendChannelDummy : public InspectorFrontendChannel {
+public:
+    explicit InspectorFrontendChannelDummy(Page*);
+    virtual ~InspectorFrontendChannelDummy() { }
+    virtual bool sendMessageToFrontend(const String& message) OVERRIDE;
+
+private:
+    Page* m_frontendPage;
+};
+
+InspectorFrontendChannelDummy::InspectorFrontendChannelDummy(Page* page)
+    : m_frontendPage(page)
+{
+}
+
+bool InspectorFrontendChannelDummy::sendMessageToFrontend(const String& message)
+{
+    return InspectorClient::doDispatchMessageOnFrontendPage(m_frontendPage, message);
+}
+
 static bool markerTypesFrom(const String& markerType, DocumentMarker::MarkerTypes& result)
 {
     if (markerType.isEmpty() || equalIgnoringCase(markerType, "all"))
@@ -1061,6 +1109,45 @@ Vector<String> Internals::consoleMessageArgumentCounts(Document* document) const
         result[i] = String::number(counts[i]);
     return result;
 }
+
+PassRefPtr<DOMWindow> Internals::openDummyInspectorFrontend(const String& url)
+{
+    Page* page = contextDocument()->frame()->page();
+    ASSERT(page);
+
+    DOMWindow* window = page->mainFrame()->document()->domWindow();
+    ASSERT(window);
+
+    m_frontendWindow = window->open(url, "", "", window, window);
+    ASSERT(m_frontendWindow);
+
+    Page* frontendPage = m_frontendWindow->document()->page();
+    ASSERT(frontendPage);
+
+    OwnPtr<InspectorFrontendClientDummy> frontendClient = adoptPtr(new InspectorFrontendClientDummy(page->inspectorController(), frontendPage));
+
+    frontendPage->inspectorController()->setInspectorFrontendClient(frontendClient.release());
+
+    m_frontendChannel = adoptPtr(new InspectorFrontendChannelDummy(frontendPage));
+
+    page->inspectorController()->connectFrontend(m_frontendChannel.get());
+
+    return m_frontendWindow;
+}
+
+void Internals::closeDummyInspectorFrontend()
+{
+    Page* page = contextDocument()->frame()->page();
+    ASSERT(page);
+    ASSERT(m_frontendWindow);
+
+    page->inspectorController()->disconnectFrontend();
+
+    m_frontendChannel.release();
+
+    m_frontendWindow->close(m_frontendWindow->scriptExecutionContext());
+    m_frontendWindow.release();
+}
 #endif // ENABLE(INSPECTOR)
 
 bool Internals::hasGrammarMarker(Document* document, int from, int length, ExceptionCode&)
index d2d452e..c3c4cb4 100644 (file)
@@ -38,10 +38,12 @@ namespace WebCore {
 class ClientRect;
 class ClientRectList;
 class DOMStringList;
+class DOMWindow;
 class Document;
 class DocumentMarker;
 class Element;
 class Frame;
+class InspectorFrontendChannelDummy;
 class InternalSettings;
 class Node;
 class PagePopupController;
@@ -192,6 +194,8 @@ public:
     unsigned numberOfLiveNodes() const;
     unsigned numberOfLiveDocuments() const;
     Vector<String> consoleMessageArgumentCounts(Document*) const;
+    PassRefPtr<DOMWindow> openDummyInspectorFrontend(const String& url);
+    void closeDummyInspectorFrontend();
 #endif
 
     String counterValue(Element*);
@@ -223,6 +227,10 @@ private:
     Frame* frame() const;
 
     DocumentMarker* markerAt(Node*, const String& markerType, unsigned index, ExceptionCode&);
+#if ENABLE(INSPECTOR)
+    RefPtr<DOMWindow> m_frontendWindow;
+    OwnPtr<InspectorFrontendChannelDummy> m_frontendChannel;
+#endif
 };
 
 } // namespace WebCore
index 3bd9129..f7d0bce 100644 (file)
@@ -171,6 +171,8 @@ module window {
         [Conditional=INSPECTOR] unsigned long numberOfLiveNodes();
         [Conditional=INSPECTOR] unsigned long numberOfLiveDocuments();
         [Conditional=INSPECTOR] sequence<String> consoleMessageArgumentCounts(in Document document);
+        [Conditional=INSPECTOR] DOMWindow openDummyInspectorFrontend(in DOMString url);
+        [Conditional=INSPECTOR] void closeDummyInspectorFrontend();
 
         DOMString counterValue(in Element element);
         long pageNumber(in Element element, in [Optional] float pageWidth, in [Optional] float pageHeight);
index 18bdebe..8dcc8ac 100644 (file)
@@ -1,3 +1,16 @@
+2012-09-24  Vivek Galatage  <vivekgalatage@gmail.com>
+
+        Web Inspector: implement testing harness for pure protocol tests.
+        https://bugs.webkit.org/show_bug.cgi?id=90675
+
+        Reviewed by Yury Semikhatsky.
+
+        Adding the export symbol definitions required on Apple Windows and WinCairo
+        ports to support Inspector Protocol testing harness.
+
+        * win/WebKit2.def:
+        * win/WebKit2CFLite.def:
+
 2012-09-24  KwangYong Choi  <ky0.choi@samsung.com>
 
         [EFL][WK2] Invalid featuring of INPUT_TYPE_COLOR in test_ewk2_view.
index 1cdc404..f4578f7 100644 (file)
@@ -289,3 +289,23 @@ EXPORTS
         ?numberOfPages@PrintContext@WebCore@@SAHPAVFrame@2@ABVFloatSize@2@@Z
         ?pageProperty@PrintContext@WebCore@@SA?AVString@WTF@@PAVFrame@2@PBDH@Z
         ?pageSizeAndMarginsInPixels@PrintContext@WebCore@@SA?AVString@WTF@@PAVFrame@2@HHHHHHH@Z
+        ??0InspectorFrontendClientLocal@WebCore@@QAE@PAVInspectorController@1@PAVPage@1@V?$PassOwnPtr@VSettings@InspectorFrontendClientLocal@WebCore@@@WTF@@@Z
+        ??1InspectorFrontendClientLocal@WebCore@@UAE@XZ
+        ?changeAttachedWindowHeight@InspectorFrontendClientLocal@WebCore@@UAEXI@Z
+        ?close@DOMWindow@WebCore@@QAEXPAVScriptExecutionContext@2@@Z
+        ?connectFrontend@InspectorController@WebCore@@QAEXPAVInspectorFrontendChannel@2@@Z
+        ?disconnectFrontend@InspectorController@WebCore@@QAEXXZ
+        ?document@DOMWindow@WebCore@@QBEPAVDocument@2@XZ
+        ?doDispatchMessageOnFrontendPage@InspectorClient@WebCore@@SA_NPAVPage@2@ABVString@WTF@@@Z
+        ?frontendLoaded@InspectorFrontendClientLocal@WebCore@@UAEXXZ
+        ?getProperty@Settings@InspectorFrontendClientLocal@WebCore@@UAE?AVString@WTF@@ABV45@@Z
+        ?moveWindowBy@InspectorFrontendClientLocal@WebCore@@UAEXMM@Z
+        ?open@DOMWindow@WebCore@@QAE?AV?$PassRefPtr@VDOMWindow@WebCore@@@WTF@@ABVString@4@ABVAtomicString@4@0PAV12@2@Z
+        ?openInNewTab@InspectorFrontendClientLocal@WebCore@@UAEXABVString@WTF@@@Z
+        ?requestAttachWindow@InspectorFrontendClientLocal@WebCore@@UAEXXZ
+        ?requestDetachWindow@InspectorFrontendClientLocal@WebCore@@UAEXXZ
+        ?sendMessageToBackend@InspectorFrontendClientLocal@WebCore@@UAEXABVString@WTF@@@Z
+        ?setInspectorFrontendClient@InspectorController@WebCore@@QAEXV?$PassOwnPtr@VInspectorFrontendClient@WebCore@@@WTF@@@Z
+        ?setProperty@Settings@InspectorFrontendClientLocal@WebCore@@UAEXABVString@WTF@@0@Z
+        ?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVDOMWindow@1@@Z
+        ?windowObjectCleared@InspectorFrontendClientLocal@WebCore@@UAEXXZ        
index 64bf790..3675ac2 100644 (file)
@@ -279,3 +279,23 @@ EXPORTS
         ?numberOfPages@PrintContext@WebCore@@SAHPAVFrame@2@ABVFloatSize@2@@Z
         ?pageProperty@PrintContext@WebCore@@SA?AVString@WTF@@PAVFrame@2@PBDH@Z
         ?pageSizeAndMarginsInPixels@PrintContext@WebCore@@SA?AVString@WTF@@PAVFrame@2@HHHHHHH@Z
+        ??0InspectorFrontendClientLocal@WebCore@@QAE@PAVInspectorController@1@PAVPage@1@V?$PassOwnPtr@VSettings@InspectorFrontendClientLocal@WebCore@@@WTF@@@Z
+        ??1InspectorFrontendClientLocal@WebCore@@UAE@XZ
+        ?changeAttachedWindowHeight@InspectorFrontendClientLocal@WebCore@@UAEXI@Z
+        ?close@DOMWindow@WebCore@@QAEXPAVScriptExecutionContext@2@@Z
+        ?connectFrontend@InspectorController@WebCore@@QAEXPAVInspectorFrontendChannel@2@@Z
+        ?disconnectFrontend@InspectorController@WebCore@@QAEXXZ
+        ?document@DOMWindow@WebCore@@QBEPAVDocument@2@XZ
+        ?doDispatchMessageOnFrontendPage@InspectorClient@WebCore@@SA_NPAVPage@2@ABVString@WTF@@@Z
+        ?frontendLoaded@InspectorFrontendClientLocal@WebCore@@UAEXXZ
+        ?getProperty@Settings@InspectorFrontendClientLocal@WebCore@@UAE?AVString@WTF@@ABV45@@Z
+        ?moveWindowBy@InspectorFrontendClientLocal@WebCore@@UAEXMM@Z
+        ?open@DOMWindow@WebCore@@QAE?AV?$PassRefPtr@VDOMWindow@WebCore@@@WTF@@ABVString@4@ABVAtomicString@4@0PAV12@2@Z
+        ?openInNewTab@InspectorFrontendClientLocal@WebCore@@UAEXABVString@WTF@@@Z
+        ?requestAttachWindow@InspectorFrontendClientLocal@WebCore@@UAEXXZ
+        ?requestDetachWindow@InspectorFrontendClientLocal@WebCore@@UAEXXZ
+        ?sendMessageToBackend@InspectorFrontendClientLocal@WebCore@@UAEXABVString@WTF@@@Z
+        ?setInspectorFrontendClient@InspectorController@WebCore@@QAEXV?$PassOwnPtr@VInspectorFrontendClient@WebCore@@@WTF@@@Z
+        ?setProperty@Settings@InspectorFrontendClientLocal@WebCore@@UAEXABVString@WTF@@0@Z
+        ?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVDOMWindow@1@@Z
+        ?windowObjectCleared@InspectorFrontendClientLocal@WebCore@@UAEXXZ
index d5d5410..e2a4229 100644 (file)
@@ -65,6 +65,7 @@ _ZN7WebCore14FormController22getReferencedFilePathsERKN3WTF6VectorINS1_6StringEL
 _ZN7WebCore14FrameSelection19absoluteCaretBoundsEv;
 _ZN7WebCore14SchemeRegistry49registerURLSchemeAsBypassingContentSecurityPolicyERKN3WTF6StringE;
 _ZN7WebCore14SchemeRegistry57removeURLSchemeRegisteredAsBypassingContentSecurityPolicyERKN3WTF6StringE;
+_ZN7WebCore15InspectorClient31doDispatchMessageOnFrontendPageEPNS_4PageERKN3WTF6StringE;
 _ZN7WebCore15setDOMExceptionEPN3JSC9ExecStateEi;
 _ZN7WebCore15toDOMStringListEPN3JSC9ExecStateENS0_7JSValueE;
 _ZN7WebCore16HTMLInputElement17setSuggestedValueERKN3WTF6StringE;
@@ -74,6 +75,9 @@ _ZN7WebCore17cacheDOMStructureEPNS_17JSDOMGlobalObjectEPN3JSC9StructureEPKNS2_9C
 _ZN7WebCore17HistoryController26saveDocumentAndScrollStateEv;
 _ZN7WebCore17InspectorCounters12counterValueENS0_11CounterTypeE;
 _ZN7WebCore18HTMLContentElement6createEPNS_8DocumentE;
+_ZN7WebCore19InspectorController15connectFrontendEPNS_24InspectorFrontendChannelE;
+_ZN7WebCore19InspectorController18disconnectFrontendEv;
+_ZN7WebCore19InspectorController26setInspectorFrontendClientEN3WTF10PassOwnPtrINS_23InspectorFrontendClientEEE;
 _ZN7WebCore19InspectorController39setResourcesDataSizeLimitsFromInternalsEii;
 _ZN7WebCore20CachedResourceLoader31garbageCollectDocumentResourcesEv;
 _ZN7WebCore20NodeRenderingContextC1EPNS_4NodeE;
@@ -92,10 +96,21 @@ _ZN7WebCore24DocumentMarkerController10markersForEPNS_4NodeENS_14DocumentMarker1
 _ZN7WebCore24DocumentMarkerController18addTextMatchMarkerEPKNS_5RangeEb;
 _ZN7WebCore25computeViewportAttributesENS_17ViewportArgumentsEiiifNS_7IntSizeE;
 _ZN7WebCore25jsStringWithCacheSlowCaseEPN3JSC9ExecStateERN3WTF7HashMapIPNS3_10StringImplENS0_4WeakINS0_8JSStringEEENS3_7PtrHashIS6_EENS3_10HashTraitsIS6_EENSC_IS9_EEEES6_;
+_ZN7WebCore28InspectorFrontendClientLocal12moveWindowByEff;
+_ZN7WebCore28InspectorFrontendClientLocal12openInNewTabERKN3WTF6StringE;
+_ZN7WebCore28InspectorFrontendClientLocal14frontendLoadedEv;
+_ZN7WebCore28InspectorFrontendClientLocal19requestAttachWindowEv;
+_ZN7WebCore28InspectorFrontendClientLocal19requestDetachWindowEv;
+_ZN7WebCore28InspectorFrontendClientLocal19windowObjectClearedEv;
+_ZN7WebCore28InspectorFrontendClientLocal20sendMessageToBackendERKN3WTF6StringE;
+_ZN7WebCore28InspectorFrontendClientLocal26changeAttachedWindowHeightEj;
+_ZN7WebCore28InspectorFrontendClientLocalC2EPNS_19InspectorControllerEPNS_4PageEN3WTF10PassOwnPtrINS0_8SettingsEEE;
+_ZN7WebCore28InspectorFrontendClientLocalD2Ev;
 _ZN7WebCore30overrideUserPreferredLanguagesERKN3WTF6VectorINS0_6StringELj0EEE;
 _ZN7WebCore30overrideUserPreferredLanguagesERKN3WTF6VectorINS0_6StringELm0EEE;
 _ZN7WebCore40restrictMinimumScaleFactorToViewportSizeERNS_18ViewportAttributesENS_7IntSizeE;
 _ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_13DOMStringListE;
+_ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_9DOMWindowE;
 _ZN7WebCore50restrictScaleFactorToInitialScaleIfNotUserScalableERNS_18ViewportAttributesE;
 _ZN7WebCore6JSNode10putVirtualEPN3JSC9ExecStateERKNS1_10IdentifierENS1_7JSValueERNS1_15PutPropertySlotE;
 _ZN7WebCore6JSNode20visitChildrenVirtualERN3JSC11SlotVisitorE;
@@ -105,6 +120,8 @@ _ZN7WebCore7Element20removeShadowRootListEv;
 _ZN7WebCore7Element17setShadowPseudoIdERKN3WTF12AtomicStringERi;
 _ZN7WebCore7jsArrayEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEN3WTF10PassRefPtrINS_13DOMStringListEEE;
 _ZN7WebCore7toRangeEN3JSC7JSValueE;
+_ZN7WebCore9DOMWindow4openERKN3WTF6StringERKNS1_12AtomicStringES4_PS0_S8_;
+_ZN7WebCore9DOMWindow5closeEPNS_22ScriptExecutionContextE;
 _ZN7WebCore9JSElement10putVirtualEPN3JSC9ExecStateERKNS1_10IdentifierENS1_7JSValueERNS1_15PutPropertySlotE;
 _ZN7WebCore9JSElement6s_infoE;
 _ZN7WebCore9toElementEN3JSC7JSValueE;
@@ -182,6 +199,8 @@ _ZN7WebCore26ContextDestructionObserver16contextDestroyedEv;
 _ZN7WebCore12PrintContext13numberOfPagesEPNS_5FrameERKNS_9FloatSizeE;
 _ZN7WebCore12PrintContext12pagePropertyEPNS_5FrameEPKci;
 _ZN7WebCore12PrintContext26pageSizeAndMarginsInPixelsEPNS_5FrameEiiiiiii;
+_ZNK7WebCore9DOMWindow8documentEv;
+_ZTVN7WebCore28InspectorFrontendClientLocal8SettingsE;
 
 local:
 _Z*;