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 | 9 |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 } | 42 } |
43 | 43 |
44 // HttpAuthHandlerFactory: | 44 // HttpAuthHandlerFactory: |
45 virtual int CreateAuthHandler( | 45 virtual int CreateAuthHandler( |
46 HttpAuthChallengeTokenizer* challenge, | 46 HttpAuthChallengeTokenizer* challenge, |
47 HttpAuth::Target target, | 47 HttpAuth::Target target, |
48 const GURL& origin, | 48 const GURL& origin, |
49 CreateReason reason, | 49 CreateReason reason, |
50 int nonce_count, | 50 int nonce_count, |
51 const BoundNetLog& net_log, | 51 const BoundNetLog& net_log, |
52 scoped_ptr<HttpAuthHandler>* handler) OVERRIDE; | 52 scoped_ptr<HttpAuthHandler>* handler) override; |
53 | 53 |
54 private: | 54 private: |
55 ScopedVector<HttpAuthHandler> handlers_[HttpAuth::AUTH_NUM_TARGETS]; | 55 ScopedVector<HttpAuthHandler> handlers_[HttpAuth::AUTH_NUM_TARGETS]; |
56 bool do_init_from_challenge_; | 56 bool do_init_from_challenge_; |
57 }; | 57 }; |
58 | 58 |
59 HttpAuthHandlerMock(); | 59 HttpAuthHandlerMock(); |
60 | 60 |
61 virtual ~HttpAuthHandlerMock(); | 61 virtual ~HttpAuthHandlerMock(); |
62 | 62 |
(...skipping 18 matching lines...) Expand all Loading... |
81 void set_allows_explicit_credentials(bool allows_explicit_credentials) { | 81 void set_allows_explicit_credentials(bool allows_explicit_credentials) { |
82 allows_explicit_credentials_ = allows_explicit_credentials; | 82 allows_explicit_credentials_ = allows_explicit_credentials; |
83 } | 83 } |
84 | 84 |
85 const GURL& request_url() const { | 85 const GURL& request_url() const { |
86 return request_url_; | 86 return request_url_; |
87 } | 87 } |
88 | 88 |
89 // HttpAuthHandler: | 89 // HttpAuthHandler: |
90 virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( | 90 virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( |
91 HttpAuthChallengeTokenizer* challenge) OVERRIDE; | 91 HttpAuthChallengeTokenizer* challenge) override; |
92 virtual bool NeedsIdentity() OVERRIDE; | 92 virtual bool NeedsIdentity() override; |
93 virtual bool AllowsDefaultCredentials() OVERRIDE; | 93 virtual bool AllowsDefaultCredentials() override; |
94 virtual bool AllowsExplicitCredentials() OVERRIDE; | 94 virtual bool AllowsExplicitCredentials() override; |
95 | 95 |
96 protected: | 96 protected: |
97 virtual bool Init(HttpAuthChallengeTokenizer* challenge) OVERRIDE; | 97 virtual bool Init(HttpAuthChallengeTokenizer* challenge) override; |
98 | 98 |
99 virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials, | 99 virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials, |
100 const HttpRequestInfo* request, | 100 const HttpRequestInfo* request, |
101 const CompletionCallback& callback, | 101 const CompletionCallback& callback, |
102 std::string* auth_token) OVERRIDE; | 102 std::string* auth_token) override; |
103 | 103 |
104 private: | 104 private: |
105 void OnResolveCanonicalName(); | 105 void OnResolveCanonicalName(); |
106 | 106 |
107 void OnGenerateAuthToken(); | 107 void OnGenerateAuthToken(); |
108 | 108 |
109 Resolve resolve_; | 109 Resolve resolve_; |
110 CompletionCallback callback_; | 110 CompletionCallback callback_; |
111 bool generate_async_; | 111 bool generate_async_; |
112 int generate_rv_; | 112 int generate_rv_; |
113 std::string* auth_token_; | 113 std::string* auth_token_; |
114 bool first_round_; | 114 bool first_round_; |
115 bool connection_based_; | 115 bool connection_based_; |
116 bool allows_default_credentials_; | 116 bool allows_default_credentials_; |
117 bool allows_explicit_credentials_; | 117 bool allows_explicit_credentials_; |
118 GURL request_url_; | 118 GURL request_url_; |
119 base::WeakPtrFactory<HttpAuthHandlerMock> weak_factory_; | 119 base::WeakPtrFactory<HttpAuthHandlerMock> weak_factory_; |
120 }; | 120 }; |
121 | 121 |
122 } // namespace net | 122 } // namespace net |
123 | 123 |
124 #endif // NET_HTTP_HTTP_AUTH_HANDLER_MOCK_H_ | 124 #endif // NET_HTTP_HTTP_AUTH_HANDLER_MOCK_H_ |
OLD | NEW |