| 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 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 int CreateAuthHandler(HttpAuthChallengeTokenizer* challenge, | 46 int CreateAuthHandler(HttpAuthChallengeTokenizer* challenge, |
| 47 HttpAuth::Target target, | 47 HttpAuth::Target target, |
| 48 const SSLInfo& ssl_info, |
| 48 const GURL& origin, | 49 const GURL& origin, |
| 49 CreateReason reason, | 50 CreateReason reason, |
| 50 int nonce_count, | 51 int nonce_count, |
| 51 const BoundNetLog& net_log, | 52 const BoundNetLog& net_log, |
| 52 scoped_ptr<HttpAuthHandler>* handler) override; | 53 scoped_ptr<HttpAuthHandler>* handler) override; |
| 53 | 54 |
| 54 private: | 55 private: |
| 55 std::vector<scoped_ptr<HttpAuthHandler>> | 56 std::vector<scoped_ptr<HttpAuthHandler>> |
| 56 handlers_[HttpAuth::AUTH_NUM_TARGETS]; | 57 handlers_[HttpAuth::AUTH_NUM_TARGETS]; |
| 57 bool do_init_from_challenge_; | 58 bool do_init_from_challenge_; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 88 } | 89 } |
| 89 | 90 |
| 90 // HttpAuthHandler: | 91 // HttpAuthHandler: |
| 91 HttpAuth::AuthorizationResult HandleAnotherChallenge( | 92 HttpAuth::AuthorizationResult HandleAnotherChallenge( |
| 92 HttpAuthChallengeTokenizer* challenge) override; | 93 HttpAuthChallengeTokenizer* challenge) override; |
| 93 bool NeedsIdentity() override; | 94 bool NeedsIdentity() override; |
| 94 bool AllowsDefaultCredentials() override; | 95 bool AllowsDefaultCredentials() override; |
| 95 bool AllowsExplicitCredentials() override; | 96 bool AllowsExplicitCredentials() override; |
| 96 | 97 |
| 97 protected: | 98 protected: |
| 98 bool Init(HttpAuthChallengeTokenizer* challenge) override; | 99 bool Init(HttpAuthChallengeTokenizer* challenge, |
| 100 const SSLInfo& ssl_info) override; |
| 99 | 101 |
| 100 int GenerateAuthTokenImpl(const AuthCredentials* credentials, | 102 int GenerateAuthTokenImpl(const AuthCredentials* credentials, |
| 101 const HttpRequestInfo* request, | 103 const HttpRequestInfo* request, |
| 102 const CompletionCallback& callback, | 104 const CompletionCallback& callback, |
| 103 std::string* auth_token) override; | 105 std::string* auth_token) override; |
| 104 | 106 |
| 105 private: | 107 private: |
| 106 void OnResolveCanonicalName(); | 108 void OnResolveCanonicalName(); |
| 107 | 109 |
| 108 void OnGenerateAuthToken(); | 110 void OnGenerateAuthToken(); |
| 109 | 111 |
| 110 Resolve resolve_; | 112 Resolve resolve_; |
| 111 CompletionCallback callback_; | 113 CompletionCallback callback_; |
| 112 bool generate_async_; | 114 bool generate_async_; |
| 113 int generate_rv_; | 115 int generate_rv_; |
| 114 std::string* auth_token_; | 116 std::string* auth_token_; |
| 115 bool first_round_; | 117 bool first_round_; |
| 116 bool connection_based_; | 118 bool connection_based_; |
| 117 bool allows_default_credentials_; | 119 bool allows_default_credentials_; |
| 118 bool allows_explicit_credentials_; | 120 bool allows_explicit_credentials_; |
| 119 GURL request_url_; | 121 GURL request_url_; |
| 120 base::WeakPtrFactory<HttpAuthHandlerMock> weak_factory_; | 122 base::WeakPtrFactory<HttpAuthHandlerMock> weak_factory_; |
| 121 }; | 123 }; |
| 122 | 124 |
| 123 } // namespace net | 125 } // namespace net |
| 124 | 126 |
| 125 #endif // NET_HTTP_HTTP_AUTH_HANDLER_MOCK_H_ | 127 #endif // NET_HTTP_HTTP_AUTH_HANDLER_MOCK_H_ |
| OLD | NEW |