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

Unified Diff: net/http/http_auth_handler_unittest.cc

Issue 1391053002: [net/http auth] Make HttpAuthHandler challenge handling asynchronous. Base URL: https://chromium.googlesource.com/chromium/src.git@auth-handler-init-split
Patch Set: Created 5 years, 2 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_ntlm.cc ('k') | net/http/http_auth_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_auth_handler_unittest.cc
diff --git a/net/http/http_auth_handler_unittest.cc b/net/http/http_auth_handler_unittest.cc
index eb1efb350b44e4ac3dbf71b84b7dd4ce7ad88024..df1979a353f94202422bc1a1caf84cf6466561de 100644
--- a/net/http/http_auth_handler_unittest.cc
+++ b/net/http/http_auth_handler_unittest.cc
@@ -11,6 +11,7 @@
#include "net/http/http_auth_challenge_tokenizer.h"
#include "net/http/http_auth_handler_mock.h"
#include "net/http/http_request_info.h"
+#include "net/http/http_response_info.h"
#include "net/log/test_net_log.h"
#include "net/log/test_net_log_entry.h"
#include "net/log/test_net_log_util.h"
@@ -27,28 +28,33 @@ TEST(HttpAuthHandlerTest, NetLog) {
HttpRequestInfo request;
for (int i = 0; i < 2; ++i) {
- bool async = (i == 0);
+ bool generate_token_async = (i == 0);
for (int j = 0; j < 2; ++j) {
- int rv = (j == 0) ? OK : ERR_UNEXPECTED;
+ int generate_token_rv = (j == 0) ? OK : ERR_UNEXPECTED;
for (int k = 0; k < 2; ++k) {
TestCompletionCallback test_callback;
HttpAuth::Target target =
(k == 0) ? HttpAuth::AUTH_PROXY : HttpAuth::AUTH_SERVER;
NetLog::EventType event_type =
(k == 0) ? NetLog::TYPE_AUTH_PROXY : NetLog::TYPE_AUTH_SERVER;
- HttpAuthChallengeTokenizer tokenizer(
- challenge.begin(), challenge.end());
+ HttpAuthChallengeTokenizer tokenizer(challenge.begin(),
+ challenge.end());
HttpAuthHandlerMock mock_handler;
TestNetLog test_net_log;
BoundNetLog bound_net_log(
BoundNetLog::Make(&test_net_log, NetLog::SOURCE_NONE));
- mock_handler.HandleInitialChallenge(tokenizer, target, origin,
- bound_net_log);
- mock_handler.SetGenerateExpectation(async, rv);
+ HttpResponseInfo response_info;
+ int rv = mock_handler.HandleInitialChallenge(
+ tokenizer, response_info, target, origin, bound_net_log,
+ test_callback.callback());
+ // TODO(asanka): Test async init behavior
+ test_callback.GetResult(rv);
+ mock_handler.SetGenerateExpectation(generate_token_async,
+ generate_token_rv);
mock_handler.GenerateAuthToken(&credentials, request,
test_callback.callback(), &auth_token);
- if (async)
+ if (generate_token_async)
test_callback.WaitForResult();
TestNetLogEntry::List entries;
« no previous file with comments | « net/http/http_auth_handler_ntlm.cc ('k') | net/http/http_auth_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698