diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-24 17:03:20 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-24 17:03:20 +0200 |
commit | 08d4a74d56ca431877819fc4566e27eafe150342 (patch) | |
tree | ebd8530838ab390c015c6b7e659a22852c1663ae /Tools/WebKitTestRunner | |
parent | 1de6cd4794bbd5a52189384189a2b8df1848b39b (diff) | |
download | qtwebkit-08d4a74d56ca431877819fc4566e27eafe150342.tar.gz |
Imported WebKit commit 0fbd41c4e13f5a190faf160bf993eee614e6e18e (http://svn.webkit.org/repository/webkit/trunk@123477)
New snapshot that adapts to latest Qt API changes
Diffstat (limited to 'Tools/WebKitTestRunner')
8 files changed, 118 insertions, 15 deletions
diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl index 240221287..43062c5cc 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl +++ b/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl @@ -139,6 +139,9 @@ module WTR { void setWindowIsKey(in boolean isKey); + // Cookies testing + void setAlwaysAcceptCookies(in boolean accept); + // FIXME: handle non-boolean preferences. void overridePreference(in DOMString preference, in boolean value); diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp index dc2ad3d39..c5bd14083 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp @@ -49,6 +49,13 @@ #include "DumpRenderTreeSupportQt.h" #endif +#if ENABLE(WEB_INTENTS) +#include <WebKit2/WKIntentData.h> +#endif +#if ENABLE(WEB_INTENTS_TAG) +#include <WebKit2/WKIntentServiceInfo.h> +#endif + using namespace std; namespace WTR { @@ -241,7 +248,9 @@ InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page) 0, // didReconnectDOMWindowExtensionToGlobalObject 0, // willDestroyGlobalObjectForDOMWindowExtension didFinishProgress, // didFinishProgress - 0 // shouldForceUniversalAccessFromLocalURL + 0, // shouldForceUniversalAccessFromLocalURL + didReceiveIntentForFrame, // didReceiveIntentForFrame + registerIntentServiceForFrame // registerIntentServiceForFrame }; WKBundlePageSetPageLoaderClient(m_page, &loaderClient); @@ -416,6 +425,75 @@ void InjectedBundlePage::didFinishProgress(WKBundlePageRef, const void *clientIn static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didFinishProgress(); } +void InjectedBundlePage::didReceiveIntentForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKIntentDataRef intent, WKTypeRef* userData, const void* clientInfo) +{ +#if ENABLE(WEB_INTENTS) + InjectedBundle::shared().stringBuilder()->append("Received Web Intent: action="); + WKRetainPtr<WKStringRef> wkAction(AdoptWK, WKIntentDataCopyAction(intent)); + InjectedBundle::shared().stringBuilder()->append(toWTFString(wkAction.get())); + InjectedBundle::shared().stringBuilder()->append(" type="); + WKRetainPtr<WKStringRef> wkType(AdoptWK, WKIntentDataCopyType(intent)); + InjectedBundle::shared().stringBuilder()->append(toWTFString(wkType.get())); + InjectedBundle::shared().stringBuilder()->append("\n"); + + // FIXME: Print number of ports when exposed in WebKit2 + + WKRetainPtr<WKURLRef> wkServiceUrl(AdoptWK, WKIntentDataCopyService(intent)); + if (wkServiceUrl) { + WKRetainPtr<WKStringRef> wkService(AdoptWK, WKURLCopyString(wkServiceUrl.get())); + if (wkService && !WKStringIsEmpty(wkService.get())) { + InjectedBundle::shared().stringBuilder()->append("Explicit intent service: "); + InjectedBundle::shared().stringBuilder()->append(toWTFString(wkService.get())); + InjectedBundle::shared().stringBuilder()->append("\n"); + } + } + + WKRetainPtr<WKDictionaryRef> wkExtras(AdoptWK, WKIntentDataCopyExtras(intent)); + WKRetainPtr<WKArrayRef> wkExtraKeys(AdoptWK, WKDictionaryCopyKeys(wkExtras.get())); + const size_t numExtraKeys = WKArrayGetSize(wkExtraKeys.get()); + for (size_t i = 0; i < numExtraKeys; ++i) { + WKStringRef wkKey = static_cast<WKStringRef>(WKArrayGetItemAtIndex(wkExtraKeys.get(), i)); + WKStringRef wkValue = static_cast<WKStringRef>(WKDictionaryGetItemForKey(wkExtras.get(), wkKey)); + InjectedBundle::shared().stringBuilder()->append("Extras["); + InjectedBundle::shared().stringBuilder()->append(toWTFString(wkKey)); + InjectedBundle::shared().stringBuilder()->append("] = "); + InjectedBundle::shared().stringBuilder()->append(toWTFString(wkValue)); + InjectedBundle::shared().stringBuilder()->append("\n"); + } + + WKRetainPtr<WKArrayRef> wkSuggestions(AdoptWK, WKIntentDataCopySuggestions(intent)); + const size_t numSuggestions = WKArrayGetSize(wkSuggestions.get()); + for (size_t i = 0; i < numSuggestions; ++i) { + WKStringRef wkSuggestion = static_cast<WKStringRef>(WKArrayGetItemAtIndex(wkSuggestions.get(), i)); + InjectedBundle::shared().stringBuilder()->append("Have suggestion "); + InjectedBundle::shared().stringBuilder()->append(toWTFString(wkSuggestion)); + InjectedBundle::shared().stringBuilder()->append("\n"); + } +#endif +} + +void InjectedBundlePage::registerIntentServiceForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKIntentServiceInfoRef serviceInfo, WKTypeRef* userData, const void* clientInfo) +{ +#if ENABLE(WEB_INTENTS_TAG) + InjectedBundle::shared().stringBuilder()->append("Registered Web Intent Service: action="); + WKRetainPtr<WKStringRef> wkAction(AdoptWK, WKIntentServiceInfoCopyAction(serviceInfo)); + InjectedBundle::shared().stringBuilder()->append(toWTFString(wkAction.get())); + InjectedBundle::shared().stringBuilder()->append(" type="); + WKRetainPtr<WKStringRef> wkType(AdoptWK, WKIntentServiceInfoCopyType(serviceInfo)); + InjectedBundle::shared().stringBuilder()->append(toWTFString(wkType.get())); + InjectedBundle::shared().stringBuilder()->append(" title="); + WKRetainPtr<WKStringRef> wkTitle(AdoptWK, WKIntentServiceInfoCopyTitle(serviceInfo)); + InjectedBundle::shared().stringBuilder()->append(toWTFString(wkTitle.get())); + InjectedBundle::shared().stringBuilder()->append(" url="); + WKRetainPtr<WKURLRef> wkUrl(AdoptWK, WKIntentServiceInfoCopyHref(serviceInfo)); + InjectedBundle::shared().stringBuilder()->append(toWTFString(adoptWK(WKURLCopyString(wkUrl.get())))); + InjectedBundle::shared().stringBuilder()->append(" disposition="); + WKRetainPtr<WKStringRef> wkDisposition(AdoptWK, WKIntentServiceInfoCopyDisposition(serviceInfo)); + InjectedBundle::shared().stringBuilder()->append(toWTFString(wkDisposition.get())); + InjectedBundle::shared().stringBuilder()->append("\n"); +#endif +} + void InjectedBundlePage::didFinishDocumentLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef*, const void* clientInfo) { static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didFinishDocumentLoadForFrame(frame); diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h index 4e1fce171..824b1dfbd 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h +++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h @@ -72,6 +72,8 @@ private: 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*); + static void didReceiveIntentForFrame(WKBundlePageRef, WKBundleFrameRef, WKIntentDataRef, WKTypeRef*, const void*); + static void registerIntentServiceForFrame(WKBundlePageRef, WKBundleFrameRef, WKIntentServiceInfoRef, WKTypeRef*, const void*); void didStartProvisionalLoadForFrame(WKBundleFrameRef); void didReceiveServerRedirectForProvisionalLoadForFrame(WKBundleFrameRef); diff --git a/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp b/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp index 1ee9c38f9..a365bff55 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp @@ -613,6 +613,11 @@ void LayoutTestController::overridePreference(JSStringRef preference, bool value WKBundleOverrideBoolPreferenceForTestRunner(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), toWK(preference).get(), value); } +void LayoutTestController::setAlwaysAcceptCookies(bool accept) +{ + WKBundleSetAlwaysAcceptCookies(InjectedBundle::shared().bundle(), accept); +} + double LayoutTestController::preciseTime() { return currentTime(); diff --git a/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h b/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h index a3e33eff3..35033e29f 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h +++ b/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h @@ -206,6 +206,9 @@ public: void overridePreference(JSStringRef preference, bool value); + // Cookies testing + void setAlwaysAcceptCookies(bool); + // Custom full screen behavior. void setHasCustomFullScreenBehavior(bool value) { m_customFullScreenBehavior = value; } bool hasCustomFullScreenBehavior() const { return m_customFullScreenBehavior; } diff --git a/Tools/WebKitTestRunner/PlatformWebView.h b/Tools/WebKitTestRunner/PlatformWebView.h index a8cf0d66c..d3ad21a9e 100644 --- a/Tools/WebKitTestRunner/PlatformWebView.h +++ b/Tools/WebKitTestRunner/PlatformWebView.h @@ -29,11 +29,13 @@ #include <WebKit2/WKRetainPtr.h> #if defined(BUILDING_QT__) +QT_BEGIN_NAMESPACE +class QQuickView; +class QEventLoop; +QT_END_NAMESPACE class QQuickWebView; typedef QQuickWebView* PlatformWKView; -class QQuickView; typedef QQuickView* PlatformWindow; -class QEventLoop; #elif defined(__APPLE__) && __APPLE__ #if __OBJC__ @class WKView; diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp index 0a2cb2bdd..8c2250831 100644 --- a/Tools/WebKitTestRunner/TestController.cpp +++ b/Tools/WebKitTestRunner/TestController.cpp @@ -78,6 +78,7 @@ TestController::TestController(int argc, const char* argv[]) , m_shortTimeout(defaultShortTimeout) , m_noTimeout(defaultNoTimeout) , m_useWaitToDumpWatchdogTimer(true) + , m_forceNoTimeout(false) , m_didPrintWebProcessCrashedMessage(false) , m_shouldExitWhenWebProcessCrashes(true) , m_beforeUnloadReturnValue(true) @@ -260,6 +261,12 @@ void TestController::initialize(int argc, const char* argv[]) continue; } + if (argument == "--no-timeout-at-all") { + m_useWaitToDumpWatchdogTimer = false; + m_forceNoTimeout = true; + continue; + } + if (argument == "--pixel-tests") { m_dumpPixels = true; continue; @@ -560,18 +567,20 @@ void TestController::run() void TestController::runUntil(bool& done, TimeoutDuration timeoutDuration) { - double timeout; - switch (timeoutDuration) { - case ShortTimeout: - timeout = m_shortTimeout; - break; - case LongTimeout: - timeout = m_longTimeout; - break; - case NoTimeout: - default: - timeout = m_noTimeout; - break; + double timeout = m_noTimeout; + if (!m_forceNoTimeout) { + switch (timeoutDuration) { + case ShortTimeout: + timeout = m_shortTimeout; + break; + case LongTimeout: + timeout = m_longTimeout; + break; + case NoTimeout: + default: + timeout = m_noTimeout; + break; + } } platformRunUntil(done, timeout); diff --git a/Tools/WebKitTestRunner/TestController.h b/Tools/WebKitTestRunner/TestController.h index b9465ef96..20188ad55 100644 --- a/Tools/WebKitTestRunner/TestController.h +++ b/Tools/WebKitTestRunner/TestController.h @@ -129,6 +129,7 @@ private: double m_shortTimeout; double m_noTimeout; bool m_useWaitToDumpWatchdogTimer; + bool m_forceNoTimeout; bool m_didPrintWebProcessCrashedMessage; bool m_shouldExitWhenWebProcessCrashes; |