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

Unified Diff: net/http/http_network_transaction_unittest.cc

Issue 7477055: Change HttpAuthHandlerMock to accept and return more than one (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_network_transaction_unittest.cc
===================================================================
--- net/http/http_network_transaction_unittest.cc (revision 95261)
+++ net/http/http_network_transaction_unittest.cc (working copy)
@@ -7433,26 +7433,27 @@
};
SessionDependencies session_deps;
- HttpAuthHandlerMock::Factory* auth_factory(
- new HttpAuthHandlerMock::Factory());
- session_deps.http_auth_handler_factory.reset(auth_factory);
-
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_configs); ++i) {
+ HttpAuthHandlerMock::Factory* auth_factory(
+ new HttpAuthHandlerMock::Factory());
+ session_deps.http_auth_handler_factory.reset(auth_factory);
const TestConfig& test_config = test_configs[i];
// Set up authentication handlers as necessary.
if (test_config.proxy_auth_timing != AUTH_NONE) {
- HttpAuthHandlerMock* auth_handler(new HttpAuthHandlerMock());
- std::string auth_challenge = "Mock realm=proxy";
- GURL origin(test_config.proxy_url);
- HttpAuth::ChallengeTokenizer tokenizer(auth_challenge.begin(),
- auth_challenge.end());
- auth_handler->InitFromChallenge(&tokenizer, HttpAuth::AUTH_PROXY,
- origin, BoundNetLog());
- auth_handler->SetGenerateExpectation(
- test_config.proxy_auth_timing == AUTH_ASYNC,
- test_config.proxy_auth_rv);
- auth_factory->set_mock_handler(auth_handler, HttpAuth::AUTH_PROXY);
+ for (int n = 0; n < 2; n++) {
+ HttpAuthHandlerMock* auth_handler(new HttpAuthHandlerMock());
+ std::string auth_challenge = "Mock realm=proxy";
+ GURL origin(test_config.proxy_url);
+ HttpAuth::ChallengeTokenizer tokenizer(auth_challenge.begin(),
+ auth_challenge.end());
+ auth_handler->InitFromChallenge(&tokenizer, HttpAuth::AUTH_PROXY,
+ origin, BoundNetLog());
+ auth_handler->SetGenerateExpectation(
+ test_config.proxy_auth_timing == AUTH_ASYNC,
+ test_config.proxy_auth_rv);
+ auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_PROXY);
+ }
}
if (test_config.server_auth_timing != AUTH_NONE) {
HttpAuthHandlerMock* auth_handler(new HttpAuthHandlerMock());
@@ -7465,7 +7466,7 @@
auth_handler->SetGenerateExpectation(
test_config.server_auth_timing == AUTH_ASYNC,
test_config.server_auth_rv);
- auth_factory->set_mock_handler(auth_handler, HttpAuth::AUTH_SERVER);
+ auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_SERVER);
}
if (test_config.proxy_url) {
session_deps.proxy_service.reset(
@@ -7559,7 +7560,7 @@
auth_challenge.end());
auth_handler->InitFromChallenge(&tokenizer, HttpAuth::AUTH_SERVER,
origin, BoundNetLog());
- auth_factory->set_mock_handler(auth_handler, HttpAuth::AUTH_SERVER);
+ auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_SERVER);
int rv = OK;
const HttpResponseInfo* response = NULL;
@@ -7953,7 +7954,7 @@
HttpAuthHandlerMock::Factory* auth_factory =
new HttpAuthHandlerMock::Factory();
HttpAuthHandlerMock* auth_handler = new HttpAuthHandlerMock();
- auth_factory->set_mock_handler(auth_handler, HttpAuth::AUTH_PROXY);
+ auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_PROXY);
auth_factory->set_do_init_from_challenge(true);
session_deps.http_auth_handler_factory.reset(auth_factory);
« no previous file with comments | « net/http/http_auth_handler_mock.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698