Diff
Modified: trunk/LayoutTests/ChangeLog (166395 => 166396)
--- trunk/LayoutTests/ChangeLog 2014-03-28 03:52:01 UTC (rev 166395)
+++ trunk/LayoutTests/ChangeLog 2014-03-28 04:06:58 UTC (rev 166396)
@@ -1,3 +1,13 @@
+2014-03-27 Mark Rowe <mr...@apple.com>
+
+ <https://webkit.org/b/42704> WebKitTestRunner needs to print history delegate information
+
+ Reviewed by Sam Weinig.
+
+ * platform/wk2/TestExpectations: Enable the two layout tests that pass. One test remains disabled
+ due to lack of testRunner API, and another due to an apparent bug in WebKit2's handling of
+ client redirects.
+
2014-03-27 Oliver Hunt <oli...@apple.com>
Support spread operand in |new| expressions
Modified: trunk/LayoutTests/platform/wk2/TestExpectations (166395 => 166396)
--- trunk/LayoutTests/platform/wk2/TestExpectations 2014-03-28 03:52:01 UTC (rev 166395)
+++ trunk/LayoutTests/platform/wk2/TestExpectations 2014-03-28 04:06:58 UTC (rev 166396)
@@ -175,13 +175,12 @@
# <https://bugs.webkit.org/show_bug.cgi?id=42777>
fast/loader/non-deferred-substitute-load.html
-# WebKitTestRunner needs to print history delegate information
-# <https://bugs.webkit.org/show_bug.cgi?id=42704>
-http/tests/globalhistory/history-delegate-basic-302-redirect.html
-http/tests/globalhistory/history-delegate-basic-refresh-redirect.html
-http/tests/globalhistory/history-delegate-basic-title.html
+# WebKitTestRunner needs testRunner.removeAllVisitedLinks
http/tests/globalhistory/history-delegate-basic-visited-links.html
+# WebKit2 passes the wrong source URL for client redirects
+http/tests/globalhistory/history-delegate-basic-refresh-redirect.html
+
# transitions/default-timing-function.html failing on WebKit2 since it was added
# <https://bugs.webkit.org/show_bug.cgi?id=56531>
transitions/default-timing-function.html
Modified: trunk/Tools/ChangeLog (166395 => 166396)
--- trunk/Tools/ChangeLog 2014-03-28 03:52:01 UTC (rev 166395)
+++ trunk/Tools/ChangeLog 2014-03-28 04:06:58 UTC (rev 166396)
@@ -1,3 +1,28 @@
+2014-03-27 Mikhail Pozdnyakov <mikhail.pozdnya...@intel.com>
+
+ <https://webkit.org/b/42704> WebKitTestRunner needs to print history delegate information
+
+ Provide an implementation of WKContextHistoryClient that logs when called for tests in
+ the globalhistory directory.
+
+ Reviewed by Sam Weinig.
+
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::TestController):
+ (WTR::TestController::initialize): Set the history client.
+ (WTR::TestController::resetStateToConsistentValues): Disable logging of history client callbacks.
+ (WTR::TestController::didNavigateWithNavigationData): Log information about the navigation. Some portions
+ of the output are hard-coded to match WebKit1's results for now since they're fixed in our existing tests
+ and we don't yet have API to access the data in question.
+ (WTR::TestController::didPerformClientRedirect):
+ (WTR::TestController::didPerformServerRedirect):
+ (WTR::TestController::didUpdateHistoryTitle):
+ * WebKitTestRunner/TestController.h:
+ (WTR::TestController::setShouldLogHistoryClientCallbacks):
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::shouldLogHistoryClientCallbacks): Log history client callbacks for tests in a globalhistory directory.
+ (WTR::TestInvocation::invoke):
+
2014-03-27 Filip Pizlo <fpi...@apple.com>
Revert http://trac.webkit.org/changeset/166386 because it broke builds.
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (166395 => 166396)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2014-03-28 03:52:01 UTC (rev 166395)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2014-03-28 04:06:58 UTC (rev 166396)
@@ -121,6 +121,7 @@
, m_forceComplexText(false)
, m_shouldUseAcceleratedDrawing(false)
, m_shouldUseRemoteLayerTree(false)
+ , m_shouldLogHistoryClientCallbacks(false)
{
#if PLATFORM(IOS)
@@ -369,6 +370,16 @@
};
WKContextSetInjectedBundleClient(m_context.get(), &injectedBundleClient.base);
+ WKContextHistoryClientV0 historyClient = {
+ { 0, this },
+ didNavigateWithNavigationData,
+ didPerformClientRedirect,
+ didPerformServerRedirect,
+ didUpdateHistoryTitle,
+ 0, // populateVisitedLinks
+ };
+ WKContextSetHistoryClient(m_context.get(), &historyClient.base);
+
WKNotificationManagerRef notificationManager = WKContextGetNotificationManager(m_context.get());
WKNotificationProviderV0 notificationKit = m_webNotificationProvider.provider();
WKNotificationManagerSetProvider(notificationManager, ¬ificationKit.base);
@@ -635,6 +646,8 @@
m_shouldBlockAllPlugins = false;
+ m_shouldLogHistoryClientCallbacks = false;
+
// Reset main page back to about:blank
m_doneResetting = false;
@@ -1293,4 +1306,86 @@
WKFramePolicyListenerIgnore(listener);
}
+void TestController::didNavigateWithNavigationData(WKContextRef, WKPageRef, WKNavigationDataRef navigationData, WKFrameRef frame, const void* clientInfo)
+{
+ static_cast<TestController*>(const_cast<void*>(clientInfo))->didNavigateWithNavigationData(navigationData, frame);
+}
+
+void TestController::didNavigateWithNavigationData(WKNavigationDataRef navigationData, WKFrameRef)
+{
+ if (m_state != RunningTest)
+ return;
+
+ if (!m_shouldLogHistoryClientCallbacks)
+ return;
+
+ // URL
+ WKRetainPtr<WKURLRef> urlWK = adoptWK(WKNavigationDataCopyURL(navigationData));
+ WKRetainPtr<WKStringRef> urlStringWK = adoptWK(WKURLCopyString(urlWK.get()));
+ // Title
+ WKRetainPtr<WKStringRef> titleWK = adoptWK(WKNavigationDataCopyTitle(navigationData));
+ // HTTP method
+ WKRetainPtr<WKURLRequestRef> requestWK = adoptWK(WKNavigationDataCopyOriginalRequest(navigationData));
+ WKRetainPtr<WKStringRef> methodWK = adoptWK(WKURLRequestCopyHTTPMethod(requestWK.get()));
+
+ // FIXME: Determine whether the navigation was successful / a client redirect rather than hard-coding the message here.
+ m_currentInvocation->outputText(String::format("WebView navigated to url \"%s\" with title \"%s\" with HTTP equivalent method \"%s\". The navigation was successful and was not a client redirect.\n",
+ toSTD(urlStringWK).c_str(), toSTD(titleWK).c_str(), toSTD(methodWK).c_str()));
+}
+
+void TestController::didPerformClientRedirect(WKContextRef, WKPageRef, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void* clientInfo)
+{
+ static_cast<TestController*>(const_cast<void*>(clientInfo))->didPerformClientRedirect(sourceURL, destinationURL, frame);
+}
+
+void TestController::didPerformClientRedirect(WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef)
+{
+ if (m_state != RunningTest)
+ return;
+
+ if (!m_shouldLogHistoryClientCallbacks)
+ return;
+
+ WKRetainPtr<WKStringRef> sourceStringWK = adoptWK(WKURLCopyString(sourceURL));
+ WKRetainPtr<WKStringRef> destinationStringWK = adoptWK(WKURLCopyString(destinationURL));
+
+ m_currentInvocation->outputText(String::format("WebView performed a client redirect from \"%s\" to \"%s\".\n", toSTD(sourceStringWK).c_str(), toSTD(destinationStringWK).c_str()));
+}
+
+void TestController::didPerformServerRedirect(WKContextRef, WKPageRef, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void* clientInfo)
+{
+ static_cast<TestController*>(const_cast<void*>(clientInfo))->didPerformServerRedirect(sourceURL, destinationURL, frame);
+}
+
+void TestController::didPerformServerRedirect(WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef)
+{
+ if (m_state != RunningTest)
+ return;
+
+ if (!m_shouldLogHistoryClientCallbacks)
+ return;
+
+ WKRetainPtr<WKStringRef> sourceStringWK = adoptWK(WKURLCopyString(sourceURL));
+ WKRetainPtr<WKStringRef> destinationStringWK = adoptWK(WKURLCopyString(destinationURL));
+
+ m_currentInvocation->outputText(String::format("WebView performed a server redirect from \"%s\" to \"%s\".\n", toSTD(sourceStringWK).c_str(), toSTD(destinationStringWK).c_str()));
+}
+
+void TestController::didUpdateHistoryTitle(WKContextRef, WKPageRef, WKStringRef title, WKURLRef URL, WKFrameRef frame, const void* clientInfo)
+{
+ static_cast<TestController*>(const_cast<void*>(clientInfo))->didUpdateHistoryTitle(title, URL, frame);
+}
+
+void TestController::didUpdateHistoryTitle(WKStringRef title, WKURLRef URL, WKFrameRef)
+{
+ if (m_state != RunningTest)
+ return;
+
+ if (!m_shouldLogHistoryClientCallbacks)
+ return;
+
+ WKRetainPtr<WKStringRef> urlStringWK(AdoptWK, WKURLCopyString(URL));
+ m_currentInvocation->outputText(String::format("WebView updated the title for history URL \"%s\" to \"%s\".\n", toSTD(urlStringWK).c_str(), toSTD(title).c_str()));
+}
+
} // namespace WTR
Modified: trunk/Tools/WebKitTestRunner/TestController.h (166395 => 166396)
--- trunk/Tools/WebKitTestRunner/TestController.h 2014-03-28 03:52:01 UTC (rev 166395)
+++ trunk/Tools/WebKitTestRunner/TestController.h 2014-03-28 04:06:58 UTC (rev 166396)
@@ -104,6 +104,8 @@
void setBlockAllPlugins(bool shouldBlock) { m_shouldBlockAllPlugins = shouldBlock; }
+ void setShouldLogHistoryClientCallbacks(bool shouldLog) { m_shouldLogHistoryClientCallbacks = shouldLog; }
+
private:
void initialize(int argc, const char* argv[]);
void createWebViewWithOptions(WKDictionaryRef);
@@ -159,6 +161,19 @@
static void decidePolicyForResponse(WKPageRef, WKFrameRef, WKURLResponseRef, WKURLRequestRef, bool canShowMIMEType, WKFramePolicyListenerRef, WKTypeRef, const void*);
void decidePolicyForResponse(WKFrameRef, WKURLResponseRef, WKFramePolicyListenerRef);
+ // WKContextHistoryClient
+ static void didNavigateWithNavigationData(WKContextRef, WKPageRef, WKNavigationDataRef, WKFrameRef, const void*);
+ void didNavigateWithNavigationData(WKNavigationDataRef, WKFrameRef);
+
+ static void didPerformClientRedirect(WKContextRef, WKPageRef, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef, const void*);
+ void didPerformClientRedirect(WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef);
+
+ static void didPerformServerRedirect(WKContextRef, WKPageRef, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef, const void*);
+ void didPerformServerRedirect(WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef);
+
+ static void didUpdateHistoryTitle(WKContextRef, WKPageRef, WKStringRef title, WKURLRef, WKFrameRef, const void*);
+ void didUpdateHistoryTitle(WKStringRef title, WKURLRef, WKFrameRef);
+
static WKPageRef createOtherPage(WKPageRef oldPage, WKURLRequestRef, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void*);
static void runModal(WKPageRef, const void* clientInfo);
@@ -223,6 +238,8 @@
bool m_shouldUseAcceleratedDrawing;
bool m_shouldUseRemoteLayerTree;
+ bool m_shouldLogHistoryClientCallbacks;
+
OwnPtr<EventSenderProxy> m_eventSenderProxy;
WorkQueueManager m_workQueueManager;
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (166395 => 166396)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2014-03-28 03:52:01 UTC (rev 166395)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2014-03-28 04:06:58 UTC (rev 166396)
@@ -146,6 +146,11 @@
}
#endif
+static bool shouldLogHistoryClientCallbacks(const char* pathOrURL)
+{
+ return strstr(pathOrURL, "globalhistory/");
+}
+
static void updateThreadedScrollingForCurrentTest(const char* pathOrURL)
{
#if PLATFORM(COCOA)
@@ -200,6 +205,8 @@
m_textOutput.clear();
+ TestController::shared().setShouldLogHistoryClientCallbacks(shouldLogHistoryClientCallbacks(m_pathOrURL.c_str()));
+
WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("BeginTest"));
WKRetainPtr<WKMutableDictionaryRef> beginTestMessageBody = adoptWK(WKMutableDictionaryCreate());