Commit ccbb681c authored by mjs@apple.com's avatar mjs@apple.com

2011-01-26 Maciej Stachowiak <mjs@apple.com>

        Reviewed by Dan Bernstein.

        WebKitTestRunner needs to support layoutTestController.evaluateInWebInspector
        https://bugs.webkit.org/show_bug.cgi?id=42319
        
        Unskip inspector tests (except the few that mysteriously fail).

        * platform/mac-wk2/Skipped:
2011-01-26  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Dan Bernstein.

        WebKitTestRunner needs to support layoutTestController.evaluateInWebInspector
        https://bugs.webkit.org/show_bug.cgi?id=42319
        
        Add evaluateInWebInspector and other APIs needed for inspector tests to run.

        * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
        (WTR::LayoutTestController::showWebInspector):
        (WTR::LayoutTestController::closeWebInspector):
        (WTR::LayoutTestController::evaluateInWebInspector):
        (WTR::LayoutTestController::setTimelineProfilingEnabled):
        * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
        * WebKitTestRunner/TestInvocation.cpp:
        (WTR::shouldOpenWebInspector):
        (WTR::TestInvocation::invoke):
        * WebKitTestRunner/WebKitTestRunnerPrefix.h:
2011-01-26  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Dan Bernstein.

        WebKitTestRunner needs to support layoutTestController.evaluateInWebInspector
        https://bugs.webkit.org/show_bug.cgi?id=42319

        Add WKBundleInspector and APIs needed to implement WebKitTestRunner APIs.
        
        * GNUmakefile.am:
        * Shared/API/c/WKBase.h:
        * Shared/APIObject.h:
        * WebKit2.pro:
        * WebKit2.xcodeproj/project.pbxproj:
        * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
        * WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp: Added.
        (WKBundleInspectorGetTypeID):
        (WKBundleInspectorShow):
        (WKBundleInspectorClose):
        (WKBundleInspectorEvaluateScriptForTest):
        (WKBundleInspectorSetPageProfilingEnabled):
        * WebProcess/InjectedBundle/API/c/WKBundleInspector.h: Added.
        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
        (WKBundlePageGetInspector):
        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
        * WebProcess/WebPage/WebInspector.cpp:
        (WebKit::WebInspector::create):
        (WebKit::WebInspector::evaluateScriptForTest):
        * WebProcess/WebPage/WebInspector.h:
        (WebKit::WebInspector::type):
        * WebProcess/WebPage/WebPage.cpp:
        (WebKit::WebPage::inspector):
        * WebProcess/WebPage/WebPage.h:
        * win/WebKit2.vcproj:
        * win/WebKit2Generated.make:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76769 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1b0578db
2011-01-26 Maciej Stachowiak <mjs@apple.com>
Reviewed by Dan Bernstein.
WebKitTestRunner needs to support layoutTestController.evaluateInWebInspector
https://bugs.webkit.org/show_bug.cgi?id=42319
Unskip inspector tests (except the few that mysteriously fail).
* platform/mac-wk2/Skipped:
2011-01-27 Yuzo Fujishima <yuzo@google.com>
Unreviewed Chromium test expectation change.
......@@ -56,6 +56,7 @@ compositing/iframes/iframe-src-change.html
# WebKitTestRunner needs an implementation of eventSender
# <https://bugs.webkit.org/show_bug.cgi?id=42194>
inspector/timeline-event-dispatch.html
fast/text/offsetForPosition-complex-fallback.html
svg/animations/animate-path-to-animation.html
fast/forms/input-number-change-type-on-focus.html
......@@ -1254,12 +1255,6 @@ editing/undo/undo-typing-001.html
# <rdar://problem/8867804>
svg/css/cursor-replace.svg
# WebKitTestRunner needs to support evaluateInWebInspector
# <https://bugs.webkit.org/show_bug.cgi?id=42319>
http/tests/inspector-enabled
http/tests/inspector
inspector
# WebKitTestRunner needs to support layoutTestController.dumpDOMAsWebArchive
# <https://bugs.webkit.org/show_bug.cgi?id=42324>
http/tests/webarchive/cross-origin-stylesheet-crash.html
......@@ -2283,6 +2278,10 @@ fast/workers/storage/open-database-inputs-sync.html
fast/workers/storage/sql-exception-codes-sync.html
storage/multiple-databases-garbage-collection.html
# Unknown failures after enabling inspector tests
inspector/timeline-paint.html
inspector/timeline-script-tag-1.html
### END OF (3) Unclassified failures
########################################
......
2011-01-26 Maciej Stachowiak <mjs@apple.com>
Reviewed by Dan Bernstein.
WebKitTestRunner needs to support layoutTestController.evaluateInWebInspector
https://bugs.webkit.org/show_bug.cgi?id=42319
Add WKBundleInspector and APIs needed to implement WebKitTestRunner APIs.
* GNUmakefile.am:
* Shared/API/c/WKBase.h:
* Shared/APIObject.h:
* WebKit2.pro:
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
* WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp: Added.
(WKBundleInspectorGetTypeID):
(WKBundleInspectorShow):
(WKBundleInspectorClose):
(WKBundleInspectorEvaluateScriptForTest):
(WKBundleInspectorSetPageProfilingEnabled):
* WebProcess/InjectedBundle/API/c/WKBundleInspector.h: Added.
* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageGetInspector):
* WebProcess/InjectedBundle/API/c/WKBundlePage.h:
* WebProcess/WebPage/WebInspector.cpp:
(WebKit::WebInspector::create):
(WebKit::WebInspector::evaluateScriptForTest):
* WebProcess/WebPage/WebInspector.h:
(WebKit::WebInspector::type):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::inspector):
* WebProcess/WebPage/WebPage.h:
* win/WebKit2.vcproj:
* win/WebKit2Generated.make:
2011-01-26 David Kilzer <ddkilzer@apple.com>
<http://webkit.org/b/53192> Add experimental support for HTTP pipelining in CFNetwork
......@@ -433,6 +433,8 @@ libWebKit2_la_SOURCES = \
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp \
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h \
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInitialize.h \
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp \
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.h \
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp \
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h \
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h \
......
......@@ -92,6 +92,7 @@ typedef const struct OpaqueWKBundleBackForwardListItem* WKBundleBackForwardListI
typedef const struct OpaqueWKBundleDOMCSSStyleDeclaration* WKBundleCSSStyleDeclarationRef;
typedef const struct OpaqueWKBundleFrame* WKBundleFrameRef;
typedef const struct OpaqueWKBundleHitTestResult* WKBundleHitTestResultRef;
typedef const struct OpaqueWKBundleInspector* WKBundleInspectorRef;
typedef const struct OpaqueWKBundleNodeHandle* WKBundleNodeHandleRef;
typedef const struct OpaqueWKBundlePage* WKBundlePageRef;
typedef const struct OpaqueWKBundlePageGroup* WKBundlePageGroupRef;
......
......@@ -85,6 +85,7 @@ public:
TypeBundleBackForwardListItem,
TypeBundleFrame,
TypeBundleHitTestResult,
TypeBundleInspector,
TypeBundleNodeHandle,
TypeBundlePage,
TypeBundlePageGroup,
......
......@@ -620,6 +620,7 @@ SOURCES += \
WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp \
WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp \
WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp \
WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp \
WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp \
WebProcess/InjectedBundle/API/c/WKBundlePage.cpp \
WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp \
......
......@@ -286,6 +286,8 @@
51ACBBA1127A8F2C00D203B9 /* WebContextMenuProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51ACBB9F127A8F2C00D203B9 /* WebContextMenuProxyMac.mm */; };
51B3005012529D0E000B5CA0 /* WebBackForwardListCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B3004E12529D0E000B5CA0 /* WebBackForwardListCF.cpp */; };
51B3005112529D0E000B5CA0 /* WebPageProxyCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B3004F12529D0E000B5CA0 /* WebPageProxyCF.cpp */; };
6501BD1A12F1243400E9F248 /* WKBundleInspector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65B86F1712F11D7B00B7DD8A /* WKBundleInspector.cpp */; };
65B86F1E12F11DE300B7DD8A /* WKBundleInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 65B86F1812F11D7B00B7DD8A /* WKBundleInspector.h */; settings = {ATTRIBUTES = (Public, ); }; };
6D8A91A611F0EFD100DD01FE /* com.apple.WebProcess.sb in Resources */ = {isa = PBXBuildFile; fileRef = 6D8A91A511F0EFD100DD01FE /* com.apple.WebProcess.sb */; };
762B748D120BC75C00819339 /* WKPreferencesPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 762B7484120BBA2D00819339 /* WKPreferencesPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; };
......@@ -1035,6 +1037,8 @@
51B3004F12529D0E000B5CA0 /* WebPageProxyCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebPageProxyCF.cpp; path = cf/WebPageProxyCF.cpp; sourceTree = "<group>"; };
5DAD7294116FF70B00EE5396 /* WebProcess.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = WebProcess.xcconfig; sourceTree = "<group>"; };
5DAD73F1116FF90C00EE5396 /* BaseTarget.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = BaseTarget.xcconfig; sourceTree = "<group>"; };
65B86F1712F11D7B00B7DD8A /* WKBundleInspector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleInspector.cpp; sourceTree = "<group>"; };
65B86F1812F11D7B00B7DD8A /* WKBundleInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleInspector.h; sourceTree = "<group>"; };
6D8A91A511F0EFD100DD01FE /* com.apple.WebProcess.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = com.apple.WebProcess.sb; path = WebProcess/com.apple.WebProcess.sb; sourceTree = "<group>"; };
762B7481120BBA0100819339 /* FontSmoothingLevel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontSmoothingLevel.h; sourceTree = "<group>"; };
762B7484120BBA2D00819339 /* WKPreferencesPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPreferencesPrivate.h; sourceTree = "<group>"; };
......@@ -2443,6 +2447,8 @@
BC49862E124D18C100D834E1 /* WKBundleHitTestResult.cpp */,
BC49862D124D18C100D834E1 /* WKBundleHitTestResult.h */,
BC204EED11C83EC8008F3375 /* WKBundleInitialize.h */,
65B86F1712F11D7B00B7DD8A /* WKBundleInspector.cpp */,
65B86F1812F11D7B00B7DD8A /* WKBundleInspector.h */,
BC4BEFE0120A1A4C00FBA0C7 /* WKBundleNodeHandle.cpp */,
BC4BEFDF120A1A4C00FBA0C7 /* WKBundleNodeHandle.h */,
BC57450B1263B155006F0F12 /* WKBundleNodeHandlePrivate.h */,
......@@ -2839,6 +2845,7 @@
BC204EF011C83EC8008F3375 /* WKBundleAPICast.h in Headers */,
BCD25F1711D6BDE100169B0E /* WKBundleFrame.h in Headers */,
BC204EF211C83EC8008F3375 /* WKBundleInitialize.h in Headers */,
65B86F1E12F11DE300B7DD8A /* WKBundleInspector.h in Headers */,
BC20528111C94284008F3375 /* WKBundlePage.h in Headers */,
BC1B419811D41D570011E8DD /* WKBundlePagePrivate.h in Headers */,
BCB9E24B1120E15C00A137E0 /* WKContext.h in Headers */,
......@@ -3556,6 +3563,7 @@
BC9585C812F095B800755821 /* WebGestureEvent.cpp in Sources */,
1A186EEB12EF7618008E5F37 /* LayerTreeHost.cpp in Sources */,
1A18718512EF9877008E5F37 /* LayerTreeHostMac.mm in Sources */,
6501BD1A12F1243400E9F248 /* WKBundleInspector.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
......@@ -50,6 +50,7 @@ class InjectedBundleRangeHandle;
class InjectedBundleScriptWorld;
class PageOverlay;
class WebFrame;
class WebInspector;
class WebPage;
class WebPageGroupProxy;
......@@ -58,6 +59,7 @@ WK_ADD_API_MAPPING(WKBundleBackForwardListRef, InjectedBundleBackForwardList)
WK_ADD_API_MAPPING(WKBundleCSSStyleDeclarationRef, WebCore::CSSStyleDeclaration)
WK_ADD_API_MAPPING(WKBundleFrameRef, WebFrame)
WK_ADD_API_MAPPING(WKBundleHitTestResultRef, InjectedBundleHitTestResult)
WK_ADD_API_MAPPING(WKBundleInspectorRef, WebInspector)
WK_ADD_API_MAPPING(WKBundleNodeHandleRef, InjectedBundleNodeHandle)
WK_ADD_API_MAPPING(WKBundlePageGroupRef, WebPageGroupProxy)
WK_ADD_API_MAPPING(WKBundlePageOverlayRef, PageOverlay)
......
/*
* Copyright (C) 2011 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 INC. 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 INC. 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.
*/
#include "WKBundleInspector.h"
#if ENABLE(INSPECTOR)
#include "WKAPICast.h"
#include "WKBundleAPICast.h"
#include "WebInspector.h"
using namespace WebCore;
using namespace WebKit;
WKTypeID WKBundleInspectorGetTypeID()
{
return toAPI(WebInspector::APIType);
}
void WKBundleInspectorShow(WKBundleInspectorRef inspectorRef)
{
return toImpl(inspectorRef)->show();
}
void WKBundleInspectorClose(WKBundleInspectorRef inspectorRef)
{
return toImpl(inspectorRef)->close();
}
void WKBundleInspectorEvaluateScriptForTest(WKBundleInspectorRef inspectorRef, long callID, WKStringRef script)
{
return toImpl(inspectorRef)->evaluateScriptForTest(callID, toImpl(script)->string());
}
void WKBundleInspectorSetPageProfilingEnabled(WKBundleInspectorRef inspectorRef, bool enabled)
{
if (enabled)
toImpl(inspectorRef)->startPageProfiling();
else
toImpl(inspectorRef)->stopPageProfiling();
}
#endif // ENABLE(INSPECTOR)
/*
* Copyright (C) 2011 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 INC. 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 INC. 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.
*/
#ifndef WKBundleInspector_h
#define WKBundleInspector_h
#include <WebKit2/WKBase.h>
#if ENABLE(INSPECTOR)
#ifndef __cplusplus
#include <stdbool.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
WK_EXPORT WKTypeID WKBundleInspectorGetTypeID();
WK_EXPORT void WKBundleInspectorShow(WKBundleInspectorRef inspector);
WK_EXPORT void WKBundleInspectorClose(WKBundleInspectorRef inspector);
WK_EXPORT void WKBundleInspectorEvaluateScriptForTest(WKBundleInspectorRef inspector, long callID, WKStringRef script);
WK_EXPORT void WKBundleInspectorSetPageProfilingEnabled(WKBundleInspectorRef inspector, bool enabled);
#ifdef __cplusplus
}
#endif
#endif // ENABLE(INSPECTOR)
#endif // WKBundleInspector_h
......@@ -184,3 +184,10 @@ WKImageRef WKBundlePageCreateSnapshotInDocumentCoordinates(WKBundlePageRef pageR
RefPtr<WebImage> webImage = toImpl(pageRef)->snapshotInDocumentCoordinates(toIntRect(rect), toImageOptions(options));
return toAPI(webImage.release().leakRef());
}
#if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR
WKBundleInspectorRef WKBundlePageGetInspector(WKBundlePageRef pageRef)
{
return toAPI(toImpl(pageRef)->inspector());
}
#endif
......@@ -220,6 +220,10 @@ WK_EXPORT bool WKBundlePageFindString(WKBundlePageRef page, WKStringRef target,
WK_EXPORT WKImageRef WKBundlePageCreateSnapshotInViewCoordinates(WKBundlePageRef page, WKRect rect, WKImageOptions options);
WK_EXPORT WKImageRef WKBundlePageCreateSnapshotInDocumentCoordinates(WKBundlePageRef page, WKRect rect, WKImageOptions options);
#if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR
WK_EXPORT WKBundleInspectorRef WKBundlePageGetInspector(WKBundlePageRef page);
#endif
#ifdef __cplusplus
}
#endif
......
......@@ -38,6 +38,11 @@ using namespace WebCore;
namespace WebKit {
PassRefPtr<WebInspector> WebInspector::create(WebPage* page)
{
return adoptRef(new WebInspector(page));
}
WebInspector::WebInspector(WebPage* page)
: m_page(page)
, m_inspectorPage(0)
......@@ -91,6 +96,11 @@ void WebInspector::close()
m_page->corePage()->inspectorController()->close();
}
void WebInspector::evaluateScriptForTest(long callID, const String& script)
{
m_page->corePage()->inspectorController()->evaluateForTestInFrontend(callID, script);
}
void WebInspector::showConsole()
{
m_page->corePage()->inspectorController()->showPanel(InspectorController::ConsolePanel);
......
......@@ -28,6 +28,7 @@
#if ENABLE(INSPECTOR)
#include "APIObject.h"
#include "Connection.h"
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
......@@ -37,11 +38,11 @@ namespace WebKit {
class WebPage;
struct WebPageCreationParameters;
class WebInspector {
WTF_MAKE_NONCOPYABLE(WebInspector);
class WebInspector : public APIObject {
public:
explicit WebInspector(WebPage*);
static const Type APIType = TypeBundleInspector;
static PassRefPtr<WebInspector> create(WebPage*);
WebPage* page() const { return m_page; }
WebPage* inspectorPage() const { return m_inspectorPage; }
......@@ -49,10 +50,23 @@ public:
// Implemented in generated WebInspectorMessageReceiver.cpp
void didReceiveWebInspectorMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
// Called by WebInspector messages
void show();
void close();
void evaluateScriptForTest(long callID, const String& script);
void startPageProfiling();
void stopPageProfiling();
private:
friend class WebInspectorClient;
friend class WebInspectorFrontendClient;
explicit WebInspector(WebPage*);
virtual Type type() const { return APIType; }
// Called from WebInspectorClient
WebPage* createInspectorPage();
......@@ -63,10 +77,6 @@ private:
// Implemented in platform WebInspector file
String localizedStringsURL() const;
// Called by WebInspector messages
void show();
void close();
void showConsole();
void startJavaScriptDebugging();
......@@ -75,9 +85,6 @@ private:
void startJavaScriptProfiling();
void stopJavaScriptProfiling();
void startPageProfiling();
void stopPageProfiling();
WebPage* m_page;
WebPage* m_inspectorPage;
};
......
......@@ -1294,7 +1294,7 @@ WebInspector* WebPage::inspector()
if (m_isClosed)
return 0;
if (!m_inspector)
m_inspector = adoptPtr(new WebInspector(this));
m_inspector = WebInspector::create(this);
return m_inspector.get();
}
#endif
......
......@@ -496,7 +496,7 @@ private:
RefPtr<PageOverlay> m_pageOverlay;
#if ENABLE(INSPECTOR)
OwnPtr<WebInspector> m_inspector;
RefPtr<WebInspector> m_inspector;
#endif
RefPtr<WebPopupMenu> m_activePopupMenu;
RefPtr<WebContextMenu> m_contextMenu;
......
......@@ -1807,6 +1807,14 @@
RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleFramePrivate.h"
>
</File>
<File
RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleInspector.cpp"
>
</File>
<File
RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleInspector.h"
>
</File>
<File
RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundleHitTestResult.cpp"
>
......
......@@ -73,6 +73,7 @@ all:
xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleFramePrivate.h" "%ConfigurationBuildDir%\include\WebKit2"
xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleHitTestResult.h" "%ConfigurationBuildDir%\include\WebKit2"
xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleInitialize.h" "%ConfigurationBuildDir%\include\WebKit2"
xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleInspector.h" "%ConfigurationBuildDir%\include\WebKit2"
xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleNodeHandle.h" "%ConfigurationBuildDir%\include\WebKit2"
xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleNodeHandlePrivate.h" "%ConfigurationBuildDir%\include\WebKit2"
xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundlePage.h" "%ConfigurationBuildDir%\include\WebKit2"
......
2011-01-26 Maciej Stachowiak <mjs@apple.com>
Reviewed by Dan Bernstein.
WebKitTestRunner needs to support layoutTestController.evaluateInWebInspector
https://bugs.webkit.org/show_bug.cgi?id=42319
Add evaluateInWebInspector and other APIs needed for inspector tests to run.
* WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
* WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
(WTR::LayoutTestController::showWebInspector):
(WTR::LayoutTestController::closeWebInspector):
(WTR::LayoutTestController::evaluateInWebInspector):
(WTR::LayoutTestController::setTimelineProfilingEnabled):
* WebKitTestRunner/InjectedBundle/LayoutTestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::shouldOpenWebInspector):
(WTR::TestInvocation::invoke):
* WebKitTestRunner/WebKitTestRunnerPrefix.h:
2011-01-26 Martin Robinson <mrobinson@igalia.com>
Reviewed by Xan Lopez.
......@@ -77,8 +77,14 @@ module WTR {
// Text search testing.
boolean findString(in DOMString target, in object optionsArray);
// Evaluating script in a special context
[PassContext] void evaluateScriptInIsolatedWorld(in unsigned long worldID, in DOMString script)
// Evaluating script in a special context.
[PassContext] void evaluateScriptInIsolatedWorld(in unsigned long worldID, in DOMString script);
// For Web Inspector tests
void showWebInspector();
void closeWebInspector();
void evaluateInWebInspector(in long callID, in DOMString script);
void setTimelineProfilingEnabled(in boolean enabled);
};
}
......@@ -32,6 +32,7 @@
#include <WebKit2/WKBundleBackForwardList.h>
#include <WebKit2/WKBundleFrame.h>
#include <WebKit2/WKBundleFramePrivate.h>
#include <WebKit2/WKBundleInspector.h>
#include <WebKit2/WKBundlePagePrivate.h>
#include <WebKit2/WKBundleScriptWorld.h>
#include <WebKit2/WKBundlePrivate.h>
......@@ -309,6 +310,27 @@ void LayoutTestController::makeWindowObject(JSContextRef context, JSObjectRef wi
setProperty(context, windowObject, "layoutTestController", this, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception);
}
void LayoutTestController::showWebInspector()
{
WKBundleInspectorShow(WKBundlePageGetInspector(InjectedBundle::shared().page()->page()));
}
void LayoutTestController::closeWebInspector()
{
WKBundleInspectorClose(WKBundlePageGetInspector(InjectedBundle::shared().page()->page()));
}
void LayoutTestController::evaluateInWebInspector(long callID, JSStringRef script)
{
WKRetainPtr<WKStringRef> scriptWK = toWK(script);
WKBundleInspectorEvaluateScriptForTest(WKBundlePageGetInspector(InjectedBundle::shared().page()->page()), callID, scriptWK.get());
}
void LayoutTestController::setTimelineProfilingEnabled(bool enabled)
{
WKBundleInspectorSetPageProfilingEnabled(WKBundlePageGetInspector(InjectedBundle::shared().page()->page()), enabled);
}
typedef WTF::HashMap<unsigned, WKRetainPtr<WKBundleScriptWorldRef> > WorldMap;
static WorldMap& worldMap()
{
......
......@@ -126,6 +126,11 @@ public:
void evaluateScriptInIsolatedWorld(JSContextRef, unsigned worldID, JSStringRef script);
static unsigned worldIDForWorld(WKBundleScriptWorldRef);
void showWebInspector();
void closeWebInspector();
void evaluateInWebInspector(long callId, JSStringRef script);
void setTimelineProfilingEnabled(bool);
private:
static const double waitToDumpWatchdogTimerInterval;
......
......@@ -31,6 +31,7 @@
#include <climits>
#include <cstdio>
#include <WebKit2/WKContextPrivate.h>
#include <WebKit2/WKInspector.h>
#include <WebKit2/WKRetainPtr.h>
#include <wtf/OwnArrayPtr.h>
#include <wtf/PassOwnArrayPtr.h>
......@@ -113,6 +114,11 @@ static void sizeWebViewForCurrentTest(char* pathOrURL)
TestController::shared().mainWebView()->resizeTo(normalWidth, normalHeight);
}
static bool shouldOpenWebInspector(const char* pathOrURL)
{
return strstr(pathOrURL, "inspector/");
}
void TestInvocation::invoke()
{
sizeWebViewForCurrentTest(m_pathOrURL);
......@@ -130,17 +136,18 @@ void TestInvocation::invoke()
return;
}
if (shouldOpenWebInspector(m_pathOrURL))
WKInspectorShow(WKPageGetInspector(TestController::shared().mainWebView()->page()));
WKPageLoadURL(TestController::shared().mainWebView()->page(), m_url.get());
TestController::shared().runUntil(m_gotFinalMessage, TestController::LongTimeout);
if (!m_gotFinalMessage) {
if (!m_gotFinalMessage)
dump("Timed out waiting for final message from web process\n");
return;
}
if (m_error) {
else if (m_error)
dump("FAIL\n");
return;
}
WKInspectorClose(WKPageGetInspector(TestController::shared().mainWebView()->page()));
}
void TestInvocation::dump(const char* stringToDump)
......
......@@ -34,4 +34,5 @@
#define min min
#endif
#include <wtf/Platform.h>
#include <WebKit2/WebKit2.h>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment