Diff
Modified: trunk/LayoutTests/ChangeLog (139139 => 139140)
--- trunk/LayoutTests/ChangeLog 2013-01-09 01:41:13 UTC (rev 139139)
+++ trunk/LayoutTests/ChangeLog 2013-01-09 01:41:17 UTC (rev 139140)
@@ -1,3 +1,14 @@
+2013-01-08 Martin Robinson <[email protected]>
+
+ WebKitTestRunner needs support for setHandlesAuthenticationChallenges
+ https://bugs.webkit.org/show_bug.cgi?id=103653
+
+ Reviewed by Anders Carlsson.
+
+ Unskip authentication tests which are now passing.
+
+ * platform/wk2/TestExpectations:
+
2013-01-08 Justin Novosad <[email protected]>
Color bleeding with rounded rectangles on high dpi displays
Modified: trunk/LayoutTests/platform/wk2/TestExpectations (139139 => 139140)
--- trunk/LayoutTests/platform/wk2/TestExpectations 2013-01-09 01:41:13 UTC (rev 139139)
+++ trunk/LayoutTests/platform/wk2/TestExpectations 2013-01-09 01:41:17 UTC (rev 139140)
@@ -388,21 +388,6 @@
# WebKitTestRunner should dump text/plain content as text
http/tests/incremental/slow-utf8-text.pl
-# WebKitTestRunner needs layoutTestController.setHandlesAuthenticationChallenges
-http/tests/misc/authentication-redirect-1/authentication-sent-to-redirect-cross-origin.html
-http/tests/misc/authentication-redirect-2/authentication-sent-to-redirect-same-origin.html
-http/tests/misc/authentication-redirect-3/authentication-sent-to-redirect-same-origin-with-location-credentials.html
-http/tests/misc/authentication-redirect-4/authentication-sent-to-redirect-same-origin-url.html
-http/tests/loading/authentication-after-redirect-stores-wrong-credentials/authentication-after-redirect-stores-wrong-credentials.html
-http/tests/loading/basic-auth-resend-wrong-credentials.html
-http/tests/loading/basic-credentials-sent-automatically.html
-http/tests/security/401-logout/401-logout.php
-http/tests/xmlhttprequest/basic-auth-nopassword.html
-http/tests/xmlhttprequest/basic-auth-nouser.html
-http/tests/xmlhttprequest/remember-bad-password.html
-http/tests/xmlhttprequest/failed-auth.html
-http/tests/misc/401-alternative-content.php
-
# WebKitTestRunner needs layoutTestController.setSmartInsertDeleteEnabled
editing/deleting/smart-editing-disabled.html
Modified: trunk/Tools/ChangeLog (139139 => 139140)
--- trunk/Tools/ChangeLog 2013-01-09 01:41:13 UTC (rev 139139)
+++ trunk/Tools/ChangeLog 2013-01-09 01:41:17 UTC (rev 139140)
@@ -1,3 +1,42 @@
+2013-01-08 Martin Robinson <[email protected]>
+
+ WebKitTestRunner needs support for setHandlesAuthenticationChallenges
+ https://bugs.webkit.org/show_bug.cgi?id=103653
+
+ Reviewed by Anders Carlsson.
+
+ Implement setHandlesAuthenticationChallenges in the UIProcess by sending credentials
+ and the enabled boolean to the UIProcess and then implementing the didReceiveAuthenticationChallengeInFrame
+ client callback.
+
+ * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: Exposed the new TestRunner
+ methods to the _javascript_ API.
+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+ (WTR::TestRunner::setHandlesAuthenticationChallenges): Added this callback for the _javascript_ API.
+ (WTR::TestRunner::setAuthenticationUsername): Ditto.
+ (WTR::TestRunner::setAuthenticationPassword): Ditto.
+ * WebKitTestRunner/InjectedBundle/TestRunner.h:
+ (TestRunner): Added new declarations for the above.
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::createWebViewWithOptions): Hook up the new didReceiveSynchronousMessageFromInjectedBundle
+ callback.
+ (WTR::TestController::resetStateToConsistentValues): Reset the credentials and enabled boolean between tests.
+ (WTR::TestController::didReceiveAuthenticationChallengeInFrame): Handle the callback by using
+ the authentication information passed from the InjectedBundle.
+ * WebKitTestRunner/TestController.h:
+ (WTR::TestController::setHandlesAuthenticationChallenges): Added setter to allow TestInvocation
+ to communicate with the TestController.
+ (WTR::TestController::setAuthenticationUsername): Ditto.
+ (WTR::TestController::setAuthenticationPassword): Ditto.
+ (TestController):
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::didReceiveMessageFromInjectedBundle): Handle the messages sending authentication
+ information from the InjectedBundle.
+ (WTR::TestInvocation::outputText): Added this method so that the TestController can output
+ text to the TestInvocation text output.
+ * WebKitTestRunner/TestInvocation.h:
+ (TestInvocation): Added declaration for new method.
+
2013-01-08 Benjamin Poulain <[email protected]>
Add myself as a watcher for Web Geolocation
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (139139 => 139140)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2013-01-09 01:41:13 UTC (rev 139139)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2013-01-09 01:41:17 UTC (rev 139140)
@@ -195,5 +195,10 @@
void queueReload();
void queueLoadingScript(in DOMString script);
void queueNonLoadingScript(in DOMString script);
+
+ // Authentication
+ void setHandlesAuthenticationChallenges(in boolean value);
+ void setAuthenticationUsername(in DOMString username);
+ void setAuthenticationPassword(in DOMString password);
};
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (139139 => 139140)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2013-01-09 01:41:13 UTC (rev 139139)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2013-01-09 01:41:17 UTC (rev 139140)
@@ -33,6 +33,7 @@
#include "StringFunctions.h"
#include "TestController.h"
#include <WebCore/PageVisibilityState.h>
+#include <WebKit2/WKBundle.h>
#include <WebKit2/WKBundleBackForwardList.h>
#include <WebKit2/WKBundleFrame.h>
#include <WebKit2/WKBundleFramePrivate.h>
@@ -896,4 +897,25 @@
WKBundlePageSetViewMode(InjectedBundle::shared().page()->page(), modeWK.get());
}
+void TestRunner::setHandlesAuthenticationChallenges(bool handlesAuthenticationChallenges)
+{
+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetHandlesAuthenticationChallenge"));
+ WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(handlesAuthenticationChallenges));
+ WKBundlePostMessage(InjectedBundle::shared().bundle(), messageName.get(), messageBody.get());
+}
+
+void TestRunner::setAuthenticationUsername(JSStringRef username)
+{
+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetAuthenticationUsername"));
+ WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithJSString(username));
+ WKBundlePostMessage(InjectedBundle::shared().bundle(), messageName.get(), messageBody.get());
+}
+
+void TestRunner::setAuthenticationPassword(JSStringRef password)
+{
+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetAuthenticationPassword"));
+ WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithJSString(password));
+ WKBundlePostMessage(InjectedBundle::shared().bundle(), messageName.get(), messageBody.get());
+}
+
} // namespace WTR
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (139139 => 139140)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2013-01-09 01:41:13 UTC (rev 139139)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2013-01-09 01:41:17 UTC (rev 139140)
@@ -162,6 +162,11 @@
// Printing
bool isPageBoxVisible(int pageIndex);
+ // Authentication
+ void setHandlesAuthenticationChallenges(bool);
+ void setAuthenticationUsername(JSStringRef);
+ void setAuthenticationPassword(JSStringRef);
+
void setValueForUser(JSContextRef, JSValueRef element, JSStringRef value);
// Audio testing.
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (139139 => 139140)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2013-01-09 01:41:13 UTC (rev 139139)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2013-01-09 01:41:17 UTC (rev 139140)
@@ -29,7 +29,10 @@
#include "PlatformWebView.h"
#include "StringFunctions.h"
#include "TestInvocation.h"
+#include <WebKit2/WKAuthenticationChallenge.h>
+#include <WebKit2/WKAuthenticationDecisionListener.h>
#include <WebKit2/WKContextPrivate.h>
+#include <WebKit2/WKCredential.h>
#include <WebKit2/WKNotification.h>
#include <WebKit2/WKNotificationManager.h>
#include <WebKit2/WKNotificationPermissionRequest.h>
@@ -44,6 +47,7 @@
#include <stdlib.h>
#include <string>
#include <wtf/PassOwnPtr.h>
+#include <wtf/text/CString.h>
#if PLATFORM(MAC)
#include <WebKit2/WKPagePrivateMac.h>
@@ -436,7 +440,7 @@
0, // didFailToInitializePlugin
0, // didDisplayInsecureContentForFrame
0, // canAuthenticateAgainstProtectionSpaceInFrame
- 0, // didReceiveAuthenticationChallengeInFrame
+ didReceiveAuthenticationChallengeInFrame, // didReceiveAuthenticationChallengeInFrame
0, // didStartProgress
0, // didChangeProgress
0, // didFinishProgress
@@ -584,6 +588,10 @@
m_workQueueManager.clearWorkQueue();
+ m_handlesAuthenticationChallenges = false;
+ m_authenticationUsername = String();
+ m_authenticationPassword = String();
+
// Reset main page back to about:blank
m_doneResetting = false;
@@ -1002,6 +1010,11 @@
static_cast<TestController*>(const_cast<void*>(clientInfo))->didFinishLoadForFrame(page, frame);
}
+void TestController::didReceiveAuthenticationChallengeInFrame(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo)
+{
+ static_cast<TestController*>(const_cast<void*>(clientInfo))->didReceiveAuthenticationChallengeInFrame(page, frame, authenticationChallenge);
+}
+
void TestController::processDidCrash(WKPageRef page, const void* clientInfo)
{
static_cast<TestController*>(const_cast<void*>(clientInfo))->processDidCrash();
@@ -1031,6 +1044,26 @@
shared().notifyDone();
}
+void TestController::didReceiveAuthenticationChallengeInFrame(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge)
+{
+ String message;
+ if (!m_handlesAuthenticationChallenges)
+ message = "<unknown> - didReceiveAuthenticationChallenge - Simulating cancelled authentication sheet\n";
+ else
+ message = String::format("<unknown> - didReceiveAuthenticationChallenge - Responding with %s:%s\n", m_authenticationUsername.utf8().data(), m_authenticationPassword.utf8().data());
+ m_currentInvocation->outputText(message);
+
+ WKAuthenticationDecisionListenerRef decisionListener = WKAuthenticationChallengeGetDecisionListener(authenticationChallenge);
+ if (!m_handlesAuthenticationChallenges) {
+ WKAuthenticationDecisionListenerUseCredential(decisionListener, 0);
+ return;
+ }
+ WKRetainPtr<WKStringRef> username(AdoptWK, WKStringCreateWithUTF8CString(m_authenticationUsername.utf8().data()));
+ WKRetainPtr<WKStringRef> password(AdoptWK, WKStringCreateWithUTF8CString(m_authenticationPassword.utf8().data()));
+ WKRetainPtr<WKCredentialRef> credential(AdoptWK, WKCredentialCreate(username.get(), password.get(), kWKCredentialPersistenceForSession));
+ WKAuthenticationDecisionListenerUseCredential(decisionListener, credential.get());
+}
+
void TestController::processDidCrash()
{
// This function can be called multiple times when crash logs are being saved on Windows, so
Modified: trunk/Tools/WebKitTestRunner/TestController.h (139139 => 139140)
--- trunk/Tools/WebKitTestRunner/TestController.h 2013-01-09 01:41:13 UTC (rev 139139)
+++ trunk/Tools/WebKitTestRunner/TestController.h 2013-01-09 01:41:17 UTC (rev 139140)
@@ -83,6 +83,10 @@
WorkQueueManager& workQueueManager() { return m_workQueueManager; }
+ void setHandlesAuthenticationChallenges(bool value) { m_handlesAuthenticationChallenges = value; }
+ void setAuthenticationUsername(String username) { m_authenticationUsername = username; }
+ void setAuthenticationPassword(String password) { m_authenticationPassword = password; }
+
private:
void initialize(int argc, const char* argv[]);
void createWebViewWithOptions(WKDictionaryRef);
@@ -122,6 +126,9 @@
static void unavailablePluginButtonClicked(WKPageRef, WKPluginUnavailabilityReason, WKStringRef, WKStringRef, WKStringRef, const void*);
+ static void didReceiveAuthenticationChallengeInFrame(WKPageRef, WKFrameRef, WKAuthenticationChallengeRef, const void *clientInfo);
+ void didReceiveAuthenticationChallengeInFrame(WKPageRef, WKFrameRef, WKAuthenticationChallengeRef);
+
// WKPagePolicyClient
static void decidePolicyForNavigationAction(WKPageRef, WKFrameRef, WKFrameNavigationType, WKEventModifiers, WKEventMouseButton, WKURLRequestRef, WKFramePolicyListenerRef, WKTypeRef, const void*);
void decidePolicyForNavigationAction(WKFramePolicyListenerRef);
@@ -181,6 +188,10 @@
bool m_policyDelegateEnabled;
bool m_policyDelegatePermissive;
+ bool m_handlesAuthenticationChallenges;
+ String m_authenticationUsername;
+ String m_authenticationPassword;
+
#if PLATFORM(MAC) || PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL)
OwnPtr<EventSenderProxy> m_eventSenderProxy;
#endif
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (139139 => 139140)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2013-01-09 01:41:13 UTC (rev 139139)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2013-01-09 01:41:17 UTC (rev 139140)
@@ -590,6 +590,27 @@
return;
}
+ if (WKStringIsEqualToUTF8CString(messageName, "SetHandlesAuthenticationChallenge")) {
+ ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
+ WKBooleanRef value = static_cast<WKBooleanRef>(messageBody);
+ TestController::shared().setHandlesAuthenticationChallenges(WKBooleanGetValue(value));
+ return;
+ }
+
+ if (WKStringIsEqualToUTF8CString(messageName, "SetAuthenticationUsername")) {
+ ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID());
+ WKStringRef username = static_cast<WKStringRef>(messageBody);
+ TestController::shared().setAuthenticationUsername(toWTFString(username));
+ return;
+ }
+
+ if (WKStringIsEqualToUTF8CString(messageName, "SetAuthenticationPassword")) {
+ ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID());
+ WKStringRef password = static_cast<WKStringRef>(messageBody);
+ TestController::shared().setAuthenticationPassword(toWTFString(password));
+ return;
+ }
+
ASSERT_NOT_REACHED();
}
@@ -612,4 +633,9 @@
return 0;
}
+void TestInvocation::outputText(const WTF::String& text)
+{
+ m_textOutput.append(text);
+}
+
} // namespace WTR
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.h (139139 => 139140)
--- trunk/Tools/WebKitTestRunner/TestInvocation.h 2013-01-09 01:41:13 UTC (rev 139139)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.h 2013-01-09 01:41:17 UTC (rev 139140)
@@ -47,6 +47,7 @@
WKRetainPtr<WKTypeRef> didReceiveSynchronousMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody);
void dumpWebProcessUnresponsiveness();
+ void outputText(const WTF::String&);
private:
void dumpResults();
static void dump(const char* textToStdout, const char* textToStderr = 0, bool seenError = false);