Changeset 139140 in webkit
- Timestamp:
- Jan 8, 2013 5:41:17 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r139137 r139140 1 2013-01-08 Martin Robinson <mrobinson@igalia.com> 2 3 WebKitTestRunner needs support for setHandlesAuthenticationChallenges 4 https://bugs.webkit.org/show_bug.cgi?id=103653 5 6 Reviewed by Anders Carlsson. 7 8 Unskip authentication tests which are now passing. 9 10 * platform/wk2/TestExpectations: 11 1 12 2013-01-08 Justin Novosad <junov@google.com> 2 13 -
trunk/LayoutTests/platform/wk2/TestExpectations
r139118 r139140 388 388 # WebKitTestRunner should dump text/plain content as text 389 389 http/tests/incremental/slow-utf8-text.pl 390 391 # WebKitTestRunner needs layoutTestController.setHandlesAuthenticationChallenges392 http/tests/misc/authentication-redirect-1/authentication-sent-to-redirect-cross-origin.html393 http/tests/misc/authentication-redirect-2/authentication-sent-to-redirect-same-origin.html394 http/tests/misc/authentication-redirect-3/authentication-sent-to-redirect-same-origin-with-location-credentials.html395 http/tests/misc/authentication-redirect-4/authentication-sent-to-redirect-same-origin-url.html396 http/tests/loading/authentication-after-redirect-stores-wrong-credentials/authentication-after-redirect-stores-wrong-credentials.html397 http/tests/loading/basic-auth-resend-wrong-credentials.html398 http/tests/loading/basic-credentials-sent-automatically.html399 http/tests/security/401-logout/401-logout.php400 http/tests/xmlhttprequest/basic-auth-nopassword.html401 http/tests/xmlhttprequest/basic-auth-nouser.html402 http/tests/xmlhttprequest/remember-bad-password.html403 http/tests/xmlhttprequest/failed-auth.html404 http/tests/misc/401-alternative-content.php405 390 406 391 # WebKitTestRunner needs layoutTestController.setSmartInsertDeleteEnabled -
trunk/Tools/ChangeLog
r139129 r139140 1 2013-01-08 Martin Robinson <mrobinson@igalia.com> 2 3 WebKitTestRunner needs support for setHandlesAuthenticationChallenges 4 https://bugs.webkit.org/show_bug.cgi?id=103653 5 6 Reviewed by Anders Carlsson. 7 8 Implement setHandlesAuthenticationChallenges in the UIProcess by sending credentials 9 and the enabled boolean to the UIProcess and then implementing the didReceiveAuthenticationChallengeInFrame 10 client callback. 11 12 * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: Exposed the new TestRunner 13 methods to the JavaScript API. 14 * WebKitTestRunner/InjectedBundle/TestRunner.cpp: 15 (WTR::TestRunner::setHandlesAuthenticationChallenges): Added this callback for the JavaScript API. 16 (WTR::TestRunner::setAuthenticationUsername): Ditto. 17 (WTR::TestRunner::setAuthenticationPassword): Ditto. 18 * WebKitTestRunner/InjectedBundle/TestRunner.h: 19 (TestRunner): Added new declarations for the above. 20 * WebKitTestRunner/TestController.cpp: 21 (WTR::TestController::createWebViewWithOptions): Hook up the new didReceiveSynchronousMessageFromInjectedBundle 22 callback. 23 (WTR::TestController::resetStateToConsistentValues): Reset the credentials and enabled boolean between tests. 24 (WTR::TestController::didReceiveAuthenticationChallengeInFrame): Handle the callback by using 25 the authentication information passed from the InjectedBundle. 26 * WebKitTestRunner/TestController.h: 27 (WTR::TestController::setHandlesAuthenticationChallenges): Added setter to allow TestInvocation 28 to communicate with the TestController. 29 (WTR::TestController::setAuthenticationUsername): Ditto. 30 (WTR::TestController::setAuthenticationPassword): Ditto. 31 (TestController): 32 * WebKitTestRunner/TestInvocation.cpp: 33 (WTR::TestInvocation::didReceiveMessageFromInjectedBundle): Handle the messages sending authentication 34 information from the InjectedBundle. 35 (WTR::TestInvocation::outputText): Added this method so that the TestController can output 36 text to the TestInvocation text output. 37 * WebKitTestRunner/TestInvocation.h: 38 (TestInvocation): Added declaration for new method. 39 1 40 2013-01-08 Benjamin Poulain <benjamin@webkit.org> 2 41 -
trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
r138232 r139140 196 196 void queueLoadingScript(in DOMString script); 197 197 void queueNonLoadingScript(in DOMString script); 198 199 // Authentication 200 void setHandlesAuthenticationChallenges(in boolean value); 201 void setAuthenticationUsername(in DOMString username); 202 void setAuthenticationPassword(in DOMString password); 198 203 }; 199 204 -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
r138232 r139140 34 34 #include "TestController.h" 35 35 #include <WebCore/PageVisibilityState.h> 36 #include <WebKit2/WKBundle.h> 36 37 #include <WebKit2/WKBundleBackForwardList.h> 37 38 #include <WebKit2/WKBundleFrame.h> … … 897 898 } 898 899 900 void TestRunner::setHandlesAuthenticationChallenges(bool handlesAuthenticationChallenges) 901 { 902 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetHandlesAuthenticationChallenge")); 903 WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(handlesAuthenticationChallenges)); 904 WKBundlePostMessage(InjectedBundle::shared().bundle(), messageName.get(), messageBody.get()); 905 } 906 907 void TestRunner::setAuthenticationUsername(JSStringRef username) 908 { 909 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetAuthenticationUsername")); 910 WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithJSString(username)); 911 WKBundlePostMessage(InjectedBundle::shared().bundle(), messageName.get(), messageBody.get()); 912 } 913 914 void TestRunner::setAuthenticationPassword(JSStringRef password) 915 { 916 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetAuthenticationPassword")); 917 WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithJSString(password)); 918 WKBundlePostMessage(InjectedBundle::shared().bundle(), messageName.get(), messageBody.get()); 919 } 920 899 921 } // namespace WTR -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
r138326 r139140 163 163 bool isPageBoxVisible(int pageIndex); 164 164 165 // Authentication 166 void setHandlesAuthenticationChallenges(bool); 167 void setAuthenticationUsername(JSStringRef); 168 void setAuthenticationPassword(JSStringRef); 169 165 170 void setValueForUser(JSContextRef, JSValueRef element, JSStringRef value); 166 171 -
trunk/Tools/WebKitTestRunner/TestController.cpp
r138608 r139140 30 30 #include "StringFunctions.h" 31 31 #include "TestInvocation.h" 32 #include <WebKit2/WKAuthenticationChallenge.h> 33 #include <WebKit2/WKAuthenticationDecisionListener.h> 32 34 #include <WebKit2/WKContextPrivate.h> 35 #include <WebKit2/WKCredential.h> 33 36 #include <WebKit2/WKNotification.h> 34 37 #include <WebKit2/WKNotificationManager.h> … … 45 48 #include <string> 46 49 #include <wtf/PassOwnPtr.h> 50 #include <wtf/text/CString.h> 47 51 48 52 #if PLATFORM(MAC) … … 437 441 0, // didDisplayInsecureContentForFrame 438 442 0, // canAuthenticateAgainstProtectionSpaceInFrame 439 0, // didReceiveAuthenticationChallengeInFrame443 didReceiveAuthenticationChallengeInFrame, // didReceiveAuthenticationChallengeInFrame 440 444 0, // didStartProgress 441 445 0, // didChangeProgress … … 585 589 m_workQueueManager.clearWorkQueue(); 586 590 591 m_handlesAuthenticationChallenges = false; 592 m_authenticationUsername = String(); 593 m_authenticationPassword = String(); 594 587 595 // Reset main page back to about:blank 588 596 m_doneResetting = false; … … 1003 1011 } 1004 1012 1013 void TestController::didReceiveAuthenticationChallengeInFrame(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo) 1014 { 1015 static_cast<TestController*>(const_cast<void*>(clientInfo))->didReceiveAuthenticationChallengeInFrame(page, frame, authenticationChallenge); 1016 } 1017 1005 1018 void TestController::processDidCrash(WKPageRef page, const void* clientInfo) 1006 1019 { … … 1030 1043 m_doneResetting = true; 1031 1044 shared().notifyDone(); 1045 } 1046 1047 void TestController::didReceiveAuthenticationChallengeInFrame(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge) 1048 { 1049 String message; 1050 if (!m_handlesAuthenticationChallenges) 1051 message = "<unknown> - didReceiveAuthenticationChallenge - Simulating cancelled authentication sheet\n"; 1052 else 1053 message = String::format("<unknown> - didReceiveAuthenticationChallenge - Responding with %s:%s\n", m_authenticationUsername.utf8().data(), m_authenticationPassword.utf8().data()); 1054 m_currentInvocation->outputText(message); 1055 1056 WKAuthenticationDecisionListenerRef decisionListener = WKAuthenticationChallengeGetDecisionListener(authenticationChallenge); 1057 if (!m_handlesAuthenticationChallenges) { 1058 WKAuthenticationDecisionListenerUseCredential(decisionListener, 0); 1059 return; 1060 } 1061 WKRetainPtr<WKStringRef> username(AdoptWK, WKStringCreateWithUTF8CString(m_authenticationUsername.utf8().data())); 1062 WKRetainPtr<WKStringRef> password(AdoptWK, WKStringCreateWithUTF8CString(m_authenticationPassword.utf8().data())); 1063 WKRetainPtr<WKCredentialRef> credential(AdoptWK, WKCredentialCreate(username.get(), password.get(), kWKCredentialPersistenceForSession)); 1064 WKAuthenticationDecisionListenerUseCredential(decisionListener, credential.get()); 1032 1065 } 1033 1066 -
trunk/Tools/WebKitTestRunner/TestController.h
r138608 r139140 84 84 WorkQueueManager& workQueueManager() { return m_workQueueManager; } 85 85 86 void setHandlesAuthenticationChallenges(bool value) { m_handlesAuthenticationChallenges = value; } 87 void setAuthenticationUsername(String username) { m_authenticationUsername = username; } 88 void setAuthenticationPassword(String password) { m_authenticationPassword = password; } 89 86 90 private: 87 91 void initialize(int argc, const char* argv[]); … … 122 126 123 127 static void unavailablePluginButtonClicked(WKPageRef, WKPluginUnavailabilityReason, WKStringRef, WKStringRef, WKStringRef, const void*); 128 129 static void didReceiveAuthenticationChallengeInFrame(WKPageRef, WKFrameRef, WKAuthenticationChallengeRef, const void *clientInfo); 130 void didReceiveAuthenticationChallengeInFrame(WKPageRef, WKFrameRef, WKAuthenticationChallengeRef); 124 131 125 132 // WKPagePolicyClient … … 182 189 bool m_policyDelegatePermissive; 183 190 191 bool m_handlesAuthenticationChallenges; 192 String m_authenticationUsername; 193 String m_authenticationPassword; 194 184 195 #if PLATFORM(MAC) || PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL) 185 196 OwnPtr<EventSenderProxy> m_eventSenderProxy; -
trunk/Tools/WebKitTestRunner/TestInvocation.cpp
r138368 r139140 591 591 } 592 592 593 if (WKStringIsEqualToUTF8CString(messageName, "SetHandlesAuthenticationChallenge")) { 594 ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID()); 595 WKBooleanRef value = static_cast<WKBooleanRef>(messageBody); 596 TestController::shared().setHandlesAuthenticationChallenges(WKBooleanGetValue(value)); 597 return; 598 } 599 600 if (WKStringIsEqualToUTF8CString(messageName, "SetAuthenticationUsername")) { 601 ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID()); 602 WKStringRef username = static_cast<WKStringRef>(messageBody); 603 TestController::shared().setAuthenticationUsername(toWTFString(username)); 604 return; 605 } 606 607 if (WKStringIsEqualToUTF8CString(messageName, "SetAuthenticationPassword")) { 608 ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID()); 609 WKStringRef password = static_cast<WKStringRef>(messageBody); 610 TestController::shared().setAuthenticationPassword(toWTFString(password)); 611 return; 612 } 613 593 614 ASSERT_NOT_REACHED(); 594 615 } … … 613 634 } 614 635 636 void TestInvocation::outputText(const WTF::String& text) 637 { 638 m_textOutput.append(text); 639 } 640 615 641 } // namespace WTR -
trunk/Tools/WebKitTestRunner/TestInvocation.h
r138232 r139140 48 48 49 49 void dumpWebProcessUnresponsiveness(); 50 void outputText(const WTF::String&); 50 51 private: 51 52 void dumpResults();
Note: See TracChangeset
for help on using the changeset viewer.