OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/string_util.h" |
7 #include "net/base/capturing_net_log.h" | 8 #include "net/base/capturing_net_log.h" |
8 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
9 #include "net/base/net_log_unittest.h" | 10 #include "net/base/net_log_unittest.h" |
10 #include "net/base/test_completion_callback.h" | 11 #include "net/base/test_completion_callback.h" |
11 #include "net/http/http_auth_handler_mock.h" | 12 #include "net/http/http_auth_handler_mock.h" |
12 #include "net/http/http_request_info.h" | 13 #include "net/http/http_request_info.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
14 | 15 |
15 namespace net { | 16 namespace net { |
16 | 17 |
17 TEST(HttpAuthHandlerTest, NetLog) { | 18 TEST(HttpAuthHandlerTest, NetLog) { |
18 NetLog::Source source; | 19 NetLog::Source source; |
19 GURL origin("http://www.example.com"); | 20 GURL origin("http://www.example.com"); |
20 std::string challenge = "Mock asdf"; | 21 std::string challenge = "Mock asdf"; |
21 std::wstring username = L"user"; | 22 string16 username = ASCIIToUTF16("user"); |
22 std::wstring password = L"pass"; | 23 string16 password = ASCIIToUTF16("pass"); |
23 std::string auth_token; | 24 std::string auth_token; |
24 HttpRequestInfo request; | 25 HttpRequestInfo request; |
25 | 26 |
26 for (int i = 0; i < 2; ++i) { | 27 for (int i = 0; i < 2; ++i) { |
27 bool async = (i == 0); | 28 bool async = (i == 0); |
28 for (int j = 0; j < 2; ++j) { | 29 for (int j = 0; j < 2; ++j) { |
29 int rv = (j == 0) ? OK : ERR_UNEXPECTED; | 30 int rv = (j == 0) ? OK : ERR_UNEXPECTED; |
30 for (int k = 0; k < 2; ++k) { | 31 for (int k = 0; k < 2; ++k) { |
31 TestCompletionCallback test_callback; | 32 TestCompletionCallback test_callback; |
32 HttpAuth::Target target = | 33 HttpAuth::Target target = |
(...skipping 18 matching lines...) Expand all Loading... |
51 EXPECT_TRUE(LogContainsBeginEvent(capturing_net_log.entries(), | 52 EXPECT_TRUE(LogContainsBeginEvent(capturing_net_log.entries(), |
52 0, event_type)); | 53 0, event_type)); |
53 EXPECT_TRUE(LogContainsEndEvent(capturing_net_log.entries(), | 54 EXPECT_TRUE(LogContainsEndEvent(capturing_net_log.entries(), |
54 1, event_type)); | 55 1, event_type)); |
55 } | 56 } |
56 } | 57 } |
57 } | 58 } |
58 } | 59 } |
59 | 60 |
60 } // namespace net | 61 } // namespace net |
OLD | NEW |