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

Unified Diff: google_apis/gaia/gaia_oauth_client_unittest.cc

Issue 993103002: Add tokeninfo call with token identified by token_handle parameter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 5 years, 9 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 a828bebbc4dff00e5f943add394c9bb7822db488..6197b894a9003054d57c33bfc99c76ae79db2838 100644
--- a/google_apis/gaia/gaia_oauth_client_unittest.cc
+++ b/google_apis/gaia/gaia_oauth_client_unittest.cc
@@ -127,6 +127,7 @@ class MockOAuthFetcherFactory : public net::URLFetcherFactory,
};
const std::string kTestAccessToken = "1/fFAGRNJru1FTz70BzhT3Zg";
+const std::string kTestAccessTokenHandle = "1/kjhH87dfgkj87Hhj5KJkjZ";
const std::string kTestRefreshToken =
"1/6BMfW9j53gdGImsixUH6kU5RsR4zwI9lUVX-tqf8JXQ";
const std::string kTestUserEmail = "a_user@gmail.com";
@@ -165,7 +166,12 @@ const std::string kDummyTokenInfoResult =
"\"audience\": \"1234567890.apps.googleusercontent.com\","
"\"scope\": \"https://googleapis.com/oauth2/v2/tokeninfo\","
"\"expires_in\":" + base::IntToString(kTestExpiresIn) + "}";
-}
+
+const std::string kDummyTokenHandleInfoResult =
+ "{\"audience\": \"1234567890.apps.googleusercontent.com\","
+ "\"expires_in\":" + base::IntToString(kTestExpiresIn) + "}";
+
+} // namespace
namespace gaia {
@@ -381,11 +387,29 @@ TEST_F(GaiaOAuthClientTest, GetTokenInfo) {
factory.set_results(kDummyTokenInfoResult);
GaiaOAuthClient auth(GetRequestContext());
- auth.GetTokenInfo("access_token", 1, &delegate);
+ auth.GetTokenInfo("some_token", 1, &delegate);
std::string issued_to;
- ASSERT_TRUE(captured_result->GetString("issued_to", &issued_to));
+ ASSERT_TRUE(captured_result->GetString("issued_to", &issued_to));
ASSERT_EQ("1234567890.apps.googleusercontent.com", issued_to);
}
+TEST_F(GaiaOAuthClientTest, GetTokenHandleInfo) {
+ const base::DictionaryValue* captured_result;
+
+ MockGaiaOAuthClientDelegate delegate;
+ EXPECT_CALL(delegate, OnGetTokenInfoResponsePtr(_))
+ .WillOnce(SaveArg<0>(&captured_result));
+
+ MockOAuthFetcherFactory factory;
+ factory.set_results(kDummyTokenHandleInfoResult);
+
+ GaiaOAuthClient auth(GetRequestContext());
+ auth.GetTokenHandleInfo("some_handle", 1, &delegate);
+
+ std::string audience;
+ ASSERT_TRUE(captured_result->GetString("audience", &audience));
+ ASSERT_EQ("1234567890.apps.googleusercontent.com", audience);
+}
+
} // namespace gaia
« 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