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_mock.h" | 5 #include "net/http/http_auth_handler_mock.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 generate_rv_ = rv; | 69 generate_rv_ = rv; |
70 } | 70 } |
71 | 71 |
72 bool HttpAuthHandlerMock::Init(HttpAuth::ChallengeTokenizer* challenge) { | 72 bool HttpAuthHandlerMock::Init(HttpAuth::ChallengeTokenizer* challenge) { |
73 scheme_ = "mock"; | 73 scheme_ = "mock"; |
74 score_ = 1; | 74 score_ = 1; |
75 properties_ = connection_based_ ? IS_CONNECTION_BASED : 0; | 75 properties_ = connection_based_ ? IS_CONNECTION_BASED : 0; |
76 return true; | 76 return true; |
77 } | 77 } |
78 | 78 |
79 int HttpAuthHandlerMock::GenerateAuthTokenImpl(const std::wstring* username, | 79 int HttpAuthHandlerMock::GenerateAuthTokenImpl(const string16* username, |
80 const std::wstring* password, | 80 const string16* password, |
81 const HttpRequestInfo* request, | 81 const HttpRequestInfo* request, |
82 CompletionCallback* callback, | 82 CompletionCallback* callback, |
83 std::string* auth_token) { | 83 std::string* auth_token) { |
84 first_round_ = false; | 84 first_round_ = false; |
85 if (generate_async_) { | 85 if (generate_async_) { |
86 EXPECT_TRUE(user_callback_ == NULL); | 86 EXPECT_TRUE(user_callback_ == NULL); |
87 EXPECT_TRUE(auth_token_ == NULL); | 87 EXPECT_TRUE(auth_token_ == NULL); |
88 user_callback_ = callback; | 88 user_callback_ = callback; |
89 auth_token_ = auth_token; | 89 auth_token_ = auth_token; |
90 MessageLoop::current()->PostTask( | 90 MessageLoop::current()->PostTask( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 int nonce_count, | 132 int nonce_count, |
133 const BoundNetLog& net_log, | 133 const BoundNetLog& net_log, |
134 scoped_ptr<HttpAuthHandler>* handler) { | 134 scoped_ptr<HttpAuthHandler>* handler) { |
135 if (!handlers_[target].get()) | 135 if (!handlers_[target].get()) |
136 return ERR_UNEXPECTED; | 136 return ERR_UNEXPECTED; |
137 handler->swap(handlers_[target]); | 137 handler->swap(handlers_[target]); |
138 return OK; | 138 return OK; |
139 } | 139 } |
140 | 140 |
141 } // namespace net | 141 } // namespace net |
OLD | NEW |