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

Unified Diff: net/http/http_auth_controller_unittest.cc

Issue 10916272: Remove HttpAuth::Scheme enum in favor of a string. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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_controller.cc ('k') | net/http/http_auth_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_auth_controller_unittest.cc
diff --git a/net/http/http_auth_controller_unittest.cc b/net/http/http_auth_controller_unittest.cc
index a50d767f21f47928f928cbb9d743183ece089383..61d6c5c46e9c068dad986f2b05204d30f2273e6f 100644
--- a/net/http/http_auth_controller_unittest.cc
+++ b/net/http/http_auth_controller_unittest.cc
@@ -85,7 +85,7 @@ void RunSingleRoundAuthTest(HandlerRunMode run_mode,
if (run_mode == RUN_HANDLER_ASYNC)
EXPECT_EQ(expected_controller_rv, callback.WaitForResult());
EXPECT_EQ((scheme_state == SCHEME_IS_DISABLED),
- controller->IsAuthSchemeDisabled(HttpAuth::AUTH_SCHEME_MOCK));
+ controller->IsAuthSchemeDisabled("mock"));
}
} // namespace
@@ -121,7 +121,7 @@ TEST(HttpAuthControllerTest, NoExplicitCredentialsAllowed) {
// Modified mock HttpAuthHandler for this test.
class MockHandler : public HttpAuthHandlerMock {
public:
- MockHandler(int expected_rv, HttpAuth::Scheme scheme)
+ MockHandler(int expected_rv, const std::string& scheme)
: expected_scheme_(scheme) {
SetGenerateExpectation(false, expected_rv);
}
@@ -134,7 +134,7 @@ TEST(HttpAuthControllerTest, NoExplicitCredentialsAllowed) {
set_connection_based(true);
// Pretend to be SCHEME_BASIC so we can test failover logic.
if (challenge->scheme() == "Basic") {
- auth_scheme_ = HttpAuth::AUTH_SCHEME_BASIC;
+ auth_scheme_ = "basic";
--score_; // Reduce score, so we rank below Mock.
set_allows_explicit_credentials(true);
}
@@ -157,7 +157,7 @@ TEST(HttpAuthControllerTest, NoExplicitCredentialsAllowed) {
}
private:
- HttpAuth::Scheme expected_scheme_;
+ std::string expected_scheme_;
};
BoundNetLog dummy_log;
@@ -178,29 +178,29 @@ TEST(HttpAuthControllerTest, NoExplicitCredentialsAllowed) {
// Handlers for the first attempt at authentication. AUTH_SCHEME_MOCK handler
// accepts the default identity and successfully constructs a token.
auth_handler_factory.AddMockHandler(
- new MockHandler(OK, HttpAuth::AUTH_SCHEME_MOCK), HttpAuth::AUTH_SERVER);
+ new MockHandler(OK, "mock"), HttpAuth::AUTH_SERVER);
auth_handler_factory.AddMockHandler(
- new MockHandler(ERR_UNEXPECTED, HttpAuth::AUTH_SCHEME_BASIC),
+ new MockHandler(ERR_UNEXPECTED, "basic"),
HttpAuth::AUTH_SERVER);
// Handlers for the second attempt. Neither should be used to generate a
// token. Instead the controller should realize that there are no viable
// identities to use with the AUTH_SCHEME_MOCK handler and fail.
auth_handler_factory.AddMockHandler(
- new MockHandler(ERR_UNEXPECTED, HttpAuth::AUTH_SCHEME_MOCK),
+ new MockHandler(ERR_UNEXPECTED, "mock"),
HttpAuth::AUTH_SERVER);
auth_handler_factory.AddMockHandler(
- new MockHandler(ERR_UNEXPECTED, HttpAuth::AUTH_SCHEME_BASIC),
+ new MockHandler(ERR_UNEXPECTED, "basic"),
HttpAuth::AUTH_SERVER);
// Fallback handlers for the second attempt. The AUTH_SCHEME_MOCK handler
// should be discarded due to the disabled scheme, and the AUTH_SCHEME_BASIC
// handler should successfully be used to generate a token.
auth_handler_factory.AddMockHandler(
- new MockHandler(ERR_UNEXPECTED, HttpAuth::AUTH_SCHEME_MOCK),
+ new MockHandler(ERR_UNEXPECTED, "mock"),
HttpAuth::AUTH_SERVER);
auth_handler_factory.AddMockHandler(
- new MockHandler(OK, HttpAuth::AUTH_SCHEME_BASIC),
+ new MockHandler(OK, "basic"),
HttpAuth::AUTH_SERVER);
auth_handler_factory.set_do_init_from_challenge(true);
@@ -226,8 +226,8 @@ TEST(HttpAuthControllerTest, NoExplicitCredentialsAllowed) {
ASSERT_TRUE(controller->HaveAuthHandler());
controller->ResetAuth(AuthCredentials(ASCIIToUTF16("Hello"), string16()));
EXPECT_TRUE(controller->HaveAuth());
- EXPECT_TRUE(controller->IsAuthSchemeDisabled(HttpAuth::AUTH_SCHEME_MOCK));
- EXPECT_FALSE(controller->IsAuthSchemeDisabled(HttpAuth::AUTH_SCHEME_BASIC));
+ EXPECT_TRUE(controller->IsAuthSchemeDisabled("mock"));
+ EXPECT_FALSE(controller->IsAuthSchemeDisabled("basic"));
// Should only succeed if we are using the AUTH_SCHEME_BASIC MockHandler.
EXPECT_EQ(OK, controller->MaybeGenerateAuthToken(
« no previous file with comments | « net/http/http_auth_controller.cc ('k') | net/http/http_auth_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698