| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <set> | 5 #include <set> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 HttpAuthHandlerMock* CreateMockHandler(bool expect_multiple_challenges) { | 29 HttpAuthHandlerMock* CreateMockHandler(bool expect_multiple_challenges) { |
| 30 HttpAuthHandlerMock* auth_handler = new HttpAuthHandlerMock(); | 30 HttpAuthHandlerMock* auth_handler = new HttpAuthHandlerMock(); |
| 31 auth_handler->set_expect_multiple_challenges(expect_multiple_challenges); | 31 auth_handler->set_expect_multiple_challenges(expect_multiple_challenges); |
| 32 std::string challenge_text = "Mock"; | 32 std::string challenge_text = "Mock"; |
| 33 HttpAuthChallengeTokenizer challenge(challenge_text.begin(), | 33 HttpAuthChallengeTokenizer challenge(challenge_text.begin(), |
| 34 challenge_text.end()); | 34 challenge_text.end()); |
| 35 GURL origin("www.example.com"); | 35 GURL origin("www.example.com"); |
| 36 EXPECT_TRUE(auth_handler->InitFromChallenge(&challenge, HttpAuth::AUTH_SERVER, | 36 EXPECT_EQ(OK, auth_handler->HandleInitialChallenge( |
| 37 origin, BoundNetLog())); | 37 challenge, HttpAuth::AUTH_SERVER, origin, BoundNetLog())); |
| 38 return auth_handler; | 38 return auth_handler; |
| 39 } | 39 } |
| 40 | 40 |
| 41 HttpResponseHeaders* HeadersFromResponseText(const std::string& response) { | 41 HttpResponseHeaders* HeadersFromResponseText(const std::string& response) { |
| 42 return new HttpResponseHeaders( | 42 return new HttpResponseHeaders( |
| 43 HttpUtil::AssembleRawHeaders(response.c_str(), response.length())); | 43 HttpUtil::AssembleRawHeaders(response.c_str(), response.length())); |
| 44 } | 44 } |
| 45 | 45 |
| 46 HttpAuth::AuthorizationResult HandleChallengeResponse( | 46 HttpAuth::AuthorizationResult HandleChallengeResponse( |
| 47 bool expect_multiple_challenges, | 47 bool expect_multiple_challenges, |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 std::string name; | 254 std::string name; |
| 255 | 255 |
| 256 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_SERVER); | 256 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_SERVER); |
| 257 EXPECT_STREQ("Authorization", name.c_str()); | 257 EXPECT_STREQ("Authorization", name.c_str()); |
| 258 | 258 |
| 259 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_PROXY); | 259 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_PROXY); |
| 260 EXPECT_STREQ("Proxy-Authorization", name.c_str()); | 260 EXPECT_STREQ("Proxy-Authorization", name.c_str()); |
| 261 } | 261 } |
| 262 | 262 |
| 263 } // namespace net | 263 } // namespace net |
| OLD | NEW |