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

Unified Diff: net/http/http_auth_handler_mock.h

Issue 1391053002: [net/http auth] Make HttpAuthHandler challenge handling asynchronous. Base URL: https://chromium.googlesource.com/chromium/src.git@auth-handler-init-split
Patch Set: Created 5 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_auth_handler_factory_unittest.cc ('k') | net/http/http_auth_handler_mock.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_auth_handler_mock.h
diff --git a/net/http/http_auth_handler_mock.h b/net/http/http_auth_handler_mock.h
index 3afa7bf654d8386b4fcc86c0213a99dba81fc3f7..067cc74c0aa6b317310543b84b30c61311d39eba 100644
--- a/net/http/http_auth_handler_mock.h
+++ b/net/http/http_auth_handler_mock.h
@@ -33,7 +33,6 @@ class HttpAuthHandlerMock : public HttpAuthHandler {
void AddMockHandler(scoped_ptr<HttpAuthHandler> handler,
HttpAuthHandlerCreateReason reason);
-
bool HaveAuthHandlers() const;
// HttpAuthHandlerFactory:
@@ -41,7 +40,6 @@ class HttpAuthHandlerMock : public HttpAuthHandler {
const std::string& scheme) override;
scoped_ptr<HttpAuthHandler> CreateAndInitPreemptiveAuthHandler(
HttpAuthCache::Entry* cache_entry,
- const HttpAuthChallengeTokenizer& tokenizer,
HttpAuth::Target target,
const BoundNetLog& net_log) override;
@@ -56,6 +54,7 @@ class HttpAuthHandlerMock : public HttpAuthHandler {
~HttpAuthHandlerMock() override;
+ void SetInitExpectation(bool async, int rv);
void SetGenerateExpectation(bool async, int rv);
void set_expected_auth_scheme(const std::string& scheme) {
@@ -78,10 +77,6 @@ class HttpAuthHandlerMock : public HttpAuthHandler {
allows_explicit_credentials_ = allows_explicit_credentials;
}
- void set_auth_token(const std::string& auth_token) {
- auth_token_ = auth_token;
- }
-
const GURL& request_url() const {
return request_url_;
}
@@ -94,17 +89,25 @@ class HttpAuthHandlerMock : public HttpAuthHandler {
bool AllowsExplicitCredentials() override;
protected:
- int Init(const HttpAuthChallengeTokenizer& challenge) override;
-
+ // HttpAuthHandler
+ int InitializeFromChallengeInternal(
+ const HttpAuthChallengeTokenizer& challenge,
+ const HttpResponseInfo& response_with_challenge,
+ const CompletionCallback& callback) override;
+ int InitializeFromCacheEntryInternal(
+ HttpAuthCache::Entry* cache_entry) override;
int GenerateAuthTokenImpl(const AuthCredentials* credentials,
const HttpRequestInfo& request,
const CompletionCallback& callback,
std::string* auth_token) override;
private:
- void OnGenerateAuthToken();
+ void OnInitializeComplete();
+ void OnGenerateAuthTokenComplete();
CompletionCallback callback_;
+ bool init_async_ = false;
+ int init_rv_ = 0;
bool generate_async_ = false;
int generate_rv_ = 0;
std::string auth_token_;
@@ -113,6 +116,8 @@ class HttpAuthHandlerMock : public HttpAuthHandler {
bool allows_default_credentials_ = false;
bool allows_explicit_credentials_ = true;
bool expect_multiple_challenges_ = false;
+ bool initialized_ = false;
+ bool initialization_succeeded = false;
HttpAuth::Target expected_auth_target_ = HttpAuth::AUTH_SERVER;
GURL request_url_;
base::WeakPtrFactory<HttpAuthHandlerMock> weak_factory_;
« no previous file with comments | « net/http/http_auth_handler_factory_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