Changeset 169845 in webkit
- Timestamp:
- Jun 11, 2014 3:08:34 PM (10 years ago)
- Location:
- trunk/Tools
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r169840 r169845 1 2014-06-11 Simon Fraser <simon.fraser@apple.com> 2 3 WTR cleanup: push per-test viewport configuration into TestController, where platforms can customize it 4 https://bugs.webkit.org/show_bug.cgi?id=133770 5 6 Reviewed by Anders Carlsson. 7 8 Push the per-test view configuration up to TestController, so that platforms 9 can modify the behavior. This also allows platform-specific changes (e.g. 10 for threaded scrolling) to made without #ifefs. 11 12 * WebKitTestRunner/TestController.cpp: 13 (WTR::TestController::updateWebViewSizeForTest): 14 (WTR::TestController::updateWindowScaleForTest): 15 (WTR::shouldUseFixedLayout): 16 (WTR::TestController::updateLayoutTypeForTest): 17 (WTR::TestController::platformConfigureViewForTest): 18 (WTR::TestController::configureViewForTest): 19 * WebKitTestRunner/TestController.h: 20 * WebKitTestRunner/TestInvocation.cpp: 21 (WTR::TestInvocation::invoke): 22 (WTR::sizeWebViewForCurrentTest): Deleted. 23 (WTR::changeWindowScaleIfNeeded): Deleted. 24 (WTR::shouldUseThreadedScrolling): Deleted. 25 (WTR::updateThreadedScrollingForCurrentTest): Deleted. 26 (WTR::shouldUseFixedLayout): Deleted. 27 (WTR::updateLayoutType): Deleted. 28 * WebKitTestRunner/TestInvocation.h: 29 (WTR::TestInvocation::pathOrURL): 30 * WebKitTestRunner/ios/TestControllerIOS.mm: 31 (WTR::shouldMakeViewportFlexible): 32 (WTR::TestController::platformConfigureViewForTest): 33 * WebKitTestRunner/mac/TestControllerMac.mm: 34 (WTR::shouldUseThreadedScrolling): 35 (WTR::TestController::platformConfigureViewForTest): 36 1 37 2014-06-11 Gyuyoung Kim <gyuyoung.kim@samsung.com> 2 38 -
trunk/Tools/WebKitTestRunner/TestController.cpp
r169113 r169845 669 669 } 670 670 671 672 void TestController::updateWebViewSizeForTest(const TestInvocation& test) 673 { 674 bool isSVGW3CTest = strstr(test.pathOrURL(), "svg/W3C-SVG-1.1") || strstr(test.pathOrURL(), "svg\\W3C-SVG-1.1"); 675 676 unsigned width = viewWidth; 677 unsigned height = viewHeight; 678 if (isSVGW3CTest) { 679 width = w3cSVGViewWidth; 680 height = w3cSVGViewHeight; 681 } 682 683 mainWebView()->resizeTo(width, height); 684 } 685 686 void TestController::updateWindowScaleForTest(const TestInvocation& test) 687 { 688 WTF::String localPathOrUrl = String(test.pathOrURL()); 689 bool needsHighDPIWindow = localPathOrUrl.findIgnoringCase("hidpi-") != notFound; 690 mainWebView()->changeWindowScaleIfNeeded(needsHighDPIWindow ? 2 : 1); 691 } 692 693 // FIXME: move into relevant platformConfigureViewForTest()? 694 static bool shouldUseFixedLayout(const char* pathOrURL) 695 { 696 #if ENABLE(CSS_DEVICE_ADAPTATION) 697 if (strstr(pathOrURL, "device-adapt/") || strstr(pathOrURL, "device-adapt\\")) 698 return true; 699 #endif 700 701 #if USE(TILED_BACKING_STORE) && PLATFORM(EFL) 702 if (strstr(pathOrURL, "sticky/") || strstr(pathOrURL, "sticky\\")) 703 return true; 704 #endif 705 return false; 706 707 UNUSED_PARAM(pathOrURL); 708 } 709 710 void TestController::updateLayoutTypeForTest(const TestInvocation& test) 711 { 712 auto viewOptions = adoptWK(WKMutableDictionaryCreate()); 713 auto useFixedLayoutKey = adoptWK(WKStringCreateWithUTF8CString("UseFixedLayout")); 714 auto useFixedLayoutValue = adoptWK(WKBooleanCreate(shouldUseFixedLayout(test.pathOrURL()))); 715 WKDictionarySetItem(viewOptions.get(), useFixedLayoutKey.get(), useFixedLayoutValue.get()); 716 717 ensureViewSupportsOptions(viewOptions.get()); 718 } 719 720 #if !PLATFORM(COCOA) 721 void TestController::platformConfigureViewForTest(const TestInvocation&) 722 { 723 } 724 #endif 725 726 void TestController::configureViewForTest(const TestInvocation& test) 727 { 728 updateWebViewSizeForTest(test); 729 updateWindowScaleForTest(test); 730 updateLayoutTypeForTest(test); 731 732 platformConfigureViewForTest(test); 733 } 734 671 735 struct TestCommand { 672 736 TestCommand() : shouldDumpPixels(false), timeout(0) { } -
trunk/Tools/WebKitTestRunner/TestController.h
r169113 r169845 73 73 void runUntil(bool& done, TimeoutDuration); 74 74 void notifyDone(); 75 76 void configureViewForTest(const TestInvocation&); 75 77 76 78 int getCustomTimeout(); … … 117 119 void platformDestroy(); 118 120 void platformInitializeContext(); 121 void platformConfigureViewForTest(const TestInvocation&); 119 122 void platformWillRunTest(const TestInvocation&); 120 123 void platformRunUntil(bool& done, double timeout); … … 122 125 void initializeInjectedBundlePath(); 123 126 void initializeTestPluginDirectory(); 127 128 void updateWebViewSizeForTest(const TestInvocation&); 129 void updateWindowScaleForTest(const TestInvocation&); 130 void updateLayoutTypeForTest(const TestInvocation&); 124 131 125 132 void decidePolicyForGeolocationPermissionRequestIfPossible(); -
trunk/Tools/WebKitTestRunner/TestInvocation.cpp
r169700 r169845 123 123 } 124 124 125 static void sizeWebViewForCurrentTest(const char* pathOrURL)126 {127 bool isSVGW3CTest = strstr(pathOrURL, "svg/W3C-SVG-1.1") || strstr(pathOrURL, "svg\\W3C-SVG-1.1");128 129 if (isSVGW3CTest)130 TestController::shared().mainWebView()->resizeTo(TestController::w3cSVGViewWidth, TestController::w3cSVGViewHeight);131 else132 TestController::shared().mainWebView()->resizeTo(TestController::viewWidth, TestController::viewHeight);133 }134 135 static void changeWindowScaleIfNeeded(const char* pathOrURL)136 {137 WTF::String localPathOrUrl = String(pathOrURL);138 bool needsHighDPIWindow = localPathOrUrl.findIgnoringCase("hidpi-") != notFound;139 TestController::shared().mainWebView()->changeWindowScaleIfNeeded(needsHighDPIWindow ? 2 : 1);140 }141 142 125 static bool shouldLogFrameLoadDelegates(const char* pathOrURL) 143 126 { … … 145 128 } 146 129 147 #if PLATFORM(COCOA)148 static bool shouldUseThreadedScrolling(const char* pathOrURL)149 {150 return strstr(pathOrURL, "tiled-drawing/");151 }152 #endif153 154 130 static bool shouldLogHistoryClientCallbacks(const char* pathOrURL) 155 131 { … … 157 133 } 158 134 159 static void updateThreadedScrollingForCurrentTest(const char* pathOrURL)160 {161 #if PLATFORM(COCOA)162 WKRetainPtr<WKMutableDictionaryRef> viewOptions = adoptWK(WKMutableDictionaryCreate());163 WKRetainPtr<WKStringRef> useThreadedScrollingKey = adoptWK(WKStringCreateWithUTF8CString("ThreadedScrolling"));164 WKRetainPtr<WKBooleanRef> useThreadedScrollingValue = adoptWK(WKBooleanCreate(shouldUseThreadedScrolling(pathOrURL)));165 WKDictionarySetItem(viewOptions.get(), useThreadedScrollingKey.get(), useThreadedScrollingValue.get());166 167 WKRetainPtr<WKStringRef> useRemoteLayerTreeKey = adoptWK(WKStringCreateWithUTF8CString("RemoteLayerTree"));168 WKRetainPtr<WKBooleanRef> useRemoteLayerTreeValue = adoptWK(WKBooleanCreate(TestController::shared().shouldUseRemoteLayerTree()));169 WKDictionarySetItem(viewOptions.get(), useRemoteLayerTreeKey.get(), useRemoteLayerTreeValue.get());170 171 TestController::shared().ensureViewSupportsOptions(viewOptions.get());172 #else173 UNUSED_PARAM(pathOrURL);174 #endif175 }176 177 static bool shouldUseFixedLayout(const char* pathOrURL)178 {179 #if ENABLE(CSS_DEVICE_ADAPTATION)180 if (strstr(pathOrURL, "device-adapt/") || strstr(pathOrURL, "device-adapt\\"))181 return true;182 #endif183 184 #if USE(TILED_BACKING_STORE) && PLATFORM(EFL)185 if (strstr(pathOrURL, "sticky/") || strstr(pathOrURL, "sticky\\"))186 return true;187 #endif188 return false;189 190 UNUSED_PARAM(pathOrURL);191 }192 193 static void updateLayoutType(const char* pathOrURL)194 {195 WKRetainPtr<WKMutableDictionaryRef> viewOptions = adoptWK(WKMutableDictionaryCreate());196 WKRetainPtr<WKStringRef> useFixedLayoutKey = adoptWK(WKStringCreateWithUTF8CString("UseFixedLayout"));197 WKRetainPtr<WKBooleanRef> useFixedLayoutValue = adoptWK(WKBooleanCreate(shouldUseFixedLayout(pathOrURL)));198 WKDictionarySetItem(viewOptions.get(), useFixedLayoutKey.get(), useFixedLayoutValue.get());199 200 TestController::shared().ensureViewSupportsOptions(viewOptions.get());201 }202 203 135 void TestInvocation::invoke() 204 136 { 205 TestController::TimeoutDuration timeoutToUse = TestController::LongTimeout; 206 changeWindowScaleIfNeeded(m_pathOrURL.c_str()); 207 sizeWebViewForCurrentTest(m_pathOrURL.c_str()); 208 updateLayoutType(m_pathOrURL.c_str()); 209 updateThreadedScrollingForCurrentTest(m_pathOrURL.c_str()); 137 TestController::shared().configureViewForTest(*this); 210 138 211 139 WKPageSetAddsVisitedLinks(TestController::shared().mainWebView()->page(), false); … … 235 163 236 164 WKContextPostMessageToInjectedBundle(TestController::shared().context(), messageName.get(), beginTestMessageBody.get()); 165 166 TestController::TimeoutDuration timeoutToUse = TestController::LongTimeout; 237 167 238 168 TestController::shared().runUntil(m_gotInitialResponse, TestController::ShortTimeout); -
trunk/Tools/WebKitTestRunner/TestInvocation.h
r169113 r169845 41 41 42 42 WKURLRef url() const; 43 const char* pathOrURL() const { return m_pathOrURL.c_str(); } 43 44 44 45 void setIsPixelTest(const std::string& expectedPixelHash); -
trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm
r168961 r169845 63 63 } 64 64 65 static bool shouldMakeViewportFlexible(const char* pathOrURL) 66 { 67 return strstr(pathOrURL, "viewport/"); 68 } 69 70 void TestController::platformConfigureViewForTest(const TestInvocation& test) 71 { 72 if (shouldMakeViewportFlexible(test.pathOrURL())) { 73 const unsigned phoneViewHeight = 480; 74 const unsigned phoneViewWidth = 320; 75 76 mainWebView()->resizeTo(phoneViewWidth, phoneViewHeight); 77 // FIXME: more viewport config to do here. 78 } 79 } 80 65 81 void TestController::platformRunUntil(bool& done, double timeout) 66 82 { -
trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm
r168961 r169845 74 74 } 75 75 76 static bool shouldUseThreadedScrolling(const char* pathOrURL) 77 { 78 return strstr(pathOrURL, "tiled-drawing/"); 79 } 80 81 void TestController::platformConfigureViewForTest(const TestInvocation& test) 82 { 83 auto viewOptions = adoptWK(WKMutableDictionaryCreate()); 84 auto useThreadedScrollingKey = adoptWK(WKStringCreateWithUTF8CString("ThreadedScrolling")); 85 auto useThreadedScrollingValue = adoptWK(WKBooleanCreate(shouldUseThreadedScrolling(test.pathOrURL()))); 86 WKDictionarySetItem(viewOptions.get(), useThreadedScrollingKey.get(), useThreadedScrollingValue.get()); 87 88 auto useRemoteLayerTreeKey = adoptWK(WKStringCreateWithUTF8CString("RemoteLayerTree")); 89 auto useRemoteLayerTreeValue = adoptWK(WKBooleanCreate(shouldUseRemoteLayerTree())); 90 WKDictionarySetItem(viewOptions.get(), useRemoteLayerTreeKey.get(), useRemoteLayerTreeValue.get()); 91 92 ensureViewSupportsOptions(viewOptions.get()); 93 } 94 76 95 void TestController::platformRunUntil(bool& done, double timeout) 77 96 {
Note: See TracChangeset
for help on using the changeset viewer.