Chromium Code Reviews| 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); |
| +} |