| Index: net/http/http_auth_handler_mock.cc
|
| diff --git a/net/http/http_auth_handler_mock.cc b/net/http/http_auth_handler_mock.cc
|
| index 983105bae66eeb80e5d7ead56d47b0dbc3293ccf..9f0011d5c2e31de1a9485873e25c8e3871789d70 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;
|
| }
|
|
|
|
|