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

Unified Diff: net/http/http_auth_handler_mock.h

Issue 2489883007: [net/auth] Discard current handler token generation fails. (Closed)
Patch Set: . Created 4 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 side-by-side diff with in-line comments
Download patch
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 049b880354038f0fe46e73727b5ea700a947edd9..d8e3e456f9d409b57ebdacae865ff23a504e8a49 100644
--- a/net/http/http_auth_handler_mock.h
+++ b/net/http/http_auth_handler_mock.h
@@ -6,6 +6,7 @@
#define NET_HTTP_HTTP_AUTH_HANDLER_MOCK_H_
#include <memory>
+#include <ostream>
#include <string>
#include <vector>
@@ -21,6 +22,14 @@ class HostResolver;
// MockAuthHandler is used in tests to reliably trigger edge cases.
class HttpAuthHandlerMock : public HttpAuthHandler {
public:
+ enum class State {
+ WAIT_FOR_INIT,
+ WAIT_FOR_CHALLENGE,
+ WAIT_FOR_GENERATE_AUTH_TOKEN,
+ TOKEN_PENDING,
+ DONE
+ };
+
enum Resolve {
RESOLVE_INIT,
RESOLVE_SKIP,
@@ -88,6 +97,8 @@ class HttpAuthHandlerMock : public HttpAuthHandler {
return request_url_;
}
+ const State state() const { return state_; }
+
// HttpAuthHandler:
HttpAuth::AuthorizationResult HandleAnotherChallenge(
HttpAuthChallengeTokenizer* challenge) override;
@@ -109,6 +120,7 @@ class HttpAuthHandlerMock : public HttpAuthHandler {
void OnGenerateAuthToken();
+ State state_;
Resolve resolve_;
CompletionCallback callback_;
bool generate_async_;
@@ -122,6 +134,8 @@ class HttpAuthHandlerMock : public HttpAuthHandler {
base::WeakPtrFactory<HttpAuthHandlerMock> weak_factory_;
};
+void PrintTo(const HttpAuthHandlerMock::State& state, ::std::ostream* os);
+
} // namespace net
#endif // NET_HTTP_HTTP_AUTH_HANDLER_MOCK_H_

Powered by Google App Engine
This is Rietveld 408576698