diff options
author | Steve Block <steveblock@google.com> | 2011-05-18 13:36:51 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-05-24 15:38:28 +0100 |
commit | 2fc2651226baac27029e38c9d6ef883fa32084db (patch) | |
tree | e396d4bf89dcce6ed02071be66212495b1df1dec /Tools/WebKitTestRunner | |
parent | b3725cedeb43722b3b175aaeff70552e562d2c94 (diff) | |
download | external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.zip external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.gz external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.bz2 |
Merge WebKit at r78450: Initial merge by git.
Change-Id: I6d3e5f1f868ec266a0aafdef66182ddc3f265dc1
Diffstat (limited to 'Tools/WebKitTestRunner')
20 files changed, 260 insertions, 26 deletions
diff --git a/Tools/WebKitTestRunner/Configurations/Base.xcconfig b/Tools/WebKitTestRunner/Configurations/Base.xcconfig index feb7c5e..ac2ff94 100644 --- a/Tools/WebKitTestRunner/Configurations/Base.xcconfig +++ b/Tools/WebKitTestRunner/Configurations/Base.xcconfig @@ -21,7 +21,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -HEADER_SEARCH_PATHS = $(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders; +HEADER_SEARCH_PATHS = $(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders ${SRCROOT}/../../Source/JavaScriptCore/icu; FRAMEWORK_SEARCH_PATHS = $(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks; GCC_PREPROCESSOR_DEFINITIONS = ENABLE_DASHBOARD_SUPPORT WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST; DEBUG_INFORMATION_FORMAT = dwarf diff --git a/Tools/WebKitTestRunner/DerivedSources.pro b/Tools/WebKitTestRunner/DerivedSources.pro index 1e4e461..ce7ac63 100644 --- a/Tools/WebKitTestRunner/DerivedSources.pro +++ b/Tools/WebKitTestRunner/DerivedSources.pro @@ -34,7 +34,7 @@ defineTest(addExtraCompiler) { return(true) } -SRC_ROOT_DIR = $$replace(PWD, /Tools/WebKitTestRunner, /) +SRC_ROOT_DIR = $$replace(PWD, /Tools/WebKitTestRunner, "") # Make sure forwarded headers needed by this project are present fwheader_generator.commands = perl $${SRC_ROOT_DIR}/Source/WebKit2/Scripts/generate-forwarding-headers.pl $${SRC_ROOT_DIR}/Tools/WebKitTestRunner $${OUTPUT_DIR}/include qt diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl index a88a838..a331c64 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl +++ b/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl @@ -77,8 +77,18 @@ 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); + + void setPOSIXLocale(in DOMString locale); + + void setWillSendRequestReturnsNull(in boolean flag); }; } diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp index 972a606..d042431 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp @@ -118,6 +118,11 @@ InjectedBundlePage* InjectedBundle::page() const return m_pages[0].get(); } +void InjectedBundle::resetLocalSettings() +{ + setlocale(LC_ALL, ""); +} + void InjectedBundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody) { if (WKStringIsEqualToUTF8CString(messageName, "BeginTest")) { @@ -131,6 +136,9 @@ void InjectedBundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messag return; } else if (WKStringIsEqualToUTF8CString(messageName, "Reset")) { m_state = Idle; + + resetLocalSettings(); + return; } diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h index 9778441..741ade4 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h +++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h @@ -82,6 +82,8 @@ private: void didInitializePageGroup(WKBundlePageGroupRef); void didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody); + void resetLocalSettings(); + void beginTesting(); WKBundleRef m_bundle; diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp index c5f4909..739da3b 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp @@ -29,6 +29,7 @@ #include "StringFunctions.h" #include <cmath> #include <JavaScriptCore/JSRetainPtr.h> +#include <WebCore/KURL.h> #include <WebKit2/WKArray.h> #include <WebKit2/WKBundle.h> #include <WebKit2/WKBundleBackForwardList.h> @@ -36,6 +37,7 @@ #include <WebKit2/WKBundleFrame.h> #include <WebKit2/WKBundleFramePrivate.h> #include <WebKit2/WKBundlePagePrivate.h> +#include <WebKit2/WKURLRequest.h> using namespace std; @@ -190,9 +192,20 @@ InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page) didCancelClientRedirectForFrame, willPerformClientRedirectForFrame, didHandleOnloadEventsForFrame, - shouldLoadResourceForFrame }; - WKBundlePageSetLoaderClient(m_page, &loaderClient); + WKBundlePageSetPageLoaderClient(m_page, &loaderClient); + + WKBundlePageResourceLoadClient resourceLoadClient = { + 0, + this, + didInitiateLoadForResource, + willSendRequestForFrame, + didReceiveResponseForResource, + didReceiveContentLengthForResource, + didFinishLoadForResource, + didFailLoadForResource + }; + WKBundlePageSetResourceLoadClient(m_page, &resourceLoadClient); WKBundlePageUIClient uiClient = { 0, @@ -204,6 +217,7 @@ InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page) willRunJavaScriptPrompt, 0, /*mouseDidMoveOverElement*/ 0, /*pageDidScroll*/ + 0, /*paintCustomOverhangArea*/ }; WKBundlePageSetUIClient(m_page, &uiClient); @@ -321,11 +335,35 @@ void InjectedBundlePage::didRunInsecureContentForFrame(WKBundlePageRef page, WKB static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didRunInsecureContentForFrame(frame); } -bool InjectedBundlePage::shouldLoadResourceForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKStringRef, const void* clientInfo) +void InjectedBundlePage::didInitiateLoadForResource(WKBundlePageRef page, WKBundleFrameRef frame, uint64_t identifier, WKURLRequestRef request, bool pageLoadIsProvisional, const void* clientInfo) +{ + static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didInitiateLoadForResource(page, frame, identifier, request, pageLoadIsProvisional); +} + +WKURLRequestRef InjectedBundlePage::willSendRequestForFrame(WKBundlePageRef page, WKBundleFrameRef frame, uint64_t identifier, WKURLRequestRef request, WKURLResponseRef redirectResponse, const void* clientInfo) +{ + return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->willSendRequestForFrame(page, frame, identifier, request, redirectResponse); +} + +void InjectedBundlePage::didReceiveResponseForResource(WKBundlePageRef page, WKBundleFrameRef frame, uint64_t identifier, WKURLResponseRef response, const void* clientInfo) { - return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldLoadResourceForFrame(frame); + static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didReceiveResponseForResource(page, frame, identifier, response); } +void InjectedBundlePage::didReceiveContentLengthForResource(WKBundlePageRef page, WKBundleFrameRef frame, uint64_t identifier, uint64_t length, const void* clientInfo) +{ + static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didReceiveContentLengthForResource(page, frame, identifier, length); +} + +void InjectedBundlePage::didFinishLoadForResource(WKBundlePageRef page, WKBundleFrameRef frame, uint64_t identifier, const void* clientInfo) +{ + static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didFinishLoadForResource(page, frame, identifier); +} + +void InjectedBundlePage::didFailLoadForResource(WKBundlePageRef page, WKBundleFrameRef frame, uint64_t identifier, WKErrorRef error, const void* clientInfo) +{ + static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didFinishLoadForResource(page, frame, identifier, error); +} void InjectedBundlePage::didStartProvisionalLoadForFrame(WKBundleFrameRef frame) { @@ -574,9 +612,46 @@ void InjectedBundlePage::didRunInsecureContentForFrame(WKBundleFrameRef frame) { } -bool InjectedBundlePage::shouldLoadResourceForFrame(WKBundleFrameRef frame) +void InjectedBundlePage::didInitiateLoadForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, WKURLRequestRef, bool) +{ +} + +// Resource Load Client Callbacks + +WKURLRequestRef InjectedBundlePage::willSendRequestForFrame(WKBundlePageRef, WKBundleFrameRef, uint64_t, WKURLRequestRef request, WKURLResponseRef) +{ + if (InjectedBundle::shared().isTestRunning() && InjectedBundle::shared().layoutTestController()->willSendRequestReturnsNull()) + return 0; + + string urlString = toSTD(adoptWK(WKURLCopyString(adoptWK(WKURLRequestCopyURL(request)).get()))); + WebCore::KURL url(WebCore::ParsedURLString, urlString.c_str()); + + if (!url.host().isEmpty() + && (equalIgnoringCase(url.protocol(), "http") || (equalIgnoringCase(url.protocol(), "https"))) + && (url.host() != "127.0.0.1") + && (url.host() != "255.255.255.255") // used in some tests that expect to get back an error + && (!equalIgnoringCase(url.host(), "localhost"))) { + InjectedBundle::shared().os() << "Blocked access to external URL " << urlString << "\n"; + return 0; + } + + return request; +} + +void InjectedBundlePage::didReceiveResponseForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t, WKURLResponseRef) +{ +} + +void InjectedBundlePage::didReceiveContentLengthForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t, uint64_t) +{ +} + +void InjectedBundlePage::didFinishLoadForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t) +{ +} + +void InjectedBundlePage::didFailLoadForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t, WKErrorRef) { - return true; } // UI Client Callbacks diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h index 3b99109..2c3e9df 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h +++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h @@ -63,7 +63,13 @@ private: static void didHandleOnloadEventsForFrame(WKBundlePageRef, WKBundleFrameRef, const void*); static void didDisplayInsecureContentForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void*); static void didRunInsecureContentForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void*); - static bool shouldLoadResourceForFrame(WKBundlePageRef, WKBundleFrameRef, WKStringRef, const void*); + static void didInitiateLoadForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, WKURLRequestRef, bool pageLoadIsProvisional, const void*); + static WKURLRequestRef willSendRequestForFrame(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, WKURLRequestRef, WKURLResponseRef, const void*); + static void didReceiveResponseForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, WKURLResponseRef, const void*); + static void didReceiveContentLengthForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, uint64_t length, const void*); + static void didFinishLoadForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, const void*); + static void didFailLoadForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, WKErrorRef, const void*); + void didStartProvisionalLoadForFrame(WKBundleFrameRef); void didReceiveServerRedirectForProvisionalLoadForFrame(WKBundleFrameRef); void didFailProvisionalLoadWithErrorForFrame(WKBundleFrameRef, WKErrorRef); @@ -79,7 +85,14 @@ private: void didHandleOnloadEventsForFrame(WKBundleFrameRef); void didDisplayInsecureContentForFrame(WKBundleFrameRef); void didRunInsecureContentForFrame(WKBundleFrameRef); - bool shouldLoadResourceForFrame(WKBundleFrameRef); + + // Resource Load Client + void didInitiateLoadForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, WKURLRequestRef, bool pageLoadIsProvisional); + WKURLRequestRef willSendRequestForFrame(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, WKURLRequestRef, WKURLResponseRef); + void didReceiveResponseForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, WKURLResponseRef); + void didReceiveContentLengthForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, uint64_t length); + void didFinishLoadForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier); + void didFailLoadForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, WKErrorRef); // UI Client static void willAddMessageToConsole(WKBundlePageRef, WKStringRef message, uint32_t lineNumber, const void* clientInfo); diff --git a/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp b/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp index 13c7b10..4707ed8 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp @@ -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> @@ -96,6 +97,7 @@ LayoutTestController::LayoutTestController() , m_waitToDump(false) , m_testRepaint(false) , m_testRepaintSweepHorizontally(false) + , m_willSendRequestReturnsNull(false) { platformInitialize(); } @@ -309,6 +311,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() { @@ -349,4 +372,11 @@ void LayoutTestController::evaluateScriptInIsolatedWorld(JSContextRef context, u JSEvaluateScript(jsContext, script, 0, 0, 0, 0); } +void LayoutTestController::setPOSIXLocale(JSStringRef locale) +{ + char localeBuf[32]; + JSStringGetUTF8CString(locale, localeBuf, sizeof(localeBuf)); + setlocale(LC_ALL, localeBuf); +} + } // namespace WTR diff --git a/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h b/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h index 1f81970..9271124 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h +++ b/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h @@ -126,6 +126,16 @@ 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); + + void setPOSIXLocale(JSStringRef); + + bool willSendRequestReturnsNull() { return m_willSendRequestReturnsNull; } + void setWillSendRequestReturnsNull(bool f) { m_willSendRequestReturnsNull = f; } + private: static const double waitToDumpWatchdogTimerInterval; @@ -148,6 +158,8 @@ private: bool m_testRepaint; bool m_testRepaintSweepHorizontally; + bool m_willSendRequestReturnsNull; + PlatformTimerRef m_waitToDumpWatchdogTimer; }; diff --git a/Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp b/Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp index d8166d0..9c4bc68 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp @@ -29,10 +29,13 @@ #include "ActivateFonts.h" +#include <QApplication> #include <QByteArray> #include <QDir> +#include <QWindowsStyle> #ifdef Q_WS_X11 +#include <QX11Info> #include <fontconfig/fontconfig.h> #endif @@ -43,6 +46,8 @@ namespace WTR { void activateFonts() { #if defined(Q_WS_X11) + FcInit(); + static int numFonts = -1; // Some test cases may add or remove application fonts (via @font-face). @@ -78,6 +83,18 @@ void activateFonts() appFontSet = FcConfigGetFonts(config, FcSetApplication); numFonts = appFontSet->nfont; #endif + + QApplication::setGraphicsSystem("raster"); + QApplication::setStyle(new QWindowsStyle); + + QFont f("Sans Serif"); + f.setPointSize(9); + f.setWeight(QFont::Normal); + f.setStyle(QFont::StyleNormal); + QApplication::setFont(f); + + QX11Info::setAppDpiX(0, 96); + QX11Info::setAppDpiY(0, 96); } } diff --git a/Tools/WebKitTestRunner/InjectedBundle/qt/InjectedBundle.pro b/Tools/WebKitTestRunner/InjectedBundle/qt/InjectedBundle.pro index 92d31b8..24db4b8 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/qt/InjectedBundle.pro +++ b/Tools/WebKitTestRunner/InjectedBundle/qt/InjectedBundle.pro @@ -43,11 +43,11 @@ HEADERS += \ OBJECTS_DIR = obj/release } -include(../../../../WebKit.pri) +include(../../../../Source/WebKit.pri) include(../../../../Source/JavaScriptCore/JavaScriptCore.pri) -addJavaScriptCoreLib(../../../../Source/JavaScriptCore) +addJavaScriptCoreLib(../../../JavaScriptCore) include(../../../../Source/WebKit2/WebKit2.pri) -addWebKit2Lib(../../../../Source/WebKit2) +addWebKit2Lib(../../../WebKit2) INCLUDEPATH += \ $$PWD \ @@ -56,6 +56,8 @@ INCLUDEPATH += \ $$PWD/../Bindings \ $$PWD/../../../../Source/JavaScriptCore \ $$PWD/../../../../Source/JavaScriptCore/wtf \ + $$PWD/../../../../Source/WebCore \ + $$PWD/../../../../Source/WebCore/platform/text \ $$PWD/../../../../Source/WebKit2 \ $$PWD/../../../../Source/WebKit2/Shared \ $$GENERATED_SOURCES_DIR diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp index e856176..6f5b9a7 100644 --- a/Tools/WebKitTestRunner/TestController.cpp +++ b/Tools/WebKitTestRunner/TestController.cpp @@ -29,9 +29,10 @@ #include "StringFunctions.h" #include "TestInvocation.h" #include <cstdio> -#include <WebKit2/WKPageGroup.h> #include <WebKit2/WKContextPrivate.h> +#include <WebKit2/WKPageGroup.h> #include <WebKit2/WKPreferencesPrivate.h> +#include <WebKit2/WKRetainPtr.h> #include <wtf/PassOwnPtr.h> namespace WTR { @@ -103,6 +104,13 @@ static bool runBeforeUnloadConfirmPanel(WKPageRef page, WKStringRef message, WKF return true; } +static unsigned long long exceededDatabaseQuota(WKPageRef, WKFrameRef, WKSecurityOriginRef, WKStringRef, WKStringRef, unsigned long long, unsigned long long, unsigned long long, const void*) +{ + static const unsigned long long defaultQuota = 5 * 1024 * 1024; + return defaultQuota; +} + + void TestController::runModal(WKPageRef page, const void* clientInfo) { runModal(static_cast<PlatformWebView*>(const_cast<void*>(clientInfo))); @@ -148,7 +156,7 @@ WKPageRef TestController::createOtherPage(WKPageRef oldPage, WKDictionaryRef, WK runBeforeUnloadConfirmPanel, 0, // didDraw 0, // pageDidScroll - 0, // exceededDatabaseQuota + exceededDatabaseQuota, 0, // runOpenPanel 0, // decidePolicyForGeolocationPermissionRequest 0, // headerHeight @@ -157,6 +165,7 @@ WKPageRef TestController::createOtherPage(WKPageRef oldPage, WKDictionaryRef, WK 0, // drawFooter 0, // printFrame runModal, + 0, // didCompleteRubberBandForMainFrame }; WKPageSetPageUIClient(newPage, &otherPageUIClient); @@ -164,6 +173,18 @@ WKPageRef TestController::createOtherPage(WKPageRef oldPage, WKDictionaryRef, WK return newPage; } +const char* TestController::libraryPathForTesting() +{ + // FIXME: This may not be sufficient to prevent interactions/crashes + // when running more than one copy of DumpRenderTree. + // See https://bugs.webkit.org/show_bug.cgi?id=10906 + char* dumpRenderTreeTemp = getenv("DUMPRENDERTREE_TEMP"); + if (dumpRenderTreeTemp) + return dumpRenderTreeTemp; + return platformLibraryPathForTesting(); +} + + void TestController::initialize(int argc, const char* argv[]) { platformInitialize(); @@ -219,6 +240,15 @@ void TestController::initialize(int argc, const char* argv[]) m_pageGroup.adopt(WKPageGroupCreateWithIdentifier(pageGroupIdentifier.get())); m_context.adopt(WKContextCreateWithInjectedBundlePath(injectedBundlePath())); + + const char* path = libraryPathForTesting(); + if (path) { + Vector<char> databaseDirectory(strlen(path) + strlen("/Databases") + 1); + sprintf(databaseDirectory.data(), "%s%s", path, "/Databases"); + WKRetainPtr<WKStringRef> databaseDirectoryWK(AdoptWK, WKStringCreateWithUTF8CString(databaseDirectory.data())); + WKContextSetDatabaseDirectory(m_context.get(), databaseDirectoryWK.get()); + } + platformInitializeContext(); WKContextInjectedBundleClient injectedBundleClient = { @@ -259,7 +289,7 @@ void TestController::initialize(int argc, const char* argv[]) runBeforeUnloadConfirmPanel, 0, // didDraw 0, // pageDidScroll - 0, // exceededDatabaseQuota + exceededDatabaseQuota, 0, // runOpenPanel 0, // decidePolicyForGeolocationPermissionRequest 0, // headerHeight @@ -268,6 +298,7 @@ void TestController::initialize(int argc, const char* argv[]) 0, // drawFooter 0, // printFrame 0, // runModal + 0, // didCompleteRubberBandForMainFrame }; WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient); @@ -317,6 +348,8 @@ bool TestController::resetStateToConsistentValues() WKPreferencesSetXSSAuditorEnabled(preferences, false); WKPreferencesSetDeveloperExtrasEnabled(preferences, true); WKPreferencesSetJavaScriptCanOpenWindowsAutomatically(preferences, true); + WKPreferencesSetJavaScriptCanAccessClipboard(preferences, true); + WKPreferencesSetDOMPasteAllowed(preferences, true); static WKStringRef standardFontFamily = WKStringCreateWithUTF8CString("Times"); static WKStringRef cursiveFontFamily = WKStringCreateWithUTF8CString("Apple Chancery"); diff --git a/Tools/WebKitTestRunner/TestController.h b/Tools/WebKitTestRunner/TestController.h index 65305a2..fe37952 100644 --- a/Tools/WebKitTestRunner/TestController.h +++ b/Tools/WebKitTestRunner/TestController.h @@ -90,6 +90,9 @@ private: static void runModal(WKPageRef, const void* clientInfo); static void runModal(PlatformWebView*); + static const char* libraryPathForTesting(); + static const char* platformLibraryPathForTesting(); + OwnPtr<TestInvocation> m_currentInvocation; bool m_dumpPixels; diff --git a/Tools/WebKitTestRunner/TestInvocation.cpp b/Tools/WebKitTestRunner/TestInvocation.cpp index 26ecfc0..3af184a 100644 --- a/Tools/WebKitTestRunner/TestInvocation.cpp +++ b/Tools/WebKitTestRunner/TestInvocation.cpp @@ -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) diff --git a/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj b/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj index a15fe41..8428403 100644 --- a/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj +++ b/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj @@ -32,6 +32,8 @@ 6510A78A11EC643800410867 /* WebKitWeightWatcher700.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6510A77F11EC643800410867 /* WebKitWeightWatcher700.ttf */; }; 6510A78B11EC643800410867 /* WebKitWeightWatcher800.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6510A78011EC643800410867 /* WebKitWeightWatcher800.ttf */; }; 6510A78C11EC643800410867 /* WebKitWeightWatcher900.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6510A78111EC643800410867 /* WebKitWeightWatcher900.ttf */; }; + 65DD1D9612FFE798004B5285 /* WebCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65DD1D9512FFE798004B5285 /* WebCore.framework */; }; + 65DE432512FFE84000171BCA /* WebCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65DD1D9512FFE798004B5285 /* WebCore.framework */; }; 65EB85A011EC67CC0034D300 /* ActivateFonts.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65EB859F11EC67CC0034D300 /* ActivateFonts.mm */; }; BC14E4DB120E02D000826C0C /* GCController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC14E4D9120E02D000826C0C /* GCController.cpp */; }; BC14E4EA120E03D800826C0C /* JSGCController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC14E4E8120E03D800826C0C /* JSGCController.cpp */; }; @@ -86,6 +88,7 @@ 6510A77F11EC643800410867 /* WebKitWeightWatcher700.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher700.ttf; path = fonts/WebKitWeightWatcher700.ttf; sourceTree = "<group>"; }; 6510A78011EC643800410867 /* WebKitWeightWatcher800.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher800.ttf; path = fonts/WebKitWeightWatcher800.ttf; sourceTree = "<group>"; }; 6510A78111EC643800410867 /* WebKitWeightWatcher900.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher900.ttf; path = fonts/WebKitWeightWatcher900.ttf; sourceTree = "<group>"; }; + 65DD1D9512FFE798004B5285 /* WebCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 65EB859D11EC67CC0034D300 /* ActivateFonts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActivateFonts.h; sourceTree = "<group>"; }; 65EB859F11EC67CC0034D300 /* ActivateFonts.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ActivateFonts.mm; sourceTree = "<group>"; }; 8DD76FA10486AA7600D96B5E /* WebKitTestRunner */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = WebKitTestRunner; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -144,6 +147,7 @@ BC7934A511906584005EA8E2 /* Cocoa.framework in Frameworks */, BC7934AC1190658C005EA8E2 /* WebKit2.framework in Frameworks */, BCDA2B9A1191051F00C3BC47 /* JavaScriptCore.framework in Frameworks */, + 65DD1D9612FFE798004B5285 /* WebCore.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -154,6 +158,7 @@ BC25193E11D15D8B002EBC01 /* Cocoa.framework in Frameworks */, BC25193F11D15D8B002EBC01 /* WebKit2.framework in Frameworks */, BC25194011D15D8B002EBC01 /* JavaScriptCore.framework in Frameworks */, + 65DE432512FFE84000171BCA /* WebCore.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -195,6 +200,7 @@ BC7934A411906584005EA8E2 /* Cocoa.framework */, BC7934AB1190658C005EA8E2 /* WebKit2.framework */, BCDA2B991191051F00C3BC47 /* JavaScriptCore.framework */, + 65DD1D9512FFE798004B5285 /* WebCore.framework */, ); name = "External Frameworks and Libraries"; sourceTree = "<group>"; diff --git a/Tools/WebKitTestRunner/WebKitTestRunnerPrefix.h b/Tools/WebKitTestRunner/WebKitTestRunnerPrefix.h index 9d508ed..1e540cc 100644 --- a/Tools/WebKitTestRunner/WebKitTestRunnerPrefix.h +++ b/Tools/WebKitTestRunner/WebKitTestRunnerPrefix.h @@ -34,4 +34,5 @@ #define min min #endif +#include <wtf/Platform.h> #include <WebKit2/WebKit2.h> diff --git a/Tools/WebKitTestRunner/mac/TestControllerMac.mm b/Tools/WebKitTestRunner/mac/TestControllerMac.mm index 8107890..8ceabc1 100644 --- a/Tools/WebKitTestRunner/mac/TestControllerMac.mm +++ b/Tools/WebKitTestRunner/mac/TestControllerMac.mm @@ -71,4 +71,9 @@ void TestController::runModal(PlatformWebView* view) [NSApp runModalForWindow:window]; } +const char* TestController::platformLibraryPathForTesting() +{ + return [[@"~/Library/Application Support/DumpRenderTree" stringByExpandingTildeInPath] UTF8String]; +} + } // namespace WTR diff --git a/Tools/WebKitTestRunner/qt/TestControllerQt.cpp b/Tools/WebKitTestRunner/qt/TestControllerQt.cpp index df977fb..30a1b5c 100644 --- a/Tools/WebKitTestRunner/qt/TestControllerQt.cpp +++ b/Tools/WebKitTestRunner/qt/TestControllerQt.cpp @@ -133,6 +133,11 @@ void TestController::runModal(PlatformWebView*) // FIXME: Need to implement this to test showModalDialog. } +const char* TestController::platformLibraryPathForTesting() +{ + return 0; +} + #include "TestControllerQt.moc" } // namespace WTR diff --git a/Tools/WebKitTestRunner/qt/WebKitTestRunner.pro b/Tools/WebKitTestRunner/qt/WebKitTestRunner.pro index 73ab4b0..de648ea 100644 --- a/Tools/WebKitTestRunner/qt/WebKitTestRunner.pro +++ b/Tools/WebKitTestRunner/qt/WebKitTestRunner.pro @@ -6,7 +6,7 @@ isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../.. GENERATED_SOURCES_DIR = ../generated -include(../../../WebKit.pri) +include(../../../Source/WebKit.pri) !CONFIG(release, debug|release) { OBJECTS_DIR = obj/debug @@ -68,4 +68,4 @@ linux-* { } include(../../../Source/JavaScriptCore/JavaScriptCore.pri) -addJavaScriptCoreLib(../../../Source/JavaScriptCore) +addJavaScriptCoreLib(../../JavaScriptCore) diff --git a/Tools/WebKitTestRunner/win/TestControllerWin.cpp b/Tools/WebKitTestRunner/win/TestControllerWin.cpp index 08f188f..5af5503 100644 --- a/Tools/WebKitTestRunner/win/TestControllerWin.cpp +++ b/Tools/WebKitTestRunner/win/TestControllerWin.cpp @@ -157,4 +157,9 @@ void TestController::runModal(PlatformWebView*) // FIXME: Need to implement this to test showModalDialog. } +const char* TestController::platformLibraryPathForTesting() +{ + return 0; +} + } // namespace WTR |