From 231d4e3152a9c27a73b6ac7badbe6be673aa3ddf Mon Sep 17 00:00:00 2001 From: Steve Block Date: Thu, 8 Oct 2009 17:19:54 +0100 Subject: Merge webkit.org at R49305 : Automatic merge by git. Change-Id: I8968561bc1bfd72b8923b7118d3728579c6dbcc7 --- .../DumpRenderTree/win/ResourceLoadDelegate.cpp | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp') diff --git a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp index 06476e7..0edf69b 100644 --- a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp +++ b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp @@ -31,10 +31,13 @@ #include "DumpRenderTree.h" #include "LayoutTestController.h" +#include +#include #include #include #include + using std::wstring; using std::wiostream; @@ -251,6 +254,33 @@ HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::willSendRequest( return S_OK; } +HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::didReceiveAuthenticationChallenge( + /* [in] */ IWebView *webView, + /* [in] */ unsigned long identifier, + /* [in] */ IWebURLAuthenticationChallenge *challenge, + /* [in] */ IWebDataSource *dataSource) +{ + if (!gLayoutTestController->handlesAuthenticationChallenges()) + return E_FAIL; + + const char* user = gLayoutTestController->authenticationUsername().c_str(); + const char* password = gLayoutTestController->authenticationPassword().c_str(); + + printf("%S - didReceiveAuthenticationChallenge - Responding with %s:%s\n", descriptionSuitableForTestResult(identifier).c_str(), user, password); + + COMPtr sender; + if (!challenge || FAILED(challenge->sender(&sender))) + return E_FAIL; + + COMPtr credential; + if (FAILED(WebKitCreateInstance(CLSID_WebURLCredential, 0, IID_IWebURLCredential, (void**)&credential))) + return E_FAIL; + credential->initWithUser(_bstr_t(user), _bstr_t(password), WebURLCredentialPersistenceForSession); + + sender->useCredential(credential.get(), challenge); + return S_OK; +} + HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::didReceiveResponse( /* [in] */ IWebView* webView, /* [in] */ unsigned long identifier, -- cgit v1.1