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

Unified Diff: google_apis/gaia/gaia_oauth_client_unittest.cc

Issue 2620373003: Reset pending request type on network error (Closed)
Patch Set: Created 3 years, 11 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 | « google_apis/gaia/gaia_oauth_client.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/gaia/gaia_oauth_client_unittest.cc
diff --git a/google_apis/gaia/gaia_oauth_client_unittest.cc b/google_apis/gaia/gaia_oauth_client_unittest.cc
index 0b73277c9864cad1f66a2a83a7fe1926516a914a..190f714e65c40b289b54b16a91afb64ad2043019 100644
--- a/google_apis/gaia/gaia_oauth_client_unittest.cc
+++ b/google_apis/gaia/gaia_oauth_client_unittest.cc
@@ -299,6 +299,26 @@ TEST_F(GaiaOAuthClientTest, GetTokensSuccess) {
auth.GetTokensFromAuthCode(client_info_, "auth_code", -1, &delegate);
}
+TEST_F(GaiaOAuthClientTest, GetTokensAfterNetworkFailure) {
+ int response_code = net::HTTP_INTERNAL_SERVER_ERROR;
+
+ MockGaiaOAuthClientDelegate failure_delegate;
+ EXPECT_CALL(failure_delegate, OnNetworkError(response_code)).Times(1);
+
+ MockGaiaOAuthClientDelegate success_delegate;
+ EXPECT_CALL(success_delegate, OnGetTokensResponse(kTestRefreshToken,
+ kTestAccessToken, kTestExpiresIn)).Times(1);
+
+ MockOAuthFetcherFactory factory;
+ factory.set_response_code(response_code);
+ factory.set_max_failure_count(4);
+ factory.set_results(kDummyGetTokensResult);
+
+ GaiaOAuthClient auth(GetRequestContext());
+ auth.GetTokensFromAuthCode(client_info_, "auth_code", 2, &failure_delegate);
+ auth.GetTokensFromAuthCode(client_info_, "auth_code", -1, &success_delegate);
+}
+
TEST_F(GaiaOAuthClientTest, RefreshTokenSuccess) {
MockGaiaOAuthClientDelegate delegate;
EXPECT_CALL(delegate, OnRefreshTokenResponse(kTestAccessToken,
« no previous file with comments | « google_apis/gaia/gaia_oauth_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698