Commit 7a934999 authored by Eric Aleshire's avatar Eric Aleshire Committed by Commit Bot

Remove CHROME_EG_ASSERT_NO_ERROR macro from callers of SignInEarlGreyUtils.

Bug: 963613
Change-Id: I05a043cd5d1788b53e38a5b9a51bc5da08ba7290
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1668312Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Commit-Queue: Eugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#671484}
parent debd12e2
......@@ -25,7 +25,6 @@
#import "ios/chrome/test/earl_grey/chrome_actions.h"
#import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
#import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h"
#import "ios/chrome/test/earl_grey/chrome_error_util.h"
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/public/provider/chrome/browser/signin/fake_chrome_identity.h"
......@@ -189,7 +188,7 @@ void SignOut() {
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
CHROME_EG_ASSERT_NO_ERROR([SigninEarlGreyUtils checkSignedOut]);
[SigninEarlGreyUtils checkSignedOut];
}
} // namespace
......
......@@ -66,9 +66,7 @@ using chrome_test_util::UnifiedConsentAddAccountButton;
[self confirmSigninConfirmationDialog];
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
NSError* signedInError =
[SigninEarlGreyUtils checkSignedInWithIdentity:identity];
GREYAssertNil(signedInError, signedInError.localizedDescription);
[SigninEarlGreyUtils checkSignedInWithIdentity:identity];
}
+ (void)selectIdentityWithEmail:(NSString*)userEmail {
......
......@@ -28,12 +28,11 @@
// Returns a fake managed identity.
- (ChromeIdentity*)fakeManagedIdentity;
// Checks that |identity| is actually signed in to the active profile.
- (NSError*)checkSignedInWithIdentity:(ChromeIdentity*)identity
WARN_UNUSED_RESULT;
// Induces a GREYAssert if |identity| is not signed in to the active profile.
- (void)checkSignedInWithIdentity:(ChromeIdentity*)identity;
// Checks that no identity is signed in.
- (NSError*)checkSignedOut WARN_UNUSED_RESULT;
// Induces a GREYAssert if an identity is signed in.
- (void)checkSignedOut;
@end
......
......@@ -37,7 +37,7 @@ GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(SigninEarlGreyUtilsAppInterface)
name:@"Fake Managed"];
}
- (NSError*)checkSignedInWithIdentity:(ChromeIdentity*)identity {
- (void)checkSignedInWithIdentity:(ChromeIdentity*)identity {
BOOL identityIsNonNil = identity != nil;
EG_TEST_HELPER_ASSERT_TRUE(identityIsNonNil, @"Need to give an identity");
......@@ -55,11 +55,9 @@ GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(SigninEarlGreyUtilsAppInterface)
identity.gaiaID, primaryAccountGaiaID];
EG_TEST_HELPER_ASSERT_TRUE(
[identity.gaiaID isEqualToString:primaryAccountGaiaID], errorStr);
return nil;
}
- (NSError*)checkSignedOut {
- (void)checkSignedOut {
// Required to avoid any problem since the following test is not dependant to
// UI, and the previous action has to be totally finished before going through
// the assert.
......@@ -67,8 +65,6 @@ GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(SigninEarlGreyUtilsAppInterface)
EG_TEST_HELPER_ASSERT_TRUE([SignInEarlGreyUtilsAppInterface isSignedOut],
@"Unexpected signed in user");
return nil;
}
@end
......@@ -26,7 +26,6 @@
#include "ios/chrome/grit/ios_chromium_strings.h"
#include "ios/chrome/grit/ios_strings.h"
#import "ios/chrome/test/app/chrome_test_util.h"
#import "ios/chrome/test/earl_grey/chrome_error_util.h"
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/public/provider/chrome/browser/signin/fake_chrome_identity.h"
......@@ -218,8 +217,7 @@ id<GREYMatcher> UndoAccountConsistencyButton() {
[[EarlGrey selectElementWithMatcher:AccountConsistencySetupSigninButton()]
performAction:grey_tap()];
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity]);
[SigninEarlGreyUtils checkSignedInWithIdentity:identity];
// Undo the sign-in and dismiss the Sign In screen.
[[EarlGrey selectElementWithMatcher:UndoAccountConsistencyButton()]
......@@ -228,7 +226,7 @@ id<GREYMatcher> UndoAccountConsistencyButton() {
performAction:grey_tap()];
// |identity| shouldn't be signed in.
CHROME_EG_ASSERT_NO_ERROR([SigninEarlGreyUtils checkSignedOut]);
[SigninEarlGreyUtils checkSignedOut];
}
// Signs in to an account and then taps the Advanced link to go to settings.
......@@ -247,13 +245,7 @@ id<GREYMatcher> UndoAccountConsistencyButton() {
[[EarlGrey selectElementWithMatcher:AccountConsistencySetupSigninButton()]
performAction:grey_tap()];
NSError* signedInError =
[SigninEarlGreyUtils checkSignedInWithIdentity:identity];
// TODO(crbug.com/951600): Avoid asserting directly unless the test fails,
// due to timing issues.
if (signedInError != nil) {
GREYAssert(false, signedInError.localizedDescription);
}
[SigninEarlGreyUtils checkSignedInWithIdentity:identity];
}
// Tap Settings link.
......@@ -274,8 +266,7 @@ id<GREYMatcher> UndoAccountConsistencyButton() {
performAction:grey_tap()];
}
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity]);
[SigninEarlGreyUtils checkSignedInWithIdentity:identity];
GREYAssertTrue(sync_service->HasFinishedInitialSetup(),
@"Sync should have finished its original setup");
......
......@@ -25,7 +25,6 @@
#include "ios/chrome/grit/ios_strings.h"
#import "ios/chrome/test/app/chrome_test_util.h"
#import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h"
#import "ios/chrome/test/earl_grey/chrome_error_util.h"
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/public/provider/chrome/browser/signin/fake_chrome_identity.h"
......@@ -82,7 +81,7 @@ id<GREYMatcher> ButtonWithIdentity(ChromeIdentity* identity) {
[[EarlGrey selectElementWithMatcher:PrimarySignInButton()]
assertWithMatcher:grey_sufficientlyVisible()];
CHROME_EG_ASSERT_NO_ERROR([SigninEarlGreyUtils checkSignedOut]);
[SigninEarlGreyUtils checkSignedOut];
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
......@@ -108,7 +107,7 @@ id<GREYMatcher> ButtonWithIdentity(ChromeIdentity* identity) {
[[EarlGrey selectElementWithMatcher:PrimarySignInButton()]
assertWithMatcher:grey_sufficientlyVisible()];
CHROME_EG_ASSERT_NO_ERROR([SigninEarlGreyUtils checkSignedOut]);
[SigninEarlGreyUtils checkSignedOut];
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
......@@ -141,8 +140,7 @@ id<GREYMatcher> ButtonWithIdentity(ChromeIdentity* identity) {
grey_accessibilityLabel(identity2.userEmail),
grey_sufficientlyVisible(), nil)]
assertWithMatcher:grey_nil()];
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity1]);
[SigninEarlGreyUtils checkSignedInWithIdentity:identity1];
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
......@@ -188,8 +186,7 @@ id<GREYMatcher> ButtonWithIdentity(ChromeIdentity* identity) {
grey_accessibilityLabel(identity2.userEmail),
grey_sufficientlyVisible(), nil)]
assertWithMatcher:grey_nil()];
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity1]);
[SigninEarlGreyUtils checkSignedInWithIdentity:identity1];
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
......@@ -215,7 +212,7 @@ id<GREYMatcher> ButtonWithIdentity(ChromeIdentity* identity) {
// Check that the user is signed out and the Main Settings screen is shown.
[[EarlGrey selectElementWithMatcher:PrimarySignInButton()]
assertWithMatcher:grey_sufficientlyVisible()];
CHROME_EG_ASSERT_NO_ERROR([SigninEarlGreyUtils checkSignedOut]);
[SigninEarlGreyUtils checkSignedOut];
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
......@@ -244,8 +241,7 @@ id<GREYMatcher> ButtonWithIdentity(ChromeIdentity* identity) {
[[EarlGrey selectElementWithMatcher:chrome_test_util::
SettingsAccountsCollectionView()]
assertWithMatcher:grey_sufficientlyVisible()];
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity]);
[SigninEarlGreyUtils checkSignedInWithIdentity:identity];
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
......
......@@ -15,7 +15,6 @@
#include "ios/chrome/grit/ios_strings.h"
#import "ios/chrome/test/app/chrome_test_util.h"
#import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h"
#import "ios/chrome/test/earl_grey/chrome_error_util.h"
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/public/provider/chrome/browser/signin/fake_chrome_identity.h"
......@@ -74,8 +73,7 @@ using chrome_test_util::ButtonWithAccessibilityLabelId;
[SigninEarlGreyUI confirmSigninConfirmationDialog];
// User signed in.
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity]);
[SigninEarlGreyUtils checkSignedInWithIdentity:identity];
[SigninEarlGreyUI checkSigninPromoNotVisible];
[[EarlGrey selectElementWithMatcher:SettingsAccountButton()]
assertWithMatcher:grey_interactable()];
......@@ -95,8 +93,7 @@ using chrome_test_util::ButtonWithAccessibilityLabelId;
[SigninEarlGreyUI confirmSigninConfirmationDialog];
// User signed in.
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity]);
[SigninEarlGreyUtils checkSignedInWithIdentity:identity];
[SigninEarlGreyUI checkSigninPromoNotVisible];
[[EarlGrey selectElementWithMatcher:SettingsAccountButton()]
assertWithMatcher:grey_interactable()];
......
......@@ -28,7 +28,6 @@
#include "ios/chrome/grit/ios_strings.h"
#import "ios/chrome/test/app/chrome_test_util.h"
#import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h"
#import "ios/chrome/test/earl_grey/chrome_error_util.h"
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/public/provider/chrome/browser/signin/fake_chrome_identity.h"
......@@ -91,8 +90,7 @@ void TapOnPrimarySignInButtonInRecentTabs() {
[SigninEarlGreyUI signinWithIdentity:identity];
// Check |identity| is signed-in.
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity]);
[SigninEarlGreyUtils checkSignedInWithIdentity:identity];
}
// Tests that signing out from the Settings works correctly.
......@@ -123,7 +121,7 @@ void TapOnPrimarySignInButtonInRecentTabs() {
performAction:grey_tap()];
// Check that there is no signed in user.
CHROME_EG_ASSERT_NO_ERROR([SigninEarlGreyUtils checkSignedOut]);
[SigninEarlGreyUtils checkSignedOut];
}
// Tests that signing out of a managed account from the Settings works
......@@ -146,8 +144,7 @@ void TapOnPrimarySignInButtonInRecentTabs() {
SetEarlGreySynchronizationEnabled(YES);
[SigninEarlGreyUI confirmSigninConfirmationDialog];
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity]);
[SigninEarlGreyUtils checkSignedInWithIdentity:identity];
// Go to Accounts Settings and tap the sign out button.
[[EarlGrey selectElementWithMatcher:chrome_test_util::SettingsAccountButton()]
......@@ -167,7 +164,7 @@ void TapOnPrimarySignInButtonInRecentTabs() {
performAction:grey_tap()];
// Check that there is no signed in user.
CHROME_EG_ASSERT_NO_ERROR([SigninEarlGreyUtils checkSignedOut]);
[SigninEarlGreyUtils checkSignedOut];
}
// Tests that signing in, tapping the Settings link on the confirmation screen
......@@ -199,8 +196,7 @@ void TapOnPrimarySignInButtonInRecentTabs() {
IDS_IOS_SETTINGS_TITLE);
[[EarlGrey selectElementWithMatcher:settings_matcher]
assertWithMatcher:grey_notVisible()];
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity]);
[SigninEarlGreyUtils checkSignedInWithIdentity:identity];
}
// Opens the sign in screen and then cancel it by opening a new tab. Ensures
......@@ -269,7 +265,7 @@ void TapOnPrimarySignInButtonInRecentTabs() {
onElementWithMatcher:chrome_test_util::SettingsAccountsCollectionView()]
performAction:grey_tap()];
TapButtonWithLabelId(IDS_IOS_DISCONNECT_DIALOG_CONTINUE_BUTTON_MOBILE);
CHROME_EG_ASSERT_NO_ERROR([SigninEarlGreyUtils checkSignedOut]);
[SigninEarlGreyUtils checkSignedOut];
// Sign in with |identity1|.
[[EarlGrey selectElementWithMatcher:SecondarySignInButton()]
......@@ -300,7 +296,7 @@ void TapOnPrimarySignInButtonInRecentTabs() {
TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON);
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
CHROME_EG_ASSERT_NO_ERROR([SigninEarlGreyUtils checkSignedOut]);
[SigninEarlGreyUtils checkSignedOut];
}
// Opens the sign in screen from the bookmarks and then cancel it by tapping on
......@@ -468,11 +464,10 @@ void TapOnPrimarySignInButtonInRecentTabs() {
GREYAssertEqual(expectedString, webState->GetVisibleURL(), @"url not loaded");
if (tapSettingsLink) {
// Should be signed in.
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity]);
[SigninEarlGreyUtils checkSignedInWithIdentity:identity];
} else {
// Should be not signed in.
CHROME_EG_ASSERT_NO_ERROR([SigninEarlGreyUtils checkSignedOut]);
[SigninEarlGreyUtils checkSignedOut];
}
}
......
......@@ -18,7 +18,6 @@
#include "ios/chrome/grit/ios_strings.h"
#import "ios/chrome/test/app/chrome_test_util.h"
#import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h"
#import "ios/chrome/test/earl_grey/chrome_error_util.h"
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/public/provider/chrome/browser/signin/fake_chrome_identity.h"
......@@ -62,7 +61,7 @@ void SignOutFromSettings() {
onElementWithMatcher:chrome_test_util::SettingsAccountsCollectionView()]
performAction:grey_tap()];
TapButtonWithLabelId(IDS_IOS_DISCONNECT_DIALOG_CONTINUE_BUTTON_MOBILE);
CHROME_EG_ASSERT_NO_ERROR([SigninEarlGreyUtils checkSignedOut]);
[SigninEarlGreyUtils checkSignedOut];
}
} // namespace
......@@ -160,8 +159,7 @@ void SignOutFromSettings() {
performAction:grey_tap()];
// Check the signed-in user did change.
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity2]);
[SigninEarlGreyUtils checkSignedInWithIdentity:identity2];
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
......@@ -205,8 +203,7 @@ void SignOutFromSettings() {
performAction:grey_tap()];
// Check the signed-in user did change.
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity2]);
[SigninEarlGreyUtils checkSignedInWithIdentity:identity2];
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
......
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