Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(538)

Unified Diff: net/http/http_auth_handler_mock.cc

Issue 3028021: Alternate-Protocol was failing when going through Digest authenticating proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Make unit test happy after merge. Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_auth_handler_mock.h ('k') | net/http/http_network_transaction.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « net/http/http_auth_handler_mock.h ('k') | net/http/http_network_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698