- Revision
- 180636
- Author
- beid...@apple.com
- Date
- 2015-02-25 13:27:37 -0800 (Wed, 25 Feb 2015)
Log Message
Get rid of TestInvocation::pathOrURL
https://bugs.webkit.org/show_bug.cgi?id=142021
Reviewed by Tim Horton.
The pathOrURL string is a relative path used as an argument to WebKitTestRunner,
but most code that uses it expected an absolute path.
This gets rid of the member and replaces all uses with a more descriptive "urlContains" method.
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::updateWebViewSizeForTest):
(WTR::TestController::updateWindowScaleForTest):
(WTR::shouldUseFixedLayout):
(WTR::TestController::updateLayoutTypeForTest):
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::TestInvocation):
(WTR::TestInvocation::urlContains):
(WTR::TestInvocation::shouldLogFrameLoadDelegates):
(WTR::TestInvocation::shouldLogHistoryClientCallbacks):
(WTR::TestInvocation::invoke):
(WTR::shouldLogFrameLoadDelegates): Deleted.
(WTR::shouldLogHistoryClientCallbacks): Deleted.
* WebKitTestRunner/TestInvocation.h:
(WTR::TestInvocation::pathOrURL): Deleted.
* 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 (180635 => 180636)
--- trunk/Tools/ChangeLog 2015-02-25 21:05:34 UTC (rev 180635)
+++ trunk/Tools/ChangeLog 2015-02-25 21:27:37 UTC (rev 180636)
@@ -11,6 +11,43 @@
2015-02-25 Brady Eidson <beid...@apple.com>
+ Get rid of TestInvocation::pathOrURL
+ https://bugs.webkit.org/show_bug.cgi?id=142021
+
+ Reviewed by Tim Horton.
+
+ The pathOrURL string is a relative path used as an argument to WebKitTestRunner,
+ but most code that uses it expected an absolute path.
+
+ This gets rid of the member and replaces all uses with a more descriptive "urlContains" method.
+
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::updateWebViewSizeForTest):
+ (WTR::TestController::updateWindowScaleForTest):
+ (WTR::shouldUseFixedLayout):
+ (WTR::TestController::updateLayoutTypeForTest):
+
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::TestInvocation):
+ (WTR::TestInvocation::urlContains):
+ (WTR::TestInvocation::shouldLogFrameLoadDelegates):
+ (WTR::TestInvocation::shouldLogHistoryClientCallbacks):
+ (WTR::TestInvocation::invoke):
+ (WTR::shouldLogFrameLoadDelegates): Deleted.
+ (WTR::shouldLogHistoryClientCallbacks): Deleted.
+ * WebKitTestRunner/TestInvocation.h:
+ (WTR::TestInvocation::pathOrURL): Deleted.
+
+ * WebKitTestRunner/ios/TestControllerIOS.mm:
+ (WTR::shouldMakeViewportFlexible):
+ (WTR::TestController::platformConfigureViewForTest):
+
+ * WebKitTestRunner/mac/TestControllerMac.mm:
+ (WTR::shouldUseThreadedScrolling):
+ (WTR::TestController::platformConfigureViewForTest):
+
+2015-02-25 Brady Eidson <beid...@apple.com>
+
Layout test support for user content filters
https://bugs.webkit.org/show_bug.cgi?id=142018
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (180635 => 180636)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2015-02-25 21:05:34 UTC (rev 180635)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2015-02-25 21:27:37 UTC (rev 180636)
@@ -717,7 +717,7 @@
void TestController::updateWebViewSizeForTest(const TestInvocation& test)
{
- bool isSVGW3CTest = strstr(test.pathOrURL(), "svg/W3C-SVG-1.1") || strstr(test.pathOrURL(), "svg\\W3C-SVG-1.1");
+ bool isSVGW3CTest = test.urlContains("svg/W3C-SVG-1.1") || test.urlContains("svg\\W3C-SVG-1.1");
unsigned width = viewWidth;
unsigned height = viewHeight;
@@ -731,33 +731,32 @@
void TestController::updateWindowScaleForTest(PlatformWebView* view, const TestInvocation& test)
{
- WTF::String localPathOrUrl = String(test.pathOrURL());
- bool needsHighDPIWindow = localPathOrUrl.findIgnoringCase("/hidpi-") != notFound;
+ bool needsHighDPIWindow = test.urlContains("/hidpi-");
view->changeWindowScaleIfNeeded(needsHighDPIWindow ? 2 : 1);
}
// FIXME: move into relevant platformConfigureViewForTest()?
-static bool shouldUseFixedLayout(const char* pathOrURL)
+static bool shouldUseFixedLayout(const TestInvocation& test)
{
#if ENABLE(CSS_DEVICE_ADAPTATION)
- if (strstr(pathOrURL, "device-adapt/") || strstr(pathOrURL, "device-adapt\\"))
+ if (test.urlContains("device-adapt/") || test.urlContains("device-adapt\\"))
return true;
#endif
#if USE(TILED_BACKING_STORE) && PLATFORM(EFL)
- if (strstr(pathOrURL, "sticky/") || strstr(pathOrURL, "sticky\\"))
+ if (test.urlContains("sticky/") || test.urlContains("sticky\\"))
return true;
#endif
return false;
- UNUSED_PARAM(pathOrURL);
+ UNUSED_PARAM(test);
}
void TestController::updateLayoutTypeForTest(const TestInvocation& test)
{
auto viewOptions = adoptWK(WKMutableDictionaryCreate());
auto useFixedLayoutKey = adoptWK(WKStringCreateWithUTF8CString("UseFixedLayout"));
- auto useFixedLayoutValue = adoptWK(WKBooleanCreate(shouldUseFixedLayout(test.pathOrURL())));
+ auto useFixedLayoutValue = adoptWK(WKBooleanCreate(shouldUseFixedLayout(test)));
WKDictionarySetItem(viewOptions.get(), useFixedLayoutKey.get(), useFixedLayoutValue.get());
ensureViewSupportsOptions(viewOptions.get());
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (180635 => 180636)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2015-02-25 21:05:34 UTC (rev 180635)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2015-02-25 21:27:37 UTC (rev 180636)
@@ -91,7 +91,6 @@
TestInvocation::TestInvocation(const std::string& pathOrURL)
: m_url(AdoptWK, createWKURL(pathOrURL.c_str()))
- , m_pathOrURL(pathOrURL)
, m_dumpPixels(false)
, m_timeout(0)
, m_gotInitialResponse(false)
@@ -100,6 +99,16 @@
, m_error(false)
, m_webProcessIsUnresponsive(false)
{
+ WKRetainPtr<WKStringRef> urlString = adoptWK(WKURLCopyString(m_url.get()));
+
+ size_t stringLength = WKStringGetLength(urlString.get());
+
+ Vector<char> urlVector;
+ urlVector.resize(stringLength + 1);
+
+ WKStringGetUTF8CString(urlString.get(), urlVector.data(), stringLength + 1);
+
+ m_urlString = String(urlVector.data(), stringLength);
}
TestInvocation::~TestInvocation()
@@ -111,20 +120,25 @@
return m_url.get();
}
+bool TestInvocation::urlContains(const char* searchString) const
+{
+ return m_urlString.contains(searchString, false);
+}
+
void TestInvocation::setIsPixelTest(const std::string& expectedPixelHash)
{
m_dumpPixels = true;
m_expectedPixelHash = expectedPixelHash;
}
-static bool shouldLogFrameLoadDelegates(const char* pathOrURL)
+bool TestInvocation::shouldLogFrameLoadDelegates()
{
- return strstr(pathOrURL, "loading/");
+ return urlContains("loading/");
}
-static bool shouldLogHistoryClientCallbacks(const char* pathOrURL)
+bool TestInvocation::shouldLogHistoryClientCallbacks()
{
- return strstr(pathOrURL, "globalhistory/");
+ return urlContains("globalhistory/");
}
void TestInvocation::invoke()
@@ -135,7 +149,7 @@
m_textOutput.clear();
- TestController::singleton().setShouldLogHistoryClientCallbacks(shouldLogHistoryClientCallbacks(m_pathOrURL.c_str()));
+ TestController::singleton().setShouldLogHistoryClientCallbacks(shouldLogHistoryClientCallbacks());
// FIXME: We should clear out visited links here.
@@ -143,7 +157,7 @@
WKRetainPtr<WKMutableDictionaryRef> beginTestMessageBody = adoptWK(WKMutableDictionaryCreate());
WKRetainPtr<WKStringRef> dumpFrameLoadDelegatesKey = adoptWK(WKStringCreateWithUTF8CString("DumpFrameLoadDelegates"));
- WKRetainPtr<WKBooleanRef> dumpFrameLoadDelegatesValue = adoptWK(WKBooleanCreate(shouldLogFrameLoadDelegates(m_pathOrURL.c_str())));
+ WKRetainPtr<WKBooleanRef> dumpFrameLoadDelegatesValue = adoptWK(WKBooleanCreate(shouldLogFrameLoadDelegates()));
WKDictionarySetItem(beginTestMessageBody.get(), dumpFrameLoadDelegatesKey.get(), dumpFrameLoadDelegatesValue.get());
WKRetainPtr<WKStringRef> dumpPixelsKey = adoptWK(WKStringCreateWithUTF8CString("DumpPixels"));
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.h (180635 => 180636)
--- trunk/Tools/WebKitTestRunner/TestInvocation.h 2015-02-25 21:05:34 UTC (rev 180635)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.h 2015-02-25 21:27:37 UTC (rev 180636)
@@ -40,7 +40,7 @@
~TestInvocation();
WKURLRef url() const;
- const char* pathOrURL() const { return m_pathOrURL.c_str(); }
+ bool urlContains(const char*) const;
void setIsPixelTest(const std::string& expectedPixelHash);
@@ -63,9 +63,12 @@
static void forceRepaintDoneCallback(WKErrorRef, void* context);
+ bool shouldLogFrameLoadDelegates();
+ bool shouldLogHistoryClientCallbacks();
+
WKRetainPtr<WKURLRef> m_url;
- std::string m_pathOrURL;
-
+ WTF::String m_urlString;
+
bool m_dumpPixels;
std::string m_expectedPixelHash;
Modified: trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm (180635 => 180636)
--- trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm 2015-02-25 21:05:34 UTC (rev 180635)
+++ trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm 2015-02-25 21:27:37 UTC (rev 180636)
@@ -75,9 +75,9 @@
setCrashReportApplicationSpecificInformationToURL(testInvocation.url());
}
-static bool shouldMakeViewportFlexible(const char* pathOrURL)
+static bool shouldMakeViewportFlexible(const TestInvocation& test)
{
- return strstr(pathOrURL, "viewport/");
+ return test.urlContains("viewport/");
}
void TestController::platformResetPreferencesToConsistentValues()
@@ -89,7 +89,7 @@
void TestController::platformConfigureViewForTest(const TestInvocation& test)
{
- if (shouldMakeViewportFlexible(test.pathOrURL())) {
+ if (shouldMakeViewportFlexible(test)) {
const unsigned phoneViewHeight = 480;
const unsigned phoneViewWidth = 320;
Modified: trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm (180635 => 180636)
--- trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm 2015-02-25 21:05:34 UTC (rev 180635)
+++ trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm 2015-02-25 21:27:37 UTC (rev 180636)
@@ -75,9 +75,9 @@
setCrashReportApplicationSpecificInformationToURL(testInvocation.url());
}
-static bool shouldUseThreadedScrolling(const char* pathOrURL)
+static bool shouldUseThreadedScrolling(const TestInvocation& test)
{
- return strstr(pathOrURL, "tiled-drawing/");
+ return test.urlContains("tiled-drawing/");
}
void TestController::platformResetPreferencesToConsistentValues()
@@ -88,7 +88,7 @@
{
auto viewOptions = adoptWK(WKMutableDictionaryCreate());
auto useThreadedScrollingKey = adoptWK(WKStringCreateWithUTF8CString("ThreadedScrolling"));
- auto useThreadedScrollingValue = adoptWK(WKBooleanCreate(shouldUseThreadedScrolling(test.pathOrURL())));
+ auto useThreadedScrollingValue = adoptWK(WKBooleanCreate(shouldUseThreadedScrolling(test)));
WKDictionarySetItem(viewOptions.get(), useThreadedScrollingKey.get(), useThreadedScrollingValue.get());
auto useRemoteLayerTreeKey = adoptWK(WKStringCreateWithUTF8CString("RemoteLayerTree"));
@@ -97,15 +97,10 @@
ensureViewSupportsOptions(viewOptions.get());
- WKURLRef url = ""
- WKRetainPtr<WKStringRef> urlString = adoptWK(WKURLCopyString(url));
-
- char urlCString[16384];
- WKStringGetUTF8CString(urlString.get(), urlCString, 16384);
- if (!strstr(urlCString, "usercontentfilter/"))
+ if (!test.urlContains("usercontentfilter/"))
return;
- RetainPtr<CFURLRef> testURL = adoptCF(WKURLCopyCFURL(kCFAllocatorDefault, url));
+ RetainPtr<CFURLRef> testURL = adoptCF(WKURLCopyCFURL(kCFAllocatorDefault, test.url()));
NSURL *filterURL = [(NSURL *)testURL.get() URLByAppendingPathExtension:@"json"];
NSStringEncoding encoding;