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

Unified Diff: net/http/http_auth_handler_mock.h

Issue 1393693002: [net/http auth] Split HttpAuthHandler creation from initialization. Base URL: https://chromium.googlesource.com/chromium/src.git@rename-auth-handler-methods
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 63ddd6b03ac02b1a4b9763eea9b9cc78d389ad9d..3afa7bf654d8386b4fcc86c0213a99dba81fc3f7 100644
--- a/net/http/http_auth_handler_mock.h
+++ b/net/http/http_auth_handler_mock.h
@@ -19,6 +19,8 @@ namespace net {
class HostResolver;
+enum class HttpAuthHandlerCreateReason { PREEMPTIVE, CHALLENGE };
+
// MockAuthHandler is used in tests to reliably trigger edge cases.
class HttpAuthHandlerMock : public HttpAuthHandler {
public:
@@ -30,25 +32,24 @@ class HttpAuthHandlerMock : public HttpAuthHandler {
~Factory() override;
void AddMockHandler(scoped_ptr<HttpAuthHandler> handler,
- CreateReason reason,
- HttpAuth::Target target);
+ HttpAuthHandlerCreateReason reason);
- bool HaveAuthHandlers(HttpAuth::Target) const;
+ bool HaveAuthHandlers() const;
// HttpAuthHandlerFactory:
- int CreateAuthHandler(const HttpAuthChallengeTokenizer& challenge,
- HttpAuth::Target target,
- const GURL& origin,
- CreateReason reason,
- int nonce_count,
- const BoundNetLog& net_log,
- scoped_ptr<HttpAuthHandler>* handler) override;
+ scoped_ptr<HttpAuthHandler> CreateAuthHandlerForScheme(
+ const std::string& scheme) override;
+ scoped_ptr<HttpAuthHandler> CreateAndInitPreemptiveAuthHandler(
+ HttpAuthCache::Entry* cache_entry,
+ const HttpAuthChallengeTokenizer& tokenizer,
+ HttpAuth::Target target,
+ const BoundNetLog& net_log) override;
private:
- ScopedVector<HttpAuthHandler>
- challenge_handlers_[HttpAuth::AUTH_NUM_TARGETS];
- ScopedVector<HttpAuthHandler>
- preemptive_handlers_[HttpAuth::AUTH_NUM_TARGETS];
+ scoped_ptr<HttpAuthHandler> GetNextAuthHandler(
+ ScopedVector<HttpAuthHandler>* handler_list);
+ ScopedVector<HttpAuthHandler> challenge_handlers_;
+ ScopedVector<HttpAuthHandler> preemptive_handlers_;
};
HttpAuthHandlerMock();
@@ -58,7 +59,11 @@ class HttpAuthHandlerMock : public HttpAuthHandler {
void SetGenerateExpectation(bool async, int rv);
void set_expected_auth_scheme(const std::string& scheme) {
- expected_auth_scheme_ = scheme;
+ auth_scheme_ = scheme;
+ }
+
+ void set_expected_auth_target(HttpAuth::Target target) {
+ expected_auth_target_ = target;
}
void set_expect_multiple_challenges(bool expect_multiple_challenges) {
@@ -100,7 +105,6 @@ class HttpAuthHandlerMock : public HttpAuthHandler {
void OnGenerateAuthToken();
CompletionCallback callback_;
- std::string expected_auth_scheme_;
bool generate_async_ = false;
int generate_rv_ = 0;
std::string auth_token_;
@@ -109,6 +113,7 @@ class HttpAuthHandlerMock : public HttpAuthHandler {
bool allows_default_credentials_ = false;
bool allows_explicit_credentials_ = true;
bool expect_multiple_challenges_ = 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