| 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 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 Factory(); | 36 Factory(); |
| 37 virtual ~Factory(); | 37 virtual ~Factory(); |
| 38 | 38 |
| 39 void AddMockHandler(HttpAuthHandler* handler, HttpAuth::Target target); | 39 void AddMockHandler(HttpAuthHandler* handler, HttpAuth::Target target); |
| 40 | 40 |
| 41 void set_do_init_from_challenge(bool do_init_from_challenge) { | 41 void set_do_init_from_challenge(bool do_init_from_challenge) { |
| 42 do_init_from_challenge_ = do_init_from_challenge; | 42 do_init_from_challenge_ = do_init_from_challenge; |
| 43 } | 43 } |
| 44 | 44 |
| 45 // HttpAuthHandlerFactory: | 45 // HttpAuthHandlerFactory: |
| 46 virtual int CreateAuthHandler(HttpAuth::ChallengeTokenizer* challenge, | 46 virtual int CreateAuthHandler( |
| 47 HttpAuth::Target target, | 47 HttpAuth::ChallengeTokenizer* challenge, |
| 48 const GURL& origin, | 48 HttpAuth::Target target, |
| 49 CreateReason reason, | 49 const GURL& origin, |
| 50 int nonce_count, | 50 CreateReason reason, |
| 51 const BoundNetLog& net_log, | 51 int nonce_count, |
| 52 scoped_ptr<HttpAuthHandler>* handler); | 52 const BoundNetLog& net_log, |
| 53 scoped_ptr<HttpAuthHandler>* handler) OVERRIDE; |
| 53 | 54 |
| 54 private: | 55 private: |
| 55 ScopedVector<HttpAuthHandler> handlers_[HttpAuth::AUTH_NUM_TARGETS]; | 56 ScopedVector<HttpAuthHandler> handlers_[HttpAuth::AUTH_NUM_TARGETS]; |
| 56 bool do_init_from_challenge_; | 57 bool do_init_from_challenge_; |
| 57 }; | 58 }; |
| 58 | 59 |
| 59 HttpAuthHandlerMock(); | 60 HttpAuthHandlerMock(); |
| 60 | 61 |
| 61 virtual ~HttpAuthHandlerMock(); | 62 virtual ~HttpAuthHandlerMock(); |
| 62 | 63 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 87 } | 88 } |
| 88 | 89 |
| 89 // HttpAuthHandler: | 90 // HttpAuthHandler: |
| 90 virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( | 91 virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( |
| 91 HttpAuth::ChallengeTokenizer* challenge) OVERRIDE; | 92 HttpAuth::ChallengeTokenizer* challenge) OVERRIDE; |
| 92 virtual bool NeedsIdentity() OVERRIDE; | 93 virtual bool NeedsIdentity() OVERRIDE; |
| 93 virtual bool AllowsDefaultCredentials() OVERRIDE; | 94 virtual bool AllowsDefaultCredentials() OVERRIDE; |
| 94 virtual bool AllowsExplicitCredentials() OVERRIDE; | 95 virtual bool AllowsExplicitCredentials() OVERRIDE; |
| 95 | 96 |
| 96 protected: | 97 protected: |
| 97 virtual bool Init(HttpAuth::ChallengeTokenizer* challenge); | 98 virtual bool Init(HttpAuth::ChallengeTokenizer* challenge) OVERRIDE; |
| 98 | 99 |
| 99 virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials, | 100 virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials, |
| 100 const HttpRequestInfo* request, | 101 const HttpRequestInfo* request, |
| 101 OldCompletionCallback* callback, | 102 OldCompletionCallback* callback, |
| 102 std::string* auth_token); | 103 std::string* auth_token) OVERRIDE; |
| 103 | 104 |
| 104 private: | 105 private: |
| 105 void OnResolveCanonicalName(); | 106 void OnResolveCanonicalName(); |
| 106 | 107 |
| 107 void OnGenerateAuthToken(); | 108 void OnGenerateAuthToken(); |
| 108 | 109 |
| 109 Resolve resolve_; | 110 Resolve resolve_; |
| 110 OldCompletionCallback* user_callback_; | 111 OldCompletionCallback* user_callback_; |
| 111 base::WeakPtrFactory<HttpAuthHandlerMock> ptr_factory_; | 112 base::WeakPtrFactory<HttpAuthHandlerMock> ptr_factory_; |
| 112 bool generate_async_; | 113 bool generate_async_; |
| 113 int generate_rv_; | 114 int generate_rv_; |
| 114 std::string* auth_token_; | 115 std::string* auth_token_; |
| 115 bool first_round_; | 116 bool first_round_; |
| 116 bool connection_based_; | 117 bool connection_based_; |
| 117 bool allows_default_credentials_; | 118 bool allows_default_credentials_; |
| 118 bool allows_explicit_credentials_; | 119 bool allows_explicit_credentials_; |
| 119 GURL request_url_; | 120 GURL request_url_; |
| 120 }; | 121 }; |
| 121 | 122 |
| 122 } // namespace net | 123 } // namespace net |
| 123 | 124 |
| 124 #endif // NET_HTTP_HTTP_AUTH_HANDLER_MOCK_H_ | 125 #endif // NET_HTTP_HTTP_AUTH_HANDLER_MOCK_H_ |
| OLD | NEW |