| 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_;
|
| };
|
|
|