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

Revert "[iOS] Dismiss views on top of Settings UI after authentication."

This reverts commit b2a6b60d.

Since this patch is introducing a bug, I need to revert this patch:
* sign-in
* open the settings
* open the account list
* open the add SSO account view
* cancel the SSO add account view
Result: the user can't do sign-out anymore.

Original change's description:
> [iOS] Dismiss views on top of Settings UI after authentication.
>
> Currently the sign out UI is dismissed conditionally when the
> authentication flow is complete. Remove the conditional since we expect
> the sign out UI every time authentication completes.
>
> Bug: 1125631
> Change-Id: Ide9805e5490377f9ec3cf5d3625622ab08e876a4
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2472005
> Commit-Queue: Nohemi Fernandez <fernandex@chromium.org>
> Reviewed-by: Jérôme Lebel <jlebel@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#817863}

TBR=jlebel@chromium.org,fernandex@chromium.org

Change-Id: I40270d09662e2ccd5d24b8915d540cb5cd28ae49
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1125631
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2480824Reviewed-by: default avatarJérôme Lebel <jlebel@chromium.org>
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#817990}
parent 4298ceaa
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
#error "This file requires ARC support." #error "This file requires ARC support."
#endif #endif
using chrome_test_util::AddAccountButton;
using chrome_test_util::ButtonWithAccessibilityLabel; using chrome_test_util::ButtonWithAccessibilityLabel;
using chrome_test_util::ButtonWithAccessibilityLabelId;
using chrome_test_util::PrimarySignInButton; using chrome_test_util::PrimarySignInButton;
using chrome_test_util::SettingsAccountButton; using chrome_test_util::SettingsAccountButton;
using chrome_test_util::SettingsDoneButton; using chrome_test_util::SettingsDoneButton;
...@@ -153,27 +153,6 @@ id<GREYMatcher> NoBookmarksLabel() { ...@@ -153,27 +153,6 @@ id<GREYMatcher> NoBookmarksLabel() {
performAction:grey_tap()]; performAction:grey_tap()];
} }
// Tests that the Settings screen is displayed after the user signs in through
// the add account flow from the account list screen entrypoint.
- (void)testSSOAddAccount {
FakeChromeIdentity* fakeIdentity = [SigninEarlGrey fakeIdentity1];
[SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity];
[ChromeEarlGreyUI openSettingsMenu];
[ChromeEarlGreyUI tapSettingsMenuButton:SettingsAccountButton()];
[[EarlGrey selectElementWithMatcher:AddAccountButton()]
performAction:grey_tap()];
[[EarlGrey
selectElementWithMatcher:grey_allOf(
ButtonWithAccessibilityLabel(@"Sign in"),
grey_sufficientlyVisible(), nil)]
performAction:grey_tap()];
[ChromeEarlGreyUI waitForAppToIdle];
[[EarlGrey selectElementWithMatcher:SettingsAccountButton()]
assertWithMatcher:grey_sufficientlyVisible()];
}
// Tests that the Account Settings screen is popped and the user signed out // Tests that the Account Settings screen is popped and the user signed out
// when the account is removed. // when the account is removed.
- (void)testSignOutOnRemoveAccount { - (void)testSignOutOnRemoveAccount {
......
...@@ -389,16 +389,9 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -389,16 +389,9 @@ typedef NS_ENUM(NSInteger, ItemType) {
- (void)onEndBatchOfRefreshTokenStateChanges { - (void)onEndBatchOfRefreshTokenStateChanges {
[self reloadData]; [self reloadData];
if (self.authService->IsAuthenticated() || [self popViewIfSignedOut];
_authenticationOperationInProgress) { if (![self authService] -> IsAuthenticated() &&
// The signed out state might be temporary (e.g. account switch, ...). _dimissAccountDetailsViewControllerBlock) {
// Don't pop this view based on intermediary values.
return;
}
[self dismissSelfAnimated:NO];
if (_dimissAccountDetailsViewControllerBlock) {
_dimissAccountDetailsViewControllerBlock(/*animated=*/YES); _dimissAccountDetailsViewControllerBlock(/*animated=*/YES);
_dimissAccountDetailsViewControllerBlock = nil; _dimissAccountDetailsViewControllerBlock = nil;
} }
...@@ -425,12 +418,8 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -425,12 +418,8 @@ typedef NS_ENUM(NSInteger, ItemType) {
} }
- (void)handleDidAddAccount:(BOOL)success { - (void)handleDidAddAccount:(BOOL)success {
if (!success) {
return;
}
[self handleAuthenticationOperationDidFinish]; [self handleAuthenticationOperationDidFinish];
if (_closeSettingsOnAddAccount) { if (success && _closeSettingsOnAddAccount) {
[self.dispatcher closeSettingsUI]; [self.dispatcher closeSettingsUI];
} }
} }
...@@ -580,10 +569,23 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -580,10 +569,23 @@ typedef NS_ENUM(NSInteger, ItemType) {
} }
} }
// Finishes the authentication flow and dismisses the accounts view. // Sets |_authenticationOperationInProgress| to NO and pops this accounts
// table view controller if the user is signed out.
- (void)handleAuthenticationOperationDidFinish { - (void)handleAuthenticationOperationDidFinish {
DCHECK(_authenticationOperationInProgress); DCHECK(_authenticationOperationInProgress);
_authenticationOperationInProgress = NO; _authenticationOperationInProgress = NO;
[self popViewIfSignedOut];
}
- (void)popViewIfSignedOut {
if ([self authService] -> IsAuthenticated()) {
return;
}
if (_authenticationOperationInProgress) {
// The signed out state might be temporary (e.g. account switch, ...).
// Don't pop this view based on intermediary values.
return;
}
[self dismissSelfAnimated:NO]; [self dismissSelfAnimated:NO];
} }
......
...@@ -125,12 +125,8 @@ ...@@ -125,12 +125,8 @@
} }
- (void)addAccountViewControllerDidTapSignIn { - (void)addAccountViewControllerDidTapSignIn {
// Fake sign-in is used to show a fake add an account screen. In this ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()
// case _fakeIdentity will be nil. ->AddIdentity(_fakeIdentity);
if (_fakeIdentity) {
ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()
->AddIdentity(_fakeIdentity);
}
[self dismissAndRunCompletionCallbackWithError:nil [self dismissAndRunCompletionCallbackWithError:nil
animated:YES animated:YES
completion:nil]; completion:nil];
......
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