Index: net/http/http_auth_sspi_win_unittest.cc |
diff --git a/net/http/http_auth_sspi_win_unittest.cc b/net/http/http_auth_sspi_win_unittest.cc |
index 586822d2ef774862c5317300a433813a90252e12..116258224fba9f18fb31510ef23a4be06c4ecb63 100644 |
--- a/net/http/http_auth_sspi_win_unittest.cc |
+++ b/net/http/http_auth_sspi_win_unittest.cc |
@@ -25,6 +25,12 @@ void MatchDomainUserAfterSplit(const std::wstring& combined, |
const ULONG kMaxTokenLength = 100; |
+void UnexpectedCallback(int result) { |
+ // At present getting tokens from gssapi is fully synchronous, so the callback |
+ // should never be called. |
+ ADD_FAILURE(); |
+} |
+ |
} // namespace |
TEST(HttpAuthSSPITest, SplitUserAndDomain) { |
@@ -57,97 +63,5 @@ TEST(HttpAuthSSPITest, DetermineMaxTokenLength_InvalidPackage) { |
EXPECT_EQ(100, max_token_length); |
} |
-TEST(HttpAuthSSPITest, ParseChallenge_FirstRound) { |
- // The first round should just consist of an unadorned "Negotiate" header. |
- MockSSPILibrary mock_library; |
- HttpAuthSSPI auth_sspi(&mock_library, "Negotiate", |
- NEGOSSP_NAME, kMaxTokenLength); |
- std::string challenge_text = "Negotiate"; |
- HttpAuthChallengeTokenizer challenge(challenge_text.begin(), |
- challenge_text.end()); |
- EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_ACCEPT, |
- auth_sspi.ParseChallenge(&challenge)); |
-} |
- |
-TEST(HttpAuthSSPITest, ParseChallenge_TwoRounds) { |
- // The first round should just have "Negotiate", and the second round should |
- // have a valid base64 token associated with it. |
- MockSSPILibrary mock_library; |
- HttpAuthSSPI auth_sspi(&mock_library, "Negotiate", |
- NEGOSSP_NAME, kMaxTokenLength); |
- std::string first_challenge_text = "Negotiate"; |
- HttpAuthChallengeTokenizer first_challenge(first_challenge_text.begin(), |
- first_challenge_text.end()); |
- EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_ACCEPT, |
- auth_sspi.ParseChallenge(&first_challenge)); |
- |
- // Generate an auth token and create another thing. |
- std::string auth_token; |
- EXPECT_EQ(OK, auth_sspi.GenerateAuthToken(NULL, "HTTP/intranet.google.com", |
- &auth_token)); |
- |
- std::string second_challenge_text = "Negotiate Zm9vYmFy"; |
- HttpAuthChallengeTokenizer second_challenge(second_challenge_text.begin(), |
- second_challenge_text.end()); |
- EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_ACCEPT, |
- auth_sspi.ParseChallenge(&second_challenge)); |
-} |
- |
-TEST(HttpAuthSSPITest, ParseChallenge_UnexpectedTokenFirstRound) { |
- // If the first round challenge has an additional authentication token, it |
- // should be treated as an invalid challenge from the server. |
- MockSSPILibrary mock_library; |
- HttpAuthSSPI auth_sspi(&mock_library, "Negotiate", |
- NEGOSSP_NAME, kMaxTokenLength); |
- std::string challenge_text = "Negotiate Zm9vYmFy"; |
- HttpAuthChallengeTokenizer challenge(challenge_text.begin(), |
- challenge_text.end()); |
- EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_INVALID, |
- auth_sspi.ParseChallenge(&challenge)); |
-} |
- |
-TEST(HttpAuthSSPITest, ParseChallenge_MissingTokenSecondRound) { |
- // If a later-round challenge is simply "Negotiate", it should be treated as |
- // an authentication challenge rejection from the server or proxy. |
- MockSSPILibrary mock_library; |
- HttpAuthSSPI auth_sspi(&mock_library, "Negotiate", |
- NEGOSSP_NAME, kMaxTokenLength); |
- std::string first_challenge_text = "Negotiate"; |
- HttpAuthChallengeTokenizer first_challenge(first_challenge_text.begin(), |
- first_challenge_text.end()); |
- EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_ACCEPT, |
- auth_sspi.ParseChallenge(&first_challenge)); |
- |
- std::string auth_token; |
- EXPECT_EQ(OK, auth_sspi.GenerateAuthToken(NULL, "HTTP/intranet.google.com", |
- &auth_token)); |
- std::string second_challenge_text = "Negotiate"; |
- HttpAuthChallengeTokenizer second_challenge(second_challenge_text.begin(), |
- second_challenge_text.end()); |
- EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_REJECT, |
- auth_sspi.ParseChallenge(&second_challenge)); |
-} |
- |
-TEST(HttpAuthSSPITest, ParseChallenge_NonBase64EncodedToken) { |
- // If a later-round challenge has an invalid base64 encoded token, it should |
- // be treated as an invalid challenge. |
- MockSSPILibrary mock_library; |
- HttpAuthSSPI auth_sspi(&mock_library, "Negotiate", |
- NEGOSSP_NAME, kMaxTokenLength); |
- std::string first_challenge_text = "Negotiate"; |
- HttpAuthChallengeTokenizer first_challenge(first_challenge_text.begin(), |
- first_challenge_text.end()); |
- EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_ACCEPT, |
- auth_sspi.ParseChallenge(&first_challenge)); |
- |
- std::string auth_token; |
- EXPECT_EQ(OK, auth_sspi.GenerateAuthToken(NULL, "HTTP/intranet.google.com", |
- &auth_token)); |
- std::string second_challenge_text = "Negotiate =happyjoy="; |
- HttpAuthChallengeTokenizer second_challenge(second_challenge_text.begin(), |
- second_challenge_text.end()); |
- EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_INVALID, |
- auth_sspi.ParseChallenge(&second_challenge)); |
-} |
} // namespace net |