[iOS] Cleanup: Delete signin::GetPrimaryIdentitySigninState()
It was unused, apart from its own unit tests.
Bug: 40066949
Change-Id: Ic65de8aa22b7b11035582346bbacf6eba26da76d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6361494
Reviewed-by: Arthur Milchior <arthurmilchior@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1433518}
diff --git a/ios/chrome/browser/authentication/ui_bundled/signin/signin_utils.h b/ios/chrome/browser/authentication/ui_bundled/signin/signin_utils.h
index 25d453a..d56dbf01 100644
--- a/ios/chrome/browser/authentication/ui_bundled/signin/signin_utils.h
+++ b/ios/chrome/browser/authentication/ui_bundled/signin/signin_utils.h
@@ -62,9 +62,6 @@
ChromeAccountManagerService* account_manager_service,
const base::Version& current_version);
-// Returns the current sign-in state of primary identity.
-IdentitySigninState GetPrimaryIdentitySigninState(ProfileIOS* profile);
-
// Converts a SystemIdentityCapabilityResult to a Tribool.
Tribool TriboolFromCapabilityResult(SystemIdentityCapabilityResult result);
diff --git a/ios/chrome/browser/authentication/ui_bundled/signin/signin_utils.mm b/ios/chrome/browser/authentication/ui_bundled/signin/signin_utils.mm
index e4924e4..8c37348 100644
--- a/ios/chrome/browser/authentication/ui_bundled/signin/signin_utils.mm
+++ b/ios/chrome/browser/authentication/ui_bundled/signin/signin_utils.mm
@@ -372,22 +372,6 @@
[defaults setInteger:display_count forKey:kSigninPromoViewDisplayCountKey];
}
-IdentitySigninState GetPrimaryIdentitySigninState(ProfileIOS* profile) {
- AuthenticationService* auth_service =
- AuthenticationServiceFactory::GetForProfile(profile);
- syncer::SyncService* syncService = SyncServiceFactory::GetForProfile(profile);
- // TODO(crbug.com/40066949): After phase 3 migration of kSync users, Remove
- // this usage.
- if (auth_service->HasPrimaryIdentity(signin::ConsentLevel::kSync) &&
- syncService->GetUserSettings()->IsInitialSyncFeatureSetupComplete()) {
- return IdentitySigninStateSignedInWithSyncEnabled;
- } else if (auth_service->HasPrimaryIdentity(signin::ConsentLevel::kSignin)) {
- return IdentitySigninStateSignedInWithSyncDisabled;
- } else {
- return IdentitySigninStateSignedOut;
- }
-}
-
Tribool TriboolFromCapabilityResult(SystemIdentityCapabilityResult result) {
switch (result) {
case SystemIdentityCapabilityResult::kTrue:
diff --git a/ios/chrome/browser/authentication/ui_bundled/signin/signin_utils_unittest.mm b/ios/chrome/browser/authentication/ui_bundled/signin/signin_utils_unittest.mm
index a182d513..e78bd851 100644
--- a/ios/chrome/browser/authentication/ui_bundled/signin/signin_utils_unittest.mm
+++ b/ios/chrome/browser/authentication/ui_bundled/signin/signin_utils_unittest.mm
@@ -451,50 +451,4 @@
signin::ShouldPresentUserSigninUpgrade(profile_.get(), version_3_0));
}
-// signin::GetPrimaryIdentitySigninState for a signed-out user should
-// return the signed out state.
-TEST_F(SigninUtilsTest, TestGetPrimaryIdentitySigninStateSignedOut) {
- IdentitySigninState state =
- signin::GetPrimaryIdentitySigninState(profile_.get());
- EXPECT_EQ(IdentitySigninStateSignedOut, state);
-}
-
-// signin::GetPrimaryIdentitySigninState for a signed-in user should
-// return the signed-in, sync disabled state.
-TEST_F(SigninUtilsTest, TestGetPrimaryIdentitySigninStateSignedInSyncDisabled) {
- FakeSystemIdentity* identity = [FakeSystemIdentity fakeIdentity1];
- fake_system_identity_manager()->AddIdentity(identity);
- AuthenticationService* authentication_service =
- AuthenticationServiceFactory::GetForProfile(profile_.get());
- authentication_service->SignIn(identity,
- signin_metrics::AccessPoint::kUnknown);
-
- IdentitySigninState state =
- signin::GetPrimaryIdentitySigninState(profile_.get());
- EXPECT_EQ(IdentitySigninStateSignedInWithSyncDisabled, state);
-}
-
-// signin::GetPrimaryIdentitySigninState for a syncing user who has
-// completed the sync setup should return the signed-in, sync enabled state.
-TEST_F(SigninUtilsTest,
- TestGetPrimaryIdentitySigninStateSyncGrantedSetupComplete) {
- FakeSystemIdentity* identity = [FakeSystemIdentity fakeIdentity1];
- fake_system_identity_manager()->AddIdentity(identity);
- AuthenticationService* authentication_service =
- AuthenticationServiceFactory::GetForProfile(profile_.get());
- authentication_service->SignIn(identity,
- signin_metrics::AccessPoint::kSigninPromo);
- authentication_service->GrantSyncConsent(
- identity, signin_metrics::AccessPoint::kSigninPromo);
- profile_->GetPrefs()->SetBoolean(
- syncer::prefs::internal::kSyncInitialSyncFeatureSetupComplete, true);
-
- IdentitySigninState state =
- signin::GetPrimaryIdentitySigninState(profile_.get());
- EXPECT_EQ(IdentitySigninStateSignedInWithSyncEnabled, state);
-
- profile_->GetPrefs()->ClearPref(
- syncer::prefs::internal::kSyncInitialSyncFeatureSetupComplete);
-}
-
} // namespace