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

Unified Diff: chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc

Issue 5309007: [ChromeOS] Make GaiaAutheFetcher parsing logic default to service_unavailable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 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: chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc
diff --git a/chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc b/chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc
index 47df6b7d7d7fe5db1ae98355dcb28dd880e52b3c..be42c583c08d071418c6a22d61546a9d2f25bc19 100644
--- a/chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc
+++ b/chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc
@@ -157,7 +157,7 @@ TEST_F(GaiaAuthFetcherTest, TokenNetFailure) {
TEST_F(GaiaAuthFetcherTest, LoginDenied) {
- std::string data("Error: NO!");
+ std::string data("Error=BadAuthentication");
URLRequestStatus status(URLRequestStatus::SUCCESS, 0);
GoogleServiceAuthError expected_error(
@@ -312,6 +312,22 @@ TEST_F(GaiaAuthFetcherTest, AccountDisabledError) {
EXPECT_EQ(error.state(), GoogleServiceAuthError::ACCOUNT_DISABLED);
}
+TEST_F(GaiaAuthFetcherTest,BadAuthenticationError) {
+ URLRequestStatus status(URLRequestStatus::SUCCESS, 0);
+ std::string data = "Error=BadAuthentication\n";
+ GoogleServiceAuthError error =
+ GaiaAuthFetcher::GenerateAuthError(data, status);
+ EXPECT_EQ(error.state(), GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
+}
+
+TEST_F(GaiaAuthFetcherTest,IncomprehensibleError) {
+ URLRequestStatus status(URLRequestStatus::SUCCESS, 0);
+ std::string data = "Error=Gobbledygook\n";
+ GoogleServiceAuthError error =
+ GaiaAuthFetcher::GenerateAuthError(data, status);
+ EXPECT_EQ(error.state(), GoogleServiceAuthError::SERVICE_UNAVAILABLE);
+}
+
TEST_F(GaiaAuthFetcherTest,ServiceUnavailableError) {
URLRequestStatus status(URLRequestStatus::SUCCESS, 0);
std::string data = "Error=ServiceUnavailable\n";
« chrome/common/net/gaia/gaia_auth_fetcher.cc ('K') | « chrome/common/net/gaia/gaia_auth_fetcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698