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

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: unit tests Created 5 years, 10 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
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..c56f68b64108019c9d8c5bcf50ef2f9a8c7d03dd 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,38 @@ 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);
Roger Tawa OOO till Jul 10th 2015/03/09 14:41:57 Nit: does this fit on line 855?
Mike Lerman 2015/03/09 18:59:56 Yes!
+
+ 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);
+}

Powered by Google App Engine
This is Rietveld 408576698