Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(585)

Side by Side Diff: net/http/http_auth_handler_mock.h

Issue 8340026: Use AuthCredentials throughout the network stack instead of username/password. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix comments Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/http/http_auth_handler_digest_unittest.cc ('k') | net/http/http_auth_handler_mock.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
14 #include "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
15 #include "net/http/http_auth_handler.h" 14 #include "net/http/http_auth_handler.h"
16 #include "net/http/http_auth_handler_factory.h" 15 #include "net/http/http_auth_handler_factory.h"
17 16
18 namespace net { 17 namespace net {
19 18
20 class HostResolver; 19 class HostResolver;
21 20
22 // MockAuthHandler is used in tests to reliably trigger edge cases. 21 // MockAuthHandler is used in tests to reliably trigger edge cases.
23 class HttpAuthHandlerMock : public HttpAuthHandler { 22 class HttpAuthHandlerMock : public HttpAuthHandler {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // HttpAuthHandler: 89 // HttpAuthHandler:
91 virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( 90 virtual HttpAuth::AuthorizationResult HandleAnotherChallenge(
92 HttpAuth::ChallengeTokenizer* challenge) OVERRIDE; 91 HttpAuth::ChallengeTokenizer* challenge) OVERRIDE;
93 virtual bool NeedsIdentity() OVERRIDE; 92 virtual bool NeedsIdentity() OVERRIDE;
94 virtual bool AllowsDefaultCredentials() OVERRIDE; 93 virtual bool AllowsDefaultCredentials() OVERRIDE;
95 virtual bool AllowsExplicitCredentials() OVERRIDE; 94 virtual bool AllowsExplicitCredentials() OVERRIDE;
96 95
97 protected: 96 protected:
98 virtual bool Init(HttpAuth::ChallengeTokenizer* challenge); 97 virtual bool Init(HttpAuth::ChallengeTokenizer* challenge);
99 98
100 virtual int GenerateAuthTokenImpl(const string16* username, 99 virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials,
101 const string16* password,
102 const HttpRequestInfo* request, 100 const HttpRequestInfo* request,
103 OldCompletionCallback* callback, 101 OldCompletionCallback* callback,
104 std::string* auth_token); 102 std::string* auth_token);
105 103
106 private: 104 private:
107 void OnResolveCanonicalName(); 105 void OnResolveCanonicalName();
108 106
109 void OnGenerateAuthToken(); 107 void OnGenerateAuthToken();
110 108
111 Resolve resolve_; 109 Resolve resolve_;
112 OldCompletionCallback* user_callback_; 110 OldCompletionCallback* user_callback_;
113 base::WeakPtrFactory<HttpAuthHandlerMock> ptr_factory_; 111 base::WeakPtrFactory<HttpAuthHandlerMock> ptr_factory_;
114 bool generate_async_; 112 bool generate_async_;
115 int generate_rv_; 113 int generate_rv_;
116 std::string* auth_token_; 114 std::string* auth_token_;
117 bool first_round_; 115 bool first_round_;
118 bool connection_based_; 116 bool connection_based_;
119 bool allows_default_credentials_; 117 bool allows_default_credentials_;
120 bool allows_explicit_credentials_; 118 bool allows_explicit_credentials_;
121 GURL request_url_; 119 GURL request_url_;
122 }; 120 };
123 121
124 } // namespace net 122 } // namespace net
125 123
126 #endif // NET_HTTP_HTTP_AUTH_HANDLER_MOCK_H_ 124 #endif // NET_HTTP_HTTP_AUTH_HANDLER_MOCK_H_
OLDNEW
« no previous file with comments | « net/http/http_auth_handler_digest_unittest.cc ('k') | net/http/http_auth_handler_mock.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698