diff options
| author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-07 11:22:47 +0100 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-07 11:22:47 +0100 |
| commit | cfd86b747d32ac22246a1aa908eaa720c63a88c1 (patch) | |
| tree | 24d68c6f61c464ecba1e05670b80390ea3b0e50c /Tools/WebKitTestRunner/TestController.cpp | |
| parent | 69d7c744c9de19d152dbe2d8e46eb7dfd4511d1a (diff) | |
| download | qtwebkit-cfd86b747d32ac22246a1aa908eaa720c63a88c1.tar.gz | |
Imported WebKit commit 20271caf2e2c016d5cef40184cddeefeac4f1876 (http://svn.webkit.org/repository/webkit/trunk@133733)
New snapshot that contains all previous fixes as well as build fix for latest QtMultimedia API changes.
Diffstat (limited to 'Tools/WebKitTestRunner/TestController.cpp')
| -rw-r--r-- | Tools/WebKitTestRunner/TestController.cpp | 49 |
1 files changed, 44 insertions, 5 deletions
diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp index e9ef0471d..07ff81bb7 100644 --- a/Tools/WebKitTestRunner/TestController.cpp +++ b/Tools/WebKitTestRunner/TestController.cpp @@ -81,6 +81,7 @@ TestController::TestController(int argc, const char* argv[]) , m_printSeparators(false) , m_usingServerMode(false) , m_gcBetweenTests(false) + , m_shouldDumpPixelsForAllTests(false) , m_state(Initial) , m_doneResetting(false) , m_longTimeout(defaultLongTimeout) @@ -95,9 +96,6 @@ TestController::TestController(int argc, const char* argv[]) , m_isGeolocationPermissionAllowed(false) , m_policyDelegateEnabled(false) , m_policyDelegatePermissive(false) -#if PLATFORM(MAC) || PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL) - , m_eventSenderProxy(new EventSenderProxy(this)) -#endif { initialize(argc, argv); controller = this; @@ -283,11 +281,16 @@ void TestController::initialize(int argc, const char* argv[]) m_gcBetweenTests = true; continue; } + if (argument == "--pixel-tests" || argument == "-p") { + m_shouldDumpPixelsForAllTests = true; + continue; + } if (argument == "--print-supported-features") { printSupportedFeatures = true; break; } + // Skip any other arguments that begin with '--'. if (argument.length() >= 2 && argument[0] == '-' && argument[1] == '-') continue; @@ -323,6 +326,18 @@ void TestController::initialize(int argc, const char* argv[]) WKContextSetLocalStorageDirectory(m_context.get(), dumpRenderTreeTempWK.get()); WKContextSetDiskCacheDirectory(m_context.get(), dumpRenderTreeTempWK.get()); WKContextSetCookieStorageDirectory(m_context.get(), dumpRenderTreeTempWK.get()); + + std::string iconDatabaseFileTemp(dumpRenderTreeTemp); + // WebCore::pathByAppendingComponent is not used here because of the namespace, + // which leads us to this ugly #ifdef and file path concatenation. +#if OS(WINDOWS) + const char separator = '\\'; +#else + const char separator = '/'; +#endif + iconDatabaseFileTemp = iconDatabaseFileTemp + separator + "WebpageIcons.db"; + WKRetainPtr<WKStringRef> iconDatabaseFileTempWK = WKStringCreateWithUTF8CString(iconDatabaseFileTemp.c_str()); + WKContextSetIconDatabasePath(m_context.get(), iconDatabaseFileTempWK.get()); } platformInitializeContext(); @@ -343,8 +358,12 @@ void TestController::initialize(int argc, const char* argv[]) if (testPluginDirectory()) WKContextSetAdditionalPluginsDirectory(m_context.get(), testPluginDirectory()); - m_mainWebView = adoptPtr(new PlatformWebView(m_context.get(), m_pageGroup.get())); + createWebViewWithOptions(0); +} +void TestController::createWebViewWithOptions(WKDictionaryRef options) +{ + m_mainWebView = adoptPtr(new PlatformWebView(m_context.get(), m_pageGroup.get(), options)); WKPageUIClient pageUIClient = { kWKPageUIClientCurrentVersion, m_mainWebView.get(), @@ -446,6 +465,21 @@ void TestController::initialize(int argc, const char* argv[]) WKPageSetPagePolicyClient(m_mainWebView->page(), &pagePolicyClient); } +void TestController::ensureViewSupportsOptions(WKDictionaryRef options) +{ + if (m_mainWebView && !m_mainWebView->viewSupportsOptions(options)) { + WKPageSetPageUIClient(m_mainWebView->page(), 0); + WKPageSetPageLoaderClient(m_mainWebView->page(), 0); + WKPageSetPagePolicyClient(m_mainWebView->page(), 0); + WKPageClose(m_mainWebView->page()); + + m_mainWebView = nullptr; + + createWebViewWithOptions(options); + resetStateToConsistentValues(); + } +} + bool TestController::resetStateToConsistentValues() { m_state = Resetting; @@ -467,6 +501,11 @@ bool TestController::resetStateToConsistentValues() // FIXME: This function should also ensure that there is only one page open. + // Reset the EventSender for each test. +#if PLATFORM(MAC) || PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL) + m_eventSenderProxy = adoptPtr(new EventSenderProxy(this)); +#endif + // Reset preferences WKPreferencesRef preferences = WKPageGroupGetPreferences(m_pageGroup.get()); WKPreferencesResetTestRunnerOverrides(preferences); @@ -629,7 +668,7 @@ bool TestController::runTest(const char* inputLine) m_state = RunningTest; m_currentInvocation = adoptPtr(new TestInvocation(command.pathOrURL)); - if (command.shouldDumpPixels) + if (command.shouldDumpPixels || m_shouldDumpPixelsForAllTests) m_currentInvocation->setIsPixelTest(command.expectedPixelHash); m_currentInvocation->invoke(); |
