Commit f2aad95f authored by Jérôme Lebel's avatar Jérôme Lebel Committed by Commit Bot

[iOS] Removing pre-unity code for SigninInteractionController

Removing pre-unity code for SigninInteractionController since the
unified consent feature flag is always on.

Bug: 951313
Change-Id: I1e406a996baefb79a2a2a60942ff322657b65673
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1793182
Auto-Submit: Jérôme Lebel <jlebel@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697948}
parent 7f3f876c
......@@ -13,7 +13,6 @@ source_set("signin_interaction") {
]
deps = [
"//base",
"//components//unified_consent",
"//components/prefs",
"//components/signin/public/identity_manager",
"//ios/chrome/browser",
......@@ -22,7 +21,6 @@ source_set("signin_interaction") {
"//ios/chrome/browser/ui/alert_coordinator",
"//ios/chrome/browser/ui/authentication",
"//ios/chrome/browser/ui/commands",
"//ios/chrome/browser/unified_consent",
"//ios/public/provider/chrome/browser",
"//ios/public/provider/chrome/browser/signin",
]
......@@ -39,7 +37,6 @@ source_set("eg_test_support") {
deps = [
"//base",
"//base/test:test_support",
"//components/unified_consent",
"//ios/chrome/app/strings",
"//ios/chrome/test/app:test_support",
"//ios/chrome/test/earl_grey:test_support",
......@@ -59,7 +56,6 @@ source_set("eg_tests") {
":eg_test_support",
"//base",
"//base/test:test_support",
"//components/unified_consent",
"//ios/chrome/app:app_internal",
"//ios/chrome/app/strings",
"//ios/chrome/browser",
......
......@@ -10,7 +10,6 @@
#include "components/prefs/pref_service.h"
#include "components/signin/public/base/signin_pref_names.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/unified_consent/feature.h"
#import "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/signin/authentication_service.h"
#include "ios/chrome/browser/signin/authentication_service_factory.h"
......@@ -103,34 +102,7 @@
(SigninInteractionControllerCompletionCallback)completion {
signin_metrics::LogSigninAccessPointStarted(accessPoint_, promoAction_);
completionCallback_ = [completion copy];
ios::ChromeIdentityService* identityService =
ios::GetChromeBrowserProvider()->GetChromeIdentityService();
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
[self showSigninViewControllerWithIdentity:identity identityAdded:NO];
} else if (identity) {
DCHECK(identityService->IsValidIdentity(identity));
DCHECK(!signinViewController_);
[self showSigninViewControllerWithIdentity:identity identityAdded:NO];
} else if (identityService->HasIdentities()) {
DCHECK(!signinViewController_);
[self showSigninViewControllerWithIdentity:nil identityAdded:NO];
} else {
identityInteractionManager_ =
identityService->CreateChromeIdentityInteractionManager(browserState_,
self);
if (!identityInteractionManager_) {
// Abort sign-in if the ChromeIdentityInteractionManager returned is
// nil (this can happen when the iOS internal provider is not used).
[self runCompletionCallbackWithSigninResult:SigninResultCanceled];
return;
}
__weak SigninInteractionController* weakSelf = self;
[identityInteractionManager_
addAccountWithCompletion:^(ChromeIdentity* identity, NSError* error) {
[weakSelf handleIdentityAdded:identity error:error shouldSignIn:YES];
}];
}
[self showSigninViewControllerWithIdentity:identity identityAdded:NO];
}
- (void)reAuthenticateWithCompletion:
......
......@@ -9,7 +9,6 @@
#include "base/strings/sys_string_conversions.h"
#import "base/test/ios/wait_util.h"
#include "base/test/scoped_feature_list.h"
#include "components/unified_consent/feature.h"
#import "ios/chrome/app/main_controller.h"
#include "ios/chrome/browser/system_flags.h"
#import "ios/chrome/browser/tabs/tab_model.h"
......@@ -164,13 +163,8 @@ void RemoveBrowsingData() {
// Wait until the next screen appears.
[SigninEarlGreyUI tapSettingsLink];
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
[[EarlGrey selectElementWithMatcher:SyncSettingsConfirmButton()]
performAction:grey_tap()];
} else {
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
}
[[EarlGrey selectElementWithMatcher:SyncSettingsConfirmButton()]
performAction:grey_tap()];
// All Settings should be gone and user signed in.
id<GREYMatcher> settings_matcher =
......@@ -205,8 +199,7 @@ void RemoveBrowsingData() {
// this will fail.
[ChromeEarlGreyUI openSettingsMenu];
[ChromeEarlGreyUI tapSettingsMenuButton:SecondarySignInButton()];
if (unified_consent::IsUnifiedConsentFeatureEnabled())
[SigninEarlGreyUI selectIdentityWithEmail:identity.userEmail];
[SigninEarlGreyUI selectIdentityWithEmail:identity.userEmail];
VerifyChromeSigninViewVisible();
......@@ -242,12 +235,10 @@ void RemoveBrowsingData() {
[[EarlGrey selectElementWithMatcher:SecondarySignInButton()]
performAction:grey_tap()];
[SigninEarlGreyUI selectIdentityWithEmail:identity1.userEmail];
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
// With unified consent, the authentication flow is only created when the
// confirm button is selected. Note that authentication flow actually
/// blocks as the "Clear Browsing Before Syncing" dialog is presented.
[SigninEarlGreyUI confirmSigninConfirmationDialog];
}
// The authentication flow is only created when the confirm button is
// selected. Note that authentication flow actually blocks as the
// "Clear Browsing Before Syncing" dialog is presented.
[SigninEarlGreyUI confirmSigninConfirmationDialog];
// Open new tab to cancel sign-in.
OpenNewTabCommand* command =
......@@ -261,8 +252,7 @@ void RemoveBrowsingData() {
// this will fail.
[ChromeEarlGreyUI openSettingsMenu];
[ChromeEarlGreyUI tapSettingsMenuButton:SecondarySignInButton()];
if (unified_consent::IsUnifiedConsentFeatureEnabled())
[SigninEarlGreyUI selectIdentityWithEmail:identity1.userEmail];
[SigninEarlGreyUI selectIdentityWithEmail:identity1.userEmail];
VerifyChromeSigninViewVisible();
// Close sign-in screen and Settings.
......@@ -286,8 +276,7 @@ void RemoveBrowsingData() {
[ChromeEarlGreyUI tapSettingsMenuButton:SecondarySignInButton()];
// Assert sign-in screen was shown.
if (unified_consent::IsUnifiedConsentFeatureEnabled())
[SigninEarlGreyUI selectIdentityWithEmail:identity.userEmail];
[SigninEarlGreyUI selectIdentityWithEmail:identity.userEmail];
VerifyChromeSigninViewVisible();
// Open new tab to cancel sign-in.
......@@ -303,8 +292,7 @@ void RemoveBrowsingData() {
[ChromeEarlGreyUI openToolsMenu];
[ChromeEarlGreyUI tapToolsMenuButton:chrome_test_util::BookmarksMenuButton()];
[ChromeEarlGreyUI tapSettingsMenuButton:SecondarySignInButton()];
if (unified_consent::IsUnifiedConsentFeatureEnabled())
[SigninEarlGreyUI selectIdentityWithEmail:identity.userEmail];
[SigninEarlGreyUI selectIdentityWithEmail:identity.userEmail];
VerifyChromeSigninViewVisible();
// Close sign-in screen and Bookmarks.
......
......@@ -5,7 +5,6 @@
#import "ios/chrome/browser/ui/signin_interaction/signin_interaction_controller_egtest_util.h"
#import "base/test/ios/wait_util.h"
#include "components/unified_consent/feature.h"
#include "ios/chrome/grit/ios_strings.h"
#import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h"
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
......@@ -31,9 +30,7 @@ void TapButtonWithLabelId(int message_id) {
void VerifyChromeSigninViewVisible() {
id<GREYMatcher> signin_matcher =
chrome_test_util::StaticTextWithAccessibilityLabelId(
unified_consent::IsUnifiedConsentFeatureEnabled()
? IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SYNC_SUBTITLE
: IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_DESCRIPTION);
IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SYNC_SUBTITLE);
[[EarlGrey selectElementWithMatcher:signin_matcher]
assertWithMatcher:grey_sufficientlyVisible()];
}
......
......@@ -7,7 +7,6 @@
#include "base/auto_reset.h"
#import "base/test/ios/wait_util.h"
#include "components/unified_consent/feature.h"
#import "ios/chrome/browser/ui/authentication/chrome_signin_view_controller.h"
#import "ios/chrome/browser/ui/authentication/signin_earl_grey_ui.h"
#import "ios/chrome/browser/ui/authentication/signin_earlgrey_utils.h"
......@@ -53,13 +52,6 @@ id<GREYMatcher> identityChooserButtonMatcherWithEmail(NSString* userEmail) {
@implementation SigninInteractionControllerUnityEnabledTestCase
- (void)setUp {
[super setUp];
CHECK(unified_consent::IsUnifiedConsentFeatureEnabled())
<< "This test suite must be run with Unified Consent feature enabled.";
}
// Tests the "ADD ACCOUNT" button in the identity chooser view controller.
- (void)testAddAccountAutomatically {
[ChromeEarlGreyUI openSettingsMenu];
......@@ -209,9 +201,7 @@ id<GREYMatcher> identityChooserButtonMatcherWithEmail(NSString* userEmail) {
// Open Add Account screen.
id<GREYMatcher> add_account_matcher =
chrome_test_util::StaticTextWithAccessibilityLabelId(
unified_consent::IsUnifiedConsentFeatureEnabled()
? IDS_IOS_ACCOUNT_IDENTITY_CHOOSER_ADD_ACCOUNT
: IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_ADD_ACCOUNT_BUTTON);
IDS_IOS_ACCOUNT_IDENTITY_CHOOSER_ADD_ACCOUNT);
[[EarlGrey selectElementWithMatcher:add_account_matcher]
performAction:grey_tap()];
[[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
......@@ -228,8 +218,7 @@ id<GREYMatcher> identityChooserButtonMatcherWithEmail(NSString* userEmail) {
// this will fail.
[ChromeEarlGreyUI openSettingsMenu];
[ChromeEarlGreyUI tapSettingsMenuButton:SecondarySignInButton()];
if (unified_consent::IsUnifiedConsentFeatureEnabled())
[SigninEarlGreyUI selectIdentityWithEmail:identity.userEmail];
[SigninEarlGreyUI selectIdentityWithEmail:identity.userEmail];
VerifyChromeSigninViewVisible();
// Close sign-in screen and Settings.
......
......@@ -6,7 +6,6 @@
#import "base/ios/block_types.h"
#include "base/logging.h"
#include "components/unified_consent/feature.h"
#import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h"
#import "ios/chrome/browser/ui/authentication/authentication_ui_util.h"
#import "ios/chrome/browser/ui/commands/application_commands.h"
......@@ -261,31 +260,14 @@
self.topViewController = nil;
self.alertCoordinator = nil;
if (signinResult == SigninResultSignedInnAndOpennSettings) {
[self showAccountsSettings];
} else {
[self signinDoneWithSuccess:signinResult != SigninResultCanceled];
}
}
// Shows the accounts settings UI.
- (void)showAccountsSettings {
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
[self showAdvancedSigninSettings];
} else {
// The presenting view controller needs to be saved before calling
// -[SigninInteractionCoordinator signinDoneWithSuccess:].
// That method finishes the sign-in and cleans up the coordinator (and
// removes presenting view controller).
UIViewController* presentingViewController = self.presentingViewController;
[self signinDoneWithSuccess:YES];
[self.dispatcher
showAccountsSettingsFromViewController:presentingViewController];
[self signinDoneWithSuccess:signinResult != SigninResultCanceled];
}
}
// Shows the advanced sign-in settings UI.
- (void)showAdvancedSigninSettings {
DCHECK(unified_consent::IsUnifiedConsentFeatureEnabled());
DCHECK(!self.advancedSigninSettingsCoordinator);
DCHECK(self.presentingViewController);
self.advancedSigninSettingsCoordinator =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment