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

Unified Diff: components/signin/ios/browser/profile_oauth2_token_service_ios_unittest.mm

Issue 489113003: Remove MutableProfileOAuth2TokenService on iOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove DCHECK(getter). Created 6 years, 4 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: 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"));
-}
« no previous file with comments | « components/signin/ios/browser/profile_oauth2_token_service_ios.mm ('k') | google_apis/gaia/oauth2_token_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698