Chromium Code Reviews| 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 #ifndef NET_HTTP_HTTP_AUTH_HANDLER_MOCK_H_ | 5 #ifndef NET_HTTP_HTTP_AUTH_HANDLER_MOCK_H_ |
| 6 #define NET_HTTP_HTTP_AUTH_HANDLER_MOCK_H_ | 6 #define NET_HTTP_HTTP_AUTH_HANDLER_MOCK_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/string16.h" | 13 #include "base/string16.h" |
|
asanka
2011/10/28 14:39:40
Is base/string16.h needed anymore?
| |
| 14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
| 15 #include "net/http/http_auth_handler.h" | 15 #include "net/http/http_auth_handler.h" |
| 16 #include "net/http/http_auth_handler_factory.h" | 16 #include "net/http/http_auth_handler_factory.h" |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 | 19 |
| 20 class HostResolver; | 20 class HostResolver; |
| 21 | 21 |
| 22 // MockAuthHandler is used in tests to reliably trigger edge cases. | 22 // MockAuthHandler is used in tests to reliably trigger edge cases. |
| 23 class HttpAuthHandlerMock : public HttpAuthHandler { | 23 class HttpAuthHandlerMock : public HttpAuthHandler { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 // HttpAuthHandler: | 90 // HttpAuthHandler: |
| 91 virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( | 91 virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( |
| 92 HttpAuth::ChallengeTokenizer* challenge) OVERRIDE; | 92 HttpAuth::ChallengeTokenizer* challenge) OVERRIDE; |
| 93 virtual bool NeedsIdentity() OVERRIDE; | 93 virtual bool NeedsIdentity() OVERRIDE; |
| 94 virtual bool AllowsDefaultCredentials() OVERRIDE; | 94 virtual bool AllowsDefaultCredentials() OVERRIDE; |
| 95 virtual bool AllowsExplicitCredentials() OVERRIDE; | 95 virtual bool AllowsExplicitCredentials() OVERRIDE; |
| 96 | 96 |
| 97 protected: | 97 protected: |
| 98 virtual bool Init(HttpAuth::ChallengeTokenizer* challenge); | 98 virtual bool Init(HttpAuth::ChallengeTokenizer* challenge); |
| 99 | 99 |
| 100 virtual int GenerateAuthTokenImpl(const string16* username, | 100 virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials, |
| 101 const string16* password, | |
| 102 const HttpRequestInfo* request, | 101 const HttpRequestInfo* request, |
| 103 OldCompletionCallback* callback, | 102 OldCompletionCallback* callback, |
| 104 std::string* auth_token); | 103 std::string* auth_token); |
| 105 | 104 |
| 106 private: | 105 private: |
| 107 void OnResolveCanonicalName(); | 106 void OnResolveCanonicalName(); |
| 108 | 107 |
| 109 void OnGenerateAuthToken(); | 108 void OnGenerateAuthToken(); |
| 110 | 109 |
| 111 Resolve resolve_; | 110 Resolve resolve_; |
| 112 OldCompletionCallback* user_callback_; | 111 OldCompletionCallback* user_callback_; |
| 113 base::WeakPtrFactory<HttpAuthHandlerMock> ptr_factory_; | 112 base::WeakPtrFactory<HttpAuthHandlerMock> ptr_factory_; |
| 114 bool generate_async_; | 113 bool generate_async_; |
| 115 int generate_rv_; | 114 int generate_rv_; |
| 116 std::string* auth_token_; | 115 std::string* auth_token_; |
| 117 bool first_round_; | 116 bool first_round_; |
| 118 bool connection_based_; | 117 bool connection_based_; |
| 119 bool allows_default_credentials_; | 118 bool allows_default_credentials_; |
| 120 bool allows_explicit_credentials_; | 119 bool allows_explicit_credentials_; |
| 121 GURL request_url_; | 120 GURL request_url_; |
| 122 }; | 121 }; |
| 123 | 122 |
| 124 } // namespace net | 123 } // namespace net |
| 125 | 124 |
| 126 #endif // NET_HTTP_HTTP_AUTH_HANDLER_MOCK_H_ | 125 #endif // NET_HTTP_HTTP_AUTH_HANDLER_MOCK_H_ |
| OLD | NEW |