OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/http/http_auth_handler.h" | 5 #include "net/http/http_auth_handler.h" |
6 | 6 |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
10 #include "net/base/test_completion_callback.h" | 10 #include "net/base/test_completion_callback.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 for (int k = 0; k < 2; ++k) { | 36 for (int k = 0; k < 2; ++k) { |
37 TestCompletionCallback test_callback; | 37 TestCompletionCallback test_callback; |
38 HttpAuth::Target target = | 38 HttpAuth::Target target = |
39 (k == 0) ? HttpAuth::AUTH_PROXY : HttpAuth::AUTH_SERVER; | 39 (k == 0) ? HttpAuth::AUTH_PROXY : HttpAuth::AUTH_SERVER; |
40 NetLogEventType event_type = (k == 0) ? NetLogEventType::AUTH_PROXY | 40 NetLogEventType event_type = (k == 0) ? NetLogEventType::AUTH_PROXY |
41 : NetLogEventType::AUTH_SERVER; | 41 : NetLogEventType::AUTH_SERVER; |
42 HttpAuthChallengeTokenizer tokenizer( | 42 HttpAuthChallengeTokenizer tokenizer( |
43 challenge.begin(), challenge.end()); | 43 challenge.begin(), challenge.end()); |
44 HttpAuthHandlerMock mock_handler; | 44 HttpAuthHandlerMock mock_handler; |
45 TestNetLog test_net_log; | 45 TestNetLog test_net_log; |
46 BoundNetLog bound_net_log( | 46 NetLogWithSource net_log( |
47 BoundNetLog::Make(&test_net_log, NetLogSourceType::NONE)); | 47 NetLogWithSource::Make(&test_net_log, NetLogSourceType::NONE)); |
48 | 48 |
49 SSLInfo empty_ssl_info; | 49 SSLInfo empty_ssl_info; |
50 mock_handler.InitFromChallenge(&tokenizer, target, empty_ssl_info, | 50 mock_handler.InitFromChallenge(&tokenizer, target, empty_ssl_info, |
51 origin, bound_net_log); | 51 origin, net_log); |
52 mock_handler.SetGenerateExpectation(async, rv); | 52 mock_handler.SetGenerateExpectation(async, rv); |
53 mock_handler.GenerateAuthToken(&credentials, &request, | 53 mock_handler.GenerateAuthToken(&credentials, &request, |
54 test_callback.callback(), &auth_token); | 54 test_callback.callback(), &auth_token); |
55 if (async) | 55 if (async) |
56 test_callback.WaitForResult(); | 56 test_callback.WaitForResult(); |
57 | 57 |
58 TestNetLogEntry::List entries; | 58 TestNetLogEntry::List entries; |
59 test_net_log.GetEntries(&entries); | 59 test_net_log.GetEntries(&entries); |
60 | 60 |
61 EXPECT_EQ(2u, entries.size()); | 61 EXPECT_EQ(2u, entries.size()); |
62 EXPECT_TRUE(LogContainsBeginEvent(entries, 0, event_type)); | 62 EXPECT_TRUE(LogContainsBeginEvent(entries, 0, event_type)); |
63 EXPECT_TRUE(LogContainsEndEvent(entries, 1, event_type)); | 63 EXPECT_TRUE(LogContainsEndEvent(entries, 1, event_type)); |
64 } | 64 } |
65 } | 65 } |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 } // namespace net | 69 } // namespace net |
OLD | NEW |