- Revision
- 169845
- Author
- [email protected]
- Date
- 2014-06-11 15:08:34 -0700 (Wed, 11 Jun 2014)
Log Message
WTR cleanup: push per-test viewport configuration into TestController, where platforms can customize it
https://bugs.webkit.org/show_bug.cgi?id=133770
Reviewed by Anders Carlsson.
Push the per-test view configuration up to TestController, so that platforms
can modify the behavior. This also allows platform-specific changes (e.g.
for threaded scrolling) to made without #ifefs.
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::updateWebViewSizeForTest):
(WTR::TestController::updateWindowScaleForTest):
(WTR::shouldUseFixedLayout):
(WTR::TestController::updateLayoutTypeForTest):
(WTR::TestController::platformConfigureViewForTest):
(WTR::TestController::configureViewForTest):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::invoke):
(WTR::sizeWebViewForCurrentTest): Deleted.
(WTR::changeWindowScaleIfNeeded): Deleted.
(WTR::shouldUseThreadedScrolling): Deleted.
(WTR::updateThreadedScrollingForCurrentTest): Deleted.
(WTR::shouldUseFixedLayout): Deleted.
(WTR::updateLayoutType): Deleted.
* WebKitTestRunner/TestInvocation.h:
(WTR::TestInvocation::pathOrURL):
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::shouldMakeViewportFlexible):
(WTR::TestController::platformConfigureViewForTest):
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::shouldUseThreadedScrolling):
(WTR::TestController::platformConfigureViewForTest):
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (169844 => 169845)
--- trunk/Tools/ChangeLog 2014-06-11 22:01:03 UTC (rev 169844)
+++ trunk/Tools/ChangeLog 2014-06-11 22:08:34 UTC (rev 169845)
@@ -1,3 +1,39 @@
+2014-06-11 Simon Fraser <[email protected]>
+
+ WTR cleanup: push per-test viewport configuration into TestController, where platforms can customize it
+ https://bugs.webkit.org/show_bug.cgi?id=133770
+
+ Reviewed by Anders Carlsson.
+
+ Push the per-test view configuration up to TestController, so that platforms
+ can modify the behavior. This also allows platform-specific changes (e.g.
+ for threaded scrolling) to made without #ifefs.
+
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::updateWebViewSizeForTest):
+ (WTR::TestController::updateWindowScaleForTest):
+ (WTR::shouldUseFixedLayout):
+ (WTR::TestController::updateLayoutTypeForTest):
+ (WTR::TestController::platformConfigureViewForTest):
+ (WTR::TestController::configureViewForTest):
+ * WebKitTestRunner/TestController.h:
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::invoke):
+ (WTR::sizeWebViewForCurrentTest): Deleted.
+ (WTR::changeWindowScaleIfNeeded): Deleted.
+ (WTR::shouldUseThreadedScrolling): Deleted.
+ (WTR::updateThreadedScrollingForCurrentTest): Deleted.
+ (WTR::shouldUseFixedLayout): Deleted.
+ (WTR::updateLayoutType): Deleted.
+ * WebKitTestRunner/TestInvocation.h:
+ (WTR::TestInvocation::pathOrURL):
+ * WebKitTestRunner/ios/TestControllerIOS.mm:
+ (WTR::shouldMakeViewportFlexible):
+ (WTR::TestController::platformConfigureViewForTest):
+ * WebKitTestRunner/mac/TestControllerMac.mm:
+ (WTR::shouldUseThreadedScrolling):
+ (WTR::TestController::platformConfigureViewForTest):
+
2014-06-11 Gyuyoung Kim <[email protected]>
[EFL] Add dependencies packages to efl install-dependencies file
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (169844 => 169845)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2014-06-11 22:01:03 UTC (rev 169844)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2014-06-11 22:08:34 UTC (rev 169845)
@@ -668,6 +668,70 @@
return m_doneResetting;
}
+
+void TestController::updateWebViewSizeForTest(const TestInvocation& test)
+{
+ bool isSVGW3CTest = strstr(test.pathOrURL(), "svg/W3C-SVG-1.1") || strstr(test.pathOrURL(), "svg\\W3C-SVG-1.1");
+
+ unsigned width = viewWidth;
+ unsigned height = viewHeight;
+ if (isSVGW3CTest) {
+ width = w3cSVGViewWidth;
+ height = w3cSVGViewHeight;
+ }
+
+ mainWebView()->resizeTo(width, height);
+}
+
+void TestController::updateWindowScaleForTest(const TestInvocation& test)
+{
+ WTF::String localPathOrUrl = String(test.pathOrURL());
+ bool needsHighDPIWindow = localPathOrUrl.findIgnoringCase("hidpi-") != notFound;
+ mainWebView()->changeWindowScaleIfNeeded(needsHighDPIWindow ? 2 : 1);
+}
+
+// FIXME: move into relevant platformConfigureViewForTest()?
+static bool shouldUseFixedLayout(const char* pathOrURL)
+{
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+ if (strstr(pathOrURL, "device-adapt/") || strstr(pathOrURL, "device-adapt\\"))
+ return true;
+#endif
+
+#if USE(TILED_BACKING_STORE) && PLATFORM(EFL)
+ if (strstr(pathOrURL, "sticky/") || strstr(pathOrURL, "sticky\\"))
+ return true;
+#endif
+ return false;
+
+ UNUSED_PARAM(pathOrURL);
+}
+
+void TestController::updateLayoutTypeForTest(const TestInvocation& test)
+{
+ auto viewOptions = adoptWK(WKMutableDictionaryCreate());
+ auto useFixedLayoutKey = adoptWK(WKStringCreateWithUTF8CString("UseFixedLayout"));
+ auto useFixedLayoutValue = adoptWK(WKBooleanCreate(shouldUseFixedLayout(test.pathOrURL())));
+ WKDictionarySetItem(viewOptions.get(), useFixedLayoutKey.get(), useFixedLayoutValue.get());
+
+ ensureViewSupportsOptions(viewOptions.get());
+}
+
+#if !PLATFORM(COCOA)
+void TestController::platformConfigureViewForTest(const TestInvocation&)
+{
+}
+#endif
+
+void TestController::configureViewForTest(const TestInvocation& test)
+{
+ updateWebViewSizeForTest(test);
+ updateWindowScaleForTest(test);
+ updateLayoutTypeForTest(test);
+
+ platformConfigureViewForTest(test);
+}
+
struct TestCommand {
TestCommand() : shouldDumpPixels(false), timeout(0) { }
Modified: trunk/Tools/WebKitTestRunner/TestController.h (169844 => 169845)
--- trunk/Tools/WebKitTestRunner/TestController.h 2014-06-11 22:01:03 UTC (rev 169844)
+++ trunk/Tools/WebKitTestRunner/TestController.h 2014-06-11 22:08:34 UTC (rev 169845)
@@ -72,6 +72,8 @@
bool useWaitToDumpWatchdogTimer() { return m_useWaitToDumpWatchdogTimer; }
void runUntil(bool& done, TimeoutDuration);
void notifyDone();
+
+ void configureViewForTest(const TestInvocation&);
int getCustomTimeout();
@@ -116,12 +118,17 @@
void platformInitialize();
void platformDestroy();
void platformInitializeContext();
+ void platformConfigureViewForTest(const TestInvocation&);
void platformWillRunTest(const TestInvocation&);
void platformRunUntil(bool& done, double timeout);
void platformDidCommitLoadForFrame(WKPageRef, WKFrameRef);
void initializeInjectedBundlePath();
void initializeTestPluginDirectory();
+ void updateWebViewSizeForTest(const TestInvocation&);
+ void updateWindowScaleForTest(const TestInvocation&);
+ void updateLayoutTypeForTest(const TestInvocation&);
+
void decidePolicyForGeolocationPermissionRequestIfPossible();
// WKContextInjectedBundleClient
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (169844 => 169845)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2014-06-11 22:01:03 UTC (rev 169844)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2014-06-11 22:08:34 UTC (rev 169845)
@@ -122,91 +122,19 @@
m_timeout = timeout;
}
-static void sizeWebViewForCurrentTest(const char* pathOrURL)
-{
- bool isSVGW3CTest = strstr(pathOrURL, "svg/W3C-SVG-1.1") || strstr(pathOrURL, "svg\\W3C-SVG-1.1");
-
- if (isSVGW3CTest)
- TestController::shared().mainWebView()->resizeTo(TestController::w3cSVGViewWidth, TestController::w3cSVGViewHeight);
- else
- TestController::shared().mainWebView()->resizeTo(TestController::viewWidth, TestController::viewHeight);
-}
-
-static void changeWindowScaleIfNeeded(const char* pathOrURL)
-{
- WTF::String localPathOrUrl = String(pathOrURL);
- bool needsHighDPIWindow = localPathOrUrl.findIgnoringCase("hidpi-") != notFound;
- TestController::shared().mainWebView()->changeWindowScaleIfNeeded(needsHighDPIWindow ? 2 : 1);
-}
-
static bool shouldLogFrameLoadDelegates(const char* pathOrURL)
{
return strstr(pathOrURL, "loading/");
}
-#if PLATFORM(COCOA)
-static bool shouldUseThreadedScrolling(const char* pathOrURL)
-{
- return strstr(pathOrURL, "tiled-drawing/");
-}
-#endif
-
static bool shouldLogHistoryClientCallbacks(const char* pathOrURL)
{
return strstr(pathOrURL, "globalhistory/");
}
-static void updateThreadedScrollingForCurrentTest(const char* pathOrURL)
-{
-#if PLATFORM(COCOA)
- WKRetainPtr<WKMutableDictionaryRef> viewOptions = adoptWK(WKMutableDictionaryCreate());
- WKRetainPtr<WKStringRef> useThreadedScrollingKey = adoptWK(WKStringCreateWithUTF8CString("ThreadedScrolling"));
- WKRetainPtr<WKBooleanRef> useThreadedScrollingValue = adoptWK(WKBooleanCreate(shouldUseThreadedScrolling(pathOrURL)));
- WKDictionarySetItem(viewOptions.get(), useThreadedScrollingKey.get(), useThreadedScrollingValue.get());
-
- WKRetainPtr<WKStringRef> useRemoteLayerTreeKey = adoptWK(WKStringCreateWithUTF8CString("RemoteLayerTree"));
- WKRetainPtr<WKBooleanRef> useRemoteLayerTreeValue = adoptWK(WKBooleanCreate(TestController::shared().shouldUseRemoteLayerTree()));
- WKDictionarySetItem(viewOptions.get(), useRemoteLayerTreeKey.get(), useRemoteLayerTreeValue.get());
-
- TestController::shared().ensureViewSupportsOptions(viewOptions.get());
-#else
- UNUSED_PARAM(pathOrURL);
-#endif
-}
-
-static bool shouldUseFixedLayout(const char* pathOrURL)
-{
-#if ENABLE(CSS_DEVICE_ADAPTATION)
- if (strstr(pathOrURL, "device-adapt/") || strstr(pathOrURL, "device-adapt\\"))
- return true;
-#endif
-
-#if USE(TILED_BACKING_STORE) && PLATFORM(EFL)
- if (strstr(pathOrURL, "sticky/") || strstr(pathOrURL, "sticky\\"))
- return true;
-#endif
- return false;
-
- UNUSED_PARAM(pathOrURL);
-}
-
-static void updateLayoutType(const char* pathOrURL)
-{
- WKRetainPtr<WKMutableDictionaryRef> viewOptions = adoptWK(WKMutableDictionaryCreate());
- WKRetainPtr<WKStringRef> useFixedLayoutKey = adoptWK(WKStringCreateWithUTF8CString("UseFixedLayout"));
- WKRetainPtr<WKBooleanRef> useFixedLayoutValue = adoptWK(WKBooleanCreate(shouldUseFixedLayout(pathOrURL)));
- WKDictionarySetItem(viewOptions.get(), useFixedLayoutKey.get(), useFixedLayoutValue.get());
-
- TestController::shared().ensureViewSupportsOptions(viewOptions.get());
-}
-
void TestInvocation::invoke()
{
- TestController::TimeoutDuration timeoutToUse = TestController::LongTimeout;
- changeWindowScaleIfNeeded(m_pathOrURL.c_str());
- sizeWebViewForCurrentTest(m_pathOrURL.c_str());
- updateLayoutType(m_pathOrURL.c_str());
- updateThreadedScrollingForCurrentTest(m_pathOrURL.c_str());
+ TestController::shared().configureViewForTest(*this);
WKPageSetAddsVisitedLinks(TestController::shared().mainWebView()->page(), false);
@@ -235,6 +163,8 @@
WKContextPostMessageToInjectedBundle(TestController::shared().context(), messageName.get(), beginTestMessageBody.get());
+ TestController::TimeoutDuration timeoutToUse = TestController::LongTimeout;
+
TestController::shared().runUntil(m_gotInitialResponse, TestController::ShortTimeout);
if (!m_gotInitialResponse) {
m_errorMessage = "Timed out waiting for initial response from web process\n";
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.h (169844 => 169845)
--- trunk/Tools/WebKitTestRunner/TestInvocation.h 2014-06-11 22:01:03 UTC (rev 169844)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.h 2014-06-11 22:08:34 UTC (rev 169845)
@@ -40,6 +40,7 @@
~TestInvocation();
WKURLRef url() const;
+ const char* pathOrURL() const { return m_pathOrURL.c_str(); }
void setIsPixelTest(const std::string& expectedPixelHash);
Modified: trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm (169844 => 169845)
--- trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm 2014-06-11 22:01:03 UTC (rev 169844)
+++ trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm 2014-06-11 22:08:34 UTC (rev 169845)
@@ -62,6 +62,22 @@
setCrashReportApplicationSpecificInformationToURL(testInvocation.url());
}
+static bool shouldMakeViewportFlexible(const char* pathOrURL)
+{
+ return strstr(pathOrURL, "viewport/");
+}
+
+void TestController::platformConfigureViewForTest(const TestInvocation& test)
+{
+ if (shouldMakeViewportFlexible(test.pathOrURL())) {
+ const unsigned phoneViewHeight = 480;
+ const unsigned phoneViewWidth = 320;
+
+ mainWebView()->resizeTo(phoneViewWidth, phoneViewHeight);
+ // FIXME: more viewport config to do here.
+ }
+}
+
void TestController::platformRunUntil(bool& done, double timeout)
{
NSDate *endDate = (timeout > 0) ? [NSDate dateWithTimeIntervalSinceNow:timeout] : [NSDate distantFuture];
Modified: trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm (169844 => 169845)
--- trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm 2014-06-11 22:01:03 UTC (rev 169844)
+++ trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm 2014-06-11 22:08:34 UTC (rev 169845)
@@ -73,6 +73,25 @@
setCrashReportApplicationSpecificInformationToURL(testInvocation.url());
}
+static bool shouldUseThreadedScrolling(const char* pathOrURL)
+{
+ return strstr(pathOrURL, "tiled-drawing/");
+}
+
+void TestController::platformConfigureViewForTest(const TestInvocation& test)
+{
+ auto viewOptions = adoptWK(WKMutableDictionaryCreate());
+ auto useThreadedScrollingKey = adoptWK(WKStringCreateWithUTF8CString("ThreadedScrolling"));
+ auto useThreadedScrollingValue = adoptWK(WKBooleanCreate(shouldUseThreadedScrolling(test.pathOrURL())));
+ WKDictionarySetItem(viewOptions.get(), useThreadedScrollingKey.get(), useThreadedScrollingValue.get());
+
+ auto useRemoteLayerTreeKey = adoptWK(WKStringCreateWithUTF8CString("RemoteLayerTree"));
+ auto useRemoteLayerTreeValue = adoptWK(WKBooleanCreate(shouldUseRemoteLayerTree()));
+ WKDictionarySetItem(viewOptions.get(), useRemoteLayerTreeKey.get(), useRemoteLayerTreeValue.get());
+
+ ensureViewSupportsOptions(viewOptions.get());
+}
+
void TestController::platformRunUntil(bool& done, double timeout)
{
NSDate *endDate = (timeout > 0) ? [NSDate dateWithTimeIntervalSinceNow:timeout] : [NSDate distantFuture];