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

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

Issue 5678003: Merge 68104 - [ChromeOS] Make GaiaAutheFetcher parsing logic default to servi... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/597/src/
Patch Set: Created 10 years 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 | « chrome/common/net/gaia/gaia_auth_fetcher.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc
===================================================================
--- chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc (revision 68762)
+++ chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc (working copy)
@@ -159,7 +159,7 @@
TEST_F(GaiaAuthFetcherTest, LoginDenied) {
- std::string data("Error: NO!");
+ std::string data("Error=BadAuthentication");
URLRequestStatus status(URLRequestStatus::SUCCESS, 0);
GoogleServiceAuthError expected_error(
@@ -314,6 +314,22 @@
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";
« no previous file with comments | « 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