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

Unified Diff: google_apis/gaia/gaia_auth_fetcher_unittest.cc

Issue 973953002: Implement the calls to GAIA for the IDP IFrame protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Roger and Guibin's nits and 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_auth_fetcher.cc ('k') | google_apis/gaia/gaia_urls.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/gaia/gaia_auth_fetcher_unittest.cc
diff --git a/google_apis/gaia/gaia_auth_fetcher_unittest.cc b/google_apis/gaia/gaia_auth_fetcher_unittest.cc
index 366849063a8f5796f6106e873bea00cce61f9173..9676e673655e9fbe611d7bbb567993fa3d78b968 100644
--- a/google_apis/gaia/gaia_auth_fetcher_unittest.cc
+++ b/google_apis/gaia/gaia_auth_fetcher_unittest.cc
@@ -189,6 +189,9 @@ class MockGaiaConsumer : public GaiaAuthConsumer {
const GoogleServiceAuthError& error));
MOCK_METHOD1(OnListAccountsSuccess, void(const std::string& data));
MOCK_METHOD1(OnGetCheckConnectionInfoSuccess, void(const std::string& data));
+ MOCK_METHOD1(OnListIdpSessionsSuccess, void(const std::string& data));
+ MOCK_METHOD1(OnGetTokenResponseSuccess,
+ void(const GaiaAuthConsumer::ClientOAuthResult& result));
};
#if defined(OS_WIN)
@@ -827,3 +830,37 @@ TEST_F(GaiaAuthFetcherTest, GetCheckConnectionInfo) {
status, net::HTTP_OK, cookies_, data, net::URLFetcher::GET, &auth);
auth.OnURLFetchComplete(&mock_fetcher);
}
+
+TEST_F(GaiaAuthFetcherTest, ListIDPSessions) {
+ std::string data("{\"sessions\":[{\"login_hint\":\"abcdefghijklmnop\"}]}");
+ MockGaiaConsumer consumer;
+ EXPECT_CALL(consumer, OnListIdpSessionsSuccess("abcdefghijklmnop")).Times(1);
+
+ GaiaAuthFetcher auth(&consumer, std::string(), GetRequestContext());
+ auth.StartListIDPSessions(std::string(), std::string());
+
+ net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0);
+ MockFetcher mock_fetcher(
+ GaiaUrls::GetInstance()->oauth2_iframe_url(),
+ status, net::HTTP_OK, cookies_, data, net::URLFetcher::GET, &auth);
+ auth.OnURLFetchComplete(&mock_fetcher);
+}
+
+TEST_F(GaiaAuthFetcherTest, GetTokenResponse) {
+ MockGaiaConsumer consumer;
+ EXPECT_CALL(consumer,
+ OnGetTokenResponseSuccess(
+ GaiaAuthConsumer::ClientOAuthResult(std::string(),
+ "at1",
+ 3600))).Times(1);
+
+ GaiaAuthFetcher auth(&consumer, std::string(), GetRequestContext());
+ auth.StartGetTokenResponse(std::string(), std::string(), std::string());
+
+ net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0);
+ MockFetcher mock_fetcher(
+ GaiaUrls::GetInstance()->oauth2_iframe_url(),
+ status, net::HTTP_OK, cookies_, kGetTokenPairValidResponse,
+ net::URLFetcher::GET, &auth);
+ auth.OnURLFetchComplete(&mock_fetcher);
+}
« no previous file with comments | « google_apis/gaia/gaia_auth_fetcher.cc ('k') | google_apis/gaia/gaia_urls.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698