| Index: components/signin/ios/browser/profile_oauth2_token_service_ios_unittest.mm
|
| diff --git a/components/signin/ios/browser/profile_oauth2_token_service_ios_unittest.mm b/components/signin/ios/browser/profile_oauth2_token_service_ios_unittest.mm
|
| index cd3bf220ff2950ad906d8a678777fc7f417ee69c..8668b29a57170147d70bad596dc5cc3c4a4e0c1c 100644
|
| --- a/components/signin/ios/browser/profile_oauth2_token_service_ios_unittest.mm
|
| +++ b/components/signin/ios/browser/profile_oauth2_token_service_ios_unittest.mm
|
| @@ -32,7 +32,6 @@ class ProfileOAuth2TokenServiceIOSTest : public testing::Test,
|
| net::HTTP_OK,
|
| net::URLRequestStatus::SUCCESS);
|
| fake_provider_ = client_.GetIOSProviderAsFake();
|
| - fake_provider_->set_using_shared_authentication(true);
|
| oauth2_service_.Initialize(&client_);
|
| oauth2_service_.AddObserver(this);
|
| }
|
| @@ -197,80 +196,3 @@ TEST_F(ProfileOAuth2TokenServiceIOSTest, StartRequestFailure) {
|
| EXPECT_EQ(0, access_token_success_);
|
| EXPECT_EQ(1, access_token_failure_);
|
| }
|
| -
|
| -TEST_F(ProfileOAuth2TokenServiceIOSTest, Migration) {
|
| - fake_provider_->set_using_shared_authentication(false);
|
| - oauth2_service_.LoadCredentials("account_id_1");
|
| - base::RunLoop().RunUntilIdle();
|
| -
|
| - ResetObserverCounts();
|
| - oauth2_service_.UpdateCredentials("account_id_1", "pre_sso_refresh_token_1");
|
| - oauth2_service_.UpdateCredentials("account_id_2", "pre_sso_refresh_token_2");
|
| - EXPECT_EQ(2, token_available_count_);
|
| - EXPECT_EQ(0, tokens_loaded_count_);
|
| - EXPECT_EQ(0, token_revoked_count_);
|
| - EXPECT_EQ(2U, oauth2_service_.GetAccounts().size());
|
| - EXPECT_TRUE(oauth2_service_.RefreshTokenIsAvailable("account_id_1"));
|
| - EXPECT_TRUE(oauth2_service_.RefreshTokenIsAvailable("account_id_2"));
|
| - EXPECT_EQ("pre_sso_refresh_token_1",
|
| - oauth2_service_.GetRefreshTokenWhenNotUsingSharedAuthentication(
|
| - "account_id_1"));
|
| - EXPECT_EQ("pre_sso_refresh_token_2",
|
| - oauth2_service_.GetRefreshTokenWhenNotUsingSharedAuthentication(
|
| - "account_id_2"));
|
| -
|
| - ResetObserverCounts();
|
| - oauth2_service_.StartUsingSharedAuthentication();
|
| - EXPECT_EQ(0, token_available_count_);
|
| - EXPECT_EQ(0, tokens_loaded_count_);
|
| - EXPECT_EQ(2, token_revoked_count_);
|
| - EXPECT_EQ(0U, oauth2_service_.GetAccounts().size());
|
| - EXPECT_FALSE(oauth2_service_.RefreshTokenIsAvailable("account_id_1"));
|
| - EXPECT_FALSE(oauth2_service_.RefreshTokenIsAvailable("account_id_2"));
|
| -
|
| - ResetObserverCounts();
|
| - fake_provider_->AddAccount("account_id_1");
|
| - oauth2_service_.ReloadCredentials();
|
| - EXPECT_EQ(1, token_available_count_);
|
| - EXPECT_EQ(0, tokens_loaded_count_);
|
| - EXPECT_EQ(0, token_revoked_count_);
|
| - EXPECT_EQ(1U, oauth2_service_.GetAccounts().size());
|
| - EXPECT_TRUE(oauth2_service_.RefreshTokenIsAvailable("account_id_1"));
|
| - EXPECT_FALSE(oauth2_service_.RefreshTokenIsAvailable("account_id_2"));
|
| -}
|
| -
|
| -TEST_F(ProfileOAuth2TokenServiceIOSTest, ForceInvalidGrantResponses) {
|
| - fake_provider_->set_using_shared_authentication(false);
|
| - oauth2_service_.LoadCredentials("account_id_1");
|
| - base::RunLoop().RunUntilIdle();
|
| - oauth2_service_.UpdateCredentials("account_id_1", "pre_sso_refresh_token_1");
|
| - EXPECT_TRUE(oauth2_service_.RefreshTokenIsAvailable("account_id_1"));
|
| -
|
| - // First call revokes the existing token and then updates the credentials
|
| - // with a fake token.
|
| - ResetObserverCounts();
|
| - oauth2_service_.ForceInvalidGrantResponses();
|
| - EXPECT_EQ(1, token_available_count_);
|
| - EXPECT_EQ(0, tokens_loaded_count_);
|
| - EXPECT_EQ(1, token_revoked_count_);
|
| - EXPECT_TRUE(oauth2_service_.RefreshTokenIsAvailable("account_id_1"));
|
| -
|
| - // Fetching access tokens fails with invalid grant responses.
|
| - OAuth2TokenService::ScopeSet scopes;
|
| - scopes.insert("scope");
|
| - scoped_ptr<OAuth2TokenService::Request> request(
|
| - oauth2_service_.StartRequest("account_id_1", scopes, this));
|
| - base::RunLoop().RunUntilIdle();
|
| - EXPECT_EQ(0, access_token_success_);
|
| - EXPECT_EQ(1, access_token_failure_);
|
| - EXPECT_EQ(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS,
|
| - last_access_token_error_.state());
|
| -
|
| - // Second call to force invalid grant responses is ignored.
|
| - ResetObserverCounts();
|
| - oauth2_service_.ForceInvalidGrantResponses();
|
| - EXPECT_EQ(0, token_available_count_);
|
| - EXPECT_EQ(0, tokens_loaded_count_);
|
| - EXPECT_EQ(0, token_revoked_count_);
|
| - EXPECT_TRUE(oauth2_service_.RefreshTokenIsAvailable("account_id_1"));
|
| -}
|
|
|