| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 virtual int ResolveCanonicalName(HostResolver* host_resolver, | 68 virtual int ResolveCanonicalName(HostResolver* host_resolver, |
| 69 CompletionCallback* callback); | 69 CompletionCallback* callback); |
| 70 | 70 |
| 71 | 71 |
| 72 void SetGenerateExpectation(bool async, int rv); | 72 void SetGenerateExpectation(bool async, int rv); |
| 73 | 73 |
| 74 void set_connection_based(bool connection_based) { | 74 void set_connection_based(bool connection_based) { |
| 75 connection_based_ = connection_based; | 75 connection_based_ = connection_based; |
| 76 } | 76 } |
| 77 | 77 |
| 78 void set_allows_default_credentials(bool allows_default_credentials) { |
| 79 allows_default_credentials_ = allows_default_credentials; |
| 80 } |
| 81 |
| 82 void set_allows_explicit_credentials(bool allows_explicit_credentials) { |
| 83 allows_explicit_credentials_ = allows_explicit_credentials; |
| 84 } |
| 85 |
| 78 const GURL& request_url() const { | 86 const GURL& request_url() const { |
| 79 return request_url_; | 87 return request_url_; |
| 80 } | 88 } |
| 81 | 89 |
| 82 // HttpAuthHandler: | 90 // HttpAuthHandler: |
| 83 virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( | 91 virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( |
| 84 HttpAuth::ChallengeTokenizer* challenge); | 92 HttpAuth::ChallengeTokenizer* challenge) OVERRIDE; |
| 85 virtual bool NeedsIdentity(); | 93 virtual bool NeedsIdentity() OVERRIDE; |
| 94 virtual bool AllowsDefaultCredentials() OVERRIDE; |
| 95 virtual bool AllowsExplicitCredentials() OVERRIDE; |
| 86 | 96 |
| 87 protected: | 97 protected: |
| 88 virtual bool Init(HttpAuth::ChallengeTokenizer* challenge); | 98 virtual bool Init(HttpAuth::ChallengeTokenizer* challenge); |
| 89 | 99 |
| 90 virtual int GenerateAuthTokenImpl(const string16* username, | 100 virtual int GenerateAuthTokenImpl(const string16* username, |
| 91 const string16* password, | 101 const string16* password, |
| 92 const HttpRequestInfo* request, | 102 const HttpRequestInfo* request, |
| 93 CompletionCallback* callback, | 103 CompletionCallback* callback, |
| 94 std::string* auth_token); | 104 std::string* auth_token); |
| 95 | 105 |
| 96 private: | 106 private: |
| 97 void OnResolveCanonicalName(); | 107 void OnResolveCanonicalName(); |
| 98 | 108 |
| 99 void OnGenerateAuthToken(); | 109 void OnGenerateAuthToken(); |
| 100 | 110 |
| 101 Resolve resolve_; | 111 Resolve resolve_; |
| 102 CompletionCallback* user_callback_; | 112 CompletionCallback* user_callback_; |
| 103 ScopedRunnableMethodFactory<HttpAuthHandlerMock> method_factory_; | 113 ScopedRunnableMethodFactory<HttpAuthHandlerMock> method_factory_; |
| 104 bool generate_async_; | 114 bool generate_async_; |
| 105 int generate_rv_; | 115 int generate_rv_; |
| 106 std::string* auth_token_; | 116 std::string* auth_token_; |
| 107 bool first_round_; | 117 bool first_round_; |
| 108 bool connection_based_; | 118 bool connection_based_; |
| 119 bool allows_default_credentials_; |
| 120 bool allows_explicit_credentials_; |
| 109 GURL request_url_; | 121 GURL request_url_; |
| 110 }; | 122 }; |
| 111 | 123 |
| 112 } // namespace net | 124 } // namespace net |
| 113 | 125 |
| 114 #endif // NET_HTTP_HTTP_AUTH_HANDLER_MOCK_H_ | 126 #endif // NET_HTTP_HTTP_AUTH_HANDLER_MOCK_H_ |
| OLD | NEW |