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

Unified Diff: net/http/http_auth_handler_basic_unittest.cc

Issue 6525035: Invalidate credentials if the server rejects them. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Defer browser tests to another CL Created 9 years, 10 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
Index: net/http/http_auth_handler_basic_unittest.cc
diff --git a/net/http/http_auth_handler_basic_unittest.cc b/net/http/http_auth_handler_basic_unittest.cc
index f2ddbebc9a6c3d5a716cadf3910879112e51c8fd..0150579826ff8f020980480d81c378105c068db8 100644
--- a/net/http/http_auth_handler_basic_unittest.cc
+++ b/net/http/http_auth_handler_basic_unittest.cc
@@ -46,6 +46,25 @@ TEST(HttpAuthHandlerBasicTest, GenerateAuthToken) {
}
}
+TEST(HttpAuthHandlerBasicTest, HandleAnotherChallenge) {
+ GURL origin("http://www.example.com");
+ std::string challenge1 = "Basic realm=\"First\"";
+ std::string challenge2 = "Basic realm=\"Second\"";
+ HttpAuthHandlerBasic::Factory factory;
+ scoped_ptr<HttpAuthHandler> basic;
+ EXPECT_EQ(OK, factory.CreateAuthHandlerFromString(
+ challenge1, HttpAuth::AUTH_SERVER, origin, BoundNetLog(), &basic));
+ HttpAuth::ChallengeTokenizer tok_first(challenge1.begin(),
+ challenge1.end());
+ EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_REJECT,
+ basic->HandleAnotherChallenge(&tok_first));
+
+ HttpAuth::ChallengeTokenizer tok_second(challenge2.begin(),
+ challenge2.end());
+ EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_DIFFERENT_REALM,
+ basic->HandleAnotherChallenge(&tok_second));
+}
+
TEST(HttpAuthHandlerBasicTest, InitFromChallenge) {
static const struct {
const char* challenge;

Powered by Google App Engine
This is Rietveld 408576698