diff options
Diffstat (limited to 'net/http/http_auth_handler_mock.cc')
-rw-r--r-- | net/http/http_auth_handler_mock.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/net/http/http_auth_handler_mock.cc b/net/http/http_auth_handler_mock.cc index 983105b..9f0011d 100644 --- a/net/http/http_auth_handler_mock.cc +++ b/net/http/http_auth_handler_mock.cc @@ -6,6 +6,7 @@ #include "base/message_loop.h" #include "net/base/net_errors.h" +#include "net/http/http_request_info.h" #include "testing/gtest/include/gtest/gtest.h" namespace net { @@ -82,6 +83,7 @@ int HttpAuthHandlerMock::GenerateAuthTokenImpl(const string16* username, CompletionCallback* callback, std::string* auth_token) { first_round_ = false; + request_url_ = request->url; if (generate_async_) { EXPECT_TRUE(user_callback_ == NULL); EXPECT_TRUE(auth_token_ == NULL); @@ -118,6 +120,14 @@ void HttpAuthHandlerMock::OnGenerateAuthToken() { callback->Run(generate_rv_); } +HttpAuthHandlerMock::Factory::Factory() + : do_init_from_challenge_(false) { + // TODO(cbentzel): Default do_init_from_challenge_ to true. +} + +HttpAuthHandlerMock::Factory::~Factory() { +} + void HttpAuthHandlerMock::Factory::set_mock_handler( HttpAuthHandler* handler, HttpAuth::Target target) { EXPECT_TRUE(handlers_[target].get() == NULL); @@ -134,7 +144,11 @@ int HttpAuthHandlerMock::Factory::CreateAuthHandler( scoped_ptr<HttpAuthHandler>* handler) { if (!handlers_[target].get()) return ERR_UNEXPECTED; - handler->swap(handlers_[target]); + scoped_ptr<HttpAuthHandler> tmp_handler(handlers_[target].release()); + if (do_init_from_challenge_ && + !tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) + return ERR_INVALID_RESPONSE; + handler->swap(tmp_handler); return OK; } |