Commit b1a5ca8c authored by Nohemi Fernandez's avatar Nohemi Fernandez Committed by Commit Bot

[iOS] Migrate EarlGrey tests to use SigninEarlGrey helper class.

During the EG1 to EG2 migration a duplicate testing class was created to
help expose necessary class-specific methods to EarlGrey. Now that the
transition is complete we will remove the dependency to
SigninEarlGreyAppInterface helper class and only expose SigninEarlGrey
to client code.

This patch also uses the more canonical 'verify' prefix for EarlGrey
assertions.

Bug: 1103274
Change-Id: I7cf71df0826068e79c8e0006744907fe36c70be5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2352931
Commit-Queue: Nohemi Fernandez <fernandex@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797636}
parent 2185253d
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "base/macros.h" #include "base/macros.h"
#import "ios/chrome/browser/metrics/metrics_app_interface.h" #import "ios/chrome/browser/metrics/metrics_app_interface.h"
#import "ios/chrome/browser/ui/authentication/signin_earl_grey.h" #import "ios/chrome/browser/ui/authentication/signin_earl_grey.h"
#import "ios/chrome/browser/ui/authentication/signin_earl_grey_app_interface.h"
#import "ios/chrome/browser/ui/authentication/signin_earl_grey_ui.h" #import "ios/chrome/browser/ui/authentication/signin_earl_grey_ui.h"
#import "ios/chrome/test/earl_grey/chrome_actions.h" #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.h"
...@@ -93,9 +92,7 @@ using chrome_test_util::SettingsDoneButton; ...@@ -93,9 +92,7 @@ using chrome_test_util::SettingsDoneButton;
// Note: URL-keyed anonymized data collection is turned off as part of the // Note: URL-keyed anonymized data collection is turned off as part of the
// flow to Sign out of Chrome and Turn sync off. This matches the main user // flow to Sign out of Chrome and Turn sync off. This matches the main user
// flow that disables UKM. // flow that disables UKM.
if (![SigninEarlGreyAppInterface isSignedOut]) { [SigninEarlGrey signOut];
[SigninEarlGreyAppInterface signOut];
}
[ChromeEarlGrey waitForSyncInitialized:NO [ChromeEarlGrey waitForSyncInitialized:NO
syncTimeout:syncher::kSyncUKMOperationsTimeout]; syncTimeout:syncher::kSyncUKMOperationsTimeout];
...@@ -274,7 +271,7 @@ using chrome_test_util::SettingsDoneButton; ...@@ -274,7 +271,7 @@ using chrome_test_util::SettingsDoneButton;
// Corresponds to ConsentAddedButNoSyncCheck in //chrome/browser/metrics/ // Corresponds to ConsentAddedButNoSyncCheck in //chrome/browser/metrics/
// ukm_browsertest.cc. // ukm_browsertest.cc.
- (void)testConsentAddedButNoSync { - (void)testConsentAddedButNoSync {
[SigninEarlGreyAppInterface signOut]; [SigninEarlGrey signOut];
[MetricsAppInterface setMetricsAndCrashReportingForTesting:NO]; [MetricsAppInterface setMetricsAndCrashReportingForTesting:NO];
GREYAssert([MetricsAppInterface checkUKMRecordingEnabled:NO], GREYAssert([MetricsAppInterface checkUKMRecordingEnabled:NO],
@"Failed to assert that UKM was not enabled."); @"Failed to assert that UKM was not enabled.");
...@@ -347,7 +344,7 @@ using chrome_test_util::SettingsDoneButton; ...@@ -347,7 +344,7 @@ using chrome_test_util::SettingsDoneButton;
#endif #endif
const uint64_t clientID1 = [MetricsAppInterface UKMClientID]; const uint64_t clientID1 = [MetricsAppInterface UKMClientID];
[SigninEarlGreyAppInterface signOut]; [SigninEarlGrey signOut];
GREYAssert([MetricsAppInterface checkUKMRecordingEnabled:NO], GREYAssert([MetricsAppInterface checkUKMRecordingEnabled:NO],
@"Failed to assert that UKM was not enabled."); @"Failed to assert that UKM was not enabled.");
......
...@@ -147,6 +147,7 @@ source_set("eg_app_support+eg2") { ...@@ -147,6 +147,7 @@ source_set("eg_app_support+eg2") {
"signin_earl_grey_app_interface.h", "signin_earl_grey_app_interface.h",
"signin_earl_grey_app_interface.mm", "signin_earl_grey_app_interface.mm",
] ]
visibility = [ "//ios/chrome/test/earl_grey:eg_app_support+eg2" ]
deps = [ deps = [
":authentication", ":authentication",
"unified_consent", "unified_consent",
......
...@@ -101,7 +101,7 @@ void ChooseImportOrKeepDataSepareteDialog(id<GREYMatcher> choiceButtonMatcher) { ...@@ -101,7 +101,7 @@ void ChooseImportOrKeepDataSepareteDialog(id<GREYMatcher> choiceButtonMatcher) {
performAction:grey_tap()]; performAction:grey_tap()];
// Check the signed-in user did change. // Check the signed-in user did change.
[SigninEarlGrey checkSignedInWithFakeIdentity:fakeIdentity2]; [SigninEarlGrey verifySignedInWithFakeIdentity:fakeIdentity2];
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()] [[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()]; performAction:grey_tap()];
...@@ -133,7 +133,7 @@ void ChooseImportOrKeepDataSepareteDialog(id<GREYMatcher> choiceButtonMatcher) { ...@@ -133,7 +133,7 @@ void ChooseImportOrKeepDataSepareteDialog(id<GREYMatcher> choiceButtonMatcher) {
[SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity]; [SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity];
// Check |fakeIdentity| is signed-in. // Check |fakeIdentity| is signed-in.
[SigninEarlGrey checkSignedInWithFakeIdentity:fakeIdentity]; [SigninEarlGrey verifySignedInWithFakeIdentity:fakeIdentity];
} }
// Tests signing in with one account, switching sync account to a second and // Tests signing in with one account, switching sync account to a second and
...@@ -174,7 +174,7 @@ void ChooseImportOrKeepDataSepareteDialog(id<GREYMatcher> choiceButtonMatcher) { ...@@ -174,7 +174,7 @@ void ChooseImportOrKeepDataSepareteDialog(id<GREYMatcher> choiceButtonMatcher) {
signOutWithSignOutConfirmation:SignOutConfirmationManagedUser]; signOutWithSignOutConfirmation:SignOutConfirmationManagedUser];
// Check that there is no signed in user. // Check that there is no signed in user.
[SigninEarlGrey checkSignedOut]; [SigninEarlGrey verifySignedOut];
} }
// Tests that signing in, tapping the Settings link on the confirmation screen // Tests that signing in, tapping the Settings link on the confirmation screen
...@@ -196,7 +196,7 @@ void ChooseImportOrKeepDataSepareteDialog(id<GREYMatcher> choiceButtonMatcher) { ...@@ -196,7 +196,7 @@ void ChooseImportOrKeepDataSepareteDialog(id<GREYMatcher> choiceButtonMatcher) {
[[EarlGrey selectElementWithMatcher:settings_matcher] [[EarlGrey selectElementWithMatcher:settings_matcher]
assertWithMatcher:grey_sufficientlyVisible()]; assertWithMatcher:grey_sufficientlyVisible()];
// Test the user is signed in. // Test the user is signed in.
[SigninEarlGrey checkSignedInWithFakeIdentity:fakeIdentity]; [SigninEarlGrey verifySignedInWithFakeIdentity:fakeIdentity];
} }
// Opens the sign in screen and then cancel it by opening a new tab. Ensures // Opens the sign in screen and then cancel it by opening a new tab. Ensures
...@@ -290,7 +290,7 @@ void ChooseImportOrKeepDataSepareteDialog(id<GREYMatcher> choiceButtonMatcher) { ...@@ -290,7 +290,7 @@ void ChooseImportOrKeepDataSepareteDialog(id<GREYMatcher> choiceButtonMatcher) {
performAction:grey_tap()]; performAction:grey_tap()];
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()] [[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()]; performAction:grey_tap()];
[SigninEarlGrey checkSignedOut]; [SigninEarlGrey verifySignedOut];
} }
// Opens the sign in screen from the bookmarks and then cancel it by tapping on // Opens the sign in screen from the bookmarks and then cancel it by tapping on
...@@ -420,7 +420,7 @@ void ChooseImportOrKeepDataSepareteDialog(id<GREYMatcher> choiceButtonMatcher) { ...@@ -420,7 +420,7 @@ void ChooseImportOrKeepDataSepareteDialog(id<GREYMatcher> choiceButtonMatcher) {
ButtonWithAccessibilityLabel(GetNSString( ButtonWithAccessibilityLabel(GetNSString(
IDS_IOS_ADVANCED_SIGNIN_SETTINGS_CANCEL_SYNC_ALERT_CANCEL_SYNC_BUTTON))] IDS_IOS_ADVANCED_SIGNIN_SETTINGS_CANCEL_SYNC_ALERT_CANCEL_SYNC_BUTTON))]
performAction:grey_tap()]; performAction:grey_tap()];
[SigninEarlGrey checkSignedOut]; [SigninEarlGrey verifySignedOut];
} }
#pragma mark - Utils #pragma mark - Utils
...@@ -482,10 +482,10 @@ void ChooseImportOrKeepDataSepareteDialog(id<GREYMatcher> choiceButtonMatcher) { ...@@ -482,10 +482,10 @@ void ChooseImportOrKeepDataSepareteDialog(id<GREYMatcher> choiceButtonMatcher) {
if (tapSettingsLink) { if (tapSettingsLink) {
// Should be signed in. // Should be signed in.
[SigninEarlGrey checkSignedInWithFakeIdentity:fakeIdentity]; [SigninEarlGrey verifySignedInWithFakeIdentity:fakeIdentity];
} else { } else {
// Should be not signed in. // Should be not signed in.
[SigninEarlGrey checkSignedOut]; [SigninEarlGrey verifySignedOut];
} }
} }
......
...@@ -36,12 +36,19 @@ ...@@ -36,12 +36,19 @@
// simulate identity removal from the device. // simulate identity removal from the device.
- (void)forgetFakeIdentity:(FakeChromeIdentity*)fakeIdentity; - (void)forgetFakeIdentity:(FakeChromeIdentity*)fakeIdentity;
// Signs the user out of the primary account. Induces a GREYAssert if the
// app fails to sign out.
- (void)signOut;
// Induces a GREYAssert if |fakeIdentity| is not signed in to the active // Induces a GREYAssert if |fakeIdentity| is not signed in to the active
// profile. // profile.
- (void)checkSignedInWithFakeIdentity:(FakeChromeIdentity*)fakeIdentity; - (void)verifySignedInWithFakeIdentity:(FakeChromeIdentity*)fakeIdentity;
// Induces a GREYAssert if an identity is signed in. // Induces a GREYAssert if an identity is signed in.
- (void)checkSignedOut; - (void)verifySignedOut;
// Induces a GREYAssert if there are no signed-in identities.
- (void)verifyAuthenticated;
@end @end
......
...@@ -35,7 +35,12 @@ ...@@ -35,7 +35,12 @@
[SigninEarlGreyAppInterface forgetFakeIdentity:fakeIdentity]; [SigninEarlGreyAppInterface forgetFakeIdentity:fakeIdentity];
} }
- (void)checkSignedInWithFakeIdentity:(FakeChromeIdentity*)fakeIdentity { - (void)signOut {
[SigninEarlGreyAppInterface signOut];
[self verifySignedOut];
}
- (void)verifySignedInWithFakeIdentity:(FakeChromeIdentity*)fakeIdentity {
BOOL fakeIdentityIsNonNil = fakeIdentity != nil; BOOL fakeIdentityIsNonNil = fakeIdentity != nil;
EG_TEST_HELPER_ASSERT_TRUE(fakeIdentityIsNonNil, @"Need to give an identity"); EG_TEST_HELPER_ASSERT_TRUE(fakeIdentityIsNonNil, @"Need to give an identity");
...@@ -63,7 +68,7 @@ ...@@ -63,7 +68,7 @@
[fakeIdentity.gaiaID isEqualToString:primaryAccountGaiaID], errorStr); [fakeIdentity.gaiaID isEqualToString:primaryAccountGaiaID], errorStr);
} }
- (void)checkSignedOut { - (void)verifySignedOut {
// Required to avoid any problem since the following test is not dependant to // 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 // UI, and the previous action has to be totally finished before going through
// the assert. // the assert.
...@@ -73,4 +78,9 @@ ...@@ -73,4 +78,9 @@
@"Unexpected signed in user"); @"Unexpected signed in user");
} }
- (void)verifyAuthenticated {
EG_TEST_HELPER_ASSERT_TRUE([SigninEarlGreyAppInterface isAuthenticated],
@"User is not signed in");
}
@end @end
...@@ -50,7 +50,7 @@ using chrome_test_util::SignOutAccountsButton; ...@@ -50,7 +50,7 @@ using chrome_test_util::SignOutAccountsButton;
} }
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()] [[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()]; performAction:grey_tap()];
[SigninEarlGrey checkSignedInWithFakeIdentity:fakeIdentity]; [SigninEarlGrey verifySignedInWithFakeIdentity:fakeIdentity];
} }
+ (void)selectIdentityWithEmail:(NSString*)userEmail { + (void)selectIdentityWithEmail:(NSString*)userEmail {
...@@ -225,7 +225,7 @@ using chrome_test_util::SignOutAccountsButton; ...@@ -225,7 +225,7 @@ using chrome_test_util::SignOutAccountsButton;
[ChromeEarlGreyUI waitForAppToIdle]; [ChromeEarlGreyUI waitForAppToIdle];
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()] [[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()]; performAction:grey_tap()];
[SigninEarlGrey checkSignedOut]; [SigninEarlGrey verifySignedOut];
} }
+ (void)tapRemoveAccountFromDeviceWithFakeIdentity: + (void)tapRemoveAccountFromDeviceWithFakeIdentity:
......
...@@ -140,7 +140,7 @@ id<GREYMatcher> SkipSigninButton() { ...@@ -140,7 +140,7 @@ id<GREYMatcher> SkipSigninButton() {
[[EarlGrey selectElementWithMatcher:SyncSettingsConfirmButton()] [[EarlGrey selectElementWithMatcher:SyncSettingsConfirmButton()]
performAction:grey_tap()]; performAction:grey_tap()];
[SigninEarlGrey checkSignedInWithFakeIdentity:fakeIdentity]; [SigninEarlGrey verifySignedInWithFakeIdentity:fakeIdentity];
GREYAssertTrue([FirstRunAppInterface isSyncFirstSetupComplete], GREYAssertTrue([FirstRunAppInterface isSyncFirstSetupComplete],
@"Sync should have finished its original setup"); @"Sync should have finished its original setup");
......
...@@ -89,7 +89,7 @@ id<GREYMatcher> NoBookmarksLabel() { ...@@ -89,7 +89,7 @@ id<GREYMatcher> NoBookmarksLabel() {
[[EarlGrey selectElementWithMatcher:PrimarySignInButton()] [[EarlGrey selectElementWithMatcher:PrimarySignInButton()]
assertWithMatcher:grey_sufficientlyVisible()]; assertWithMatcher:grey_sufficientlyVisible()];
[SigninEarlGrey checkSignedOut]; [SigninEarlGrey verifySignedOut];
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()] [[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()]; performAction:grey_tap()];
...@@ -113,7 +113,7 @@ id<GREYMatcher> NoBookmarksLabel() { ...@@ -113,7 +113,7 @@ id<GREYMatcher> NoBookmarksLabel() {
[[EarlGrey selectElementWithMatcher:PrimarySignInButton()] [[EarlGrey selectElementWithMatcher:PrimarySignInButton()]
assertWithMatcher:grey_sufficientlyVisible()]; assertWithMatcher:grey_sufficientlyVisible()];
[SigninEarlGrey checkSignedOut]; [SigninEarlGrey verifySignedOut];
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()] [[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()]; performAction:grey_tap()];
...@@ -148,7 +148,7 @@ id<GREYMatcher> NoBookmarksLabel() { ...@@ -148,7 +148,7 @@ id<GREYMatcher> NoBookmarksLabel() {
fakeIdentity2.userEmail), fakeIdentity2.userEmail),
grey_sufficientlyVisible(), nil)] grey_sufficientlyVisible(), nil)]
assertWithMatcher:grey_nil()]; assertWithMatcher:grey_nil()];
[SigninEarlGrey checkSignedInWithFakeIdentity:fakeIdentity1]; [SigninEarlGrey verifySignedInWithFakeIdentity:fakeIdentity1];
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()] [[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()]; performAction:grey_tap()];
...@@ -177,7 +177,7 @@ id<GREYMatcher> NoBookmarksLabel() { ...@@ -177,7 +177,7 @@ id<GREYMatcher> NoBookmarksLabel() {
// Check that the user is signed out and the Main Settings screen is shown. // Check that the user is signed out and the Main Settings screen is shown.
[[EarlGrey selectElementWithMatcher:PrimarySignInButton()] [[EarlGrey selectElementWithMatcher:PrimarySignInButton()]
assertWithMatcher:grey_sufficientlyVisible()]; assertWithMatcher:grey_sufficientlyVisible()];
[SigninEarlGrey checkSignedOut]; [SigninEarlGrey verifySignedOut];
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()] [[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()]; performAction:grey_tap()];
...@@ -290,7 +290,7 @@ id<GREYMatcher> NoBookmarksLabel() { ...@@ -290,7 +290,7 @@ id<GREYMatcher> NoBookmarksLabel() {
[[EarlGrey selectElementWithMatcher:chrome_test_util:: [[EarlGrey selectElementWithMatcher:chrome_test_util::
SettingsAccountsCollectionView()] SettingsAccountsCollectionView()]
assertWithMatcher:grey_sufficientlyVisible()]; assertWithMatcher:grey_sufficientlyVisible()];
[SigninEarlGrey checkSignedInWithFakeIdentity:fakeIdentity]; [SigninEarlGrey verifySignedInWithFakeIdentity:fakeIdentity];
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()] [[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()]; performAction:grey_tap()];
......
...@@ -65,7 +65,7 @@ using chrome_test_util::ButtonWithAccessibilityLabelId; ...@@ -65,7 +65,7 @@ using chrome_test_util::ButtonWithAccessibilityLabelId;
[SigninEarlGreyUI confirmSigninConfirmationDialog]; [SigninEarlGreyUI confirmSigninConfirmationDialog];
// User signed in. // User signed in.
[SigninEarlGrey checkSignedInWithFakeIdentity:fakeIdentity]; [SigninEarlGrey verifySignedInWithFakeIdentity:fakeIdentity];
[SigninEarlGreyUI checkSigninPromoNotVisible]; [SigninEarlGreyUI checkSigninPromoNotVisible];
[[EarlGrey selectElementWithMatcher:SettingsAccountButton()] [[EarlGrey selectElementWithMatcher:SettingsAccountButton()]
assertWithMatcher:grey_interactable()]; assertWithMatcher:grey_interactable()];
...@@ -84,7 +84,7 @@ using chrome_test_util::ButtonWithAccessibilityLabelId; ...@@ -84,7 +84,7 @@ using chrome_test_util::ButtonWithAccessibilityLabelId;
[SigninEarlGreyUI confirmSigninConfirmationDialog]; [SigninEarlGreyUI confirmSigninConfirmationDialog];
// User signed in. // User signed in.
[SigninEarlGrey checkSignedInWithFakeIdentity:fakeIdentity]; [SigninEarlGrey verifySignedInWithFakeIdentity:fakeIdentity];
[SigninEarlGreyUI checkSigninPromoNotVisible]; [SigninEarlGreyUI checkSigninPromoNotVisible];
[[EarlGrey selectElementWithMatcher:SettingsAccountButton()] [[EarlGrey selectElementWithMatcher:SettingsAccountButton()]
assertWithMatcher:grey_interactable()]; assertWithMatcher:grey_interactable()];
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#import "base/test/ios/wait_util.h" #import "base/test/ios/wait_util.h"
#import "ios/chrome/browser/ui/authentication/signin_earl_grey_app_interface.h" #import "ios/chrome/browser/ui/authentication/signin_earl_grey.h"
#import "ios/chrome/browser/ui/authentication/signin_earl_grey_ui.h" #import "ios/chrome/browser/ui/authentication/signin_earl_grey_ui.h"
#import "ios/chrome/browser/ui/bookmarks/bookmark_earl_grey.h" #import "ios/chrome/browser/ui/bookmarks/bookmark_earl_grey.h"
#import "ios/chrome/test/earl_grey/chrome_earl_grey.h" #import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
...@@ -69,8 +69,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) { ...@@ -69,8 +69,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) {
[BookmarkEarlGrey addBookmarkWithTitle:@"foo" URL:@"https://www.foo.com"]; [BookmarkEarlGrey addBookmarkWithTitle:@"foo" URL:@"https://www.foo.com"];
// Sign in to sync, after a bookmark has been added. // Sign in to sync, after a bookmark has been added.
FakeChromeIdentity* fakeIdentity = [SigninEarlGreyAppInterface fakeIdentity1]; FakeChromeIdentity* fakeIdentity = [SigninEarlGrey fakeIdentity1];
[SigninEarlGreyAppInterface addFakeIdentity:fakeIdentity]; [SigninEarlGrey addFakeIdentity:fakeIdentity];
[SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity]; [SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity];
// Assert that the correct number of bookmarks have been synced. // Assert that the correct number of bookmarks have been synced.
...@@ -80,8 +80,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) { ...@@ -80,8 +80,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) {
// Tests that a bookmark added on the client is uploaded to the Sync server. // Tests that a bookmark added on the client is uploaded to the Sync server.
- (void)testSyncUploadBookmark { - (void)testSyncUploadBookmark {
FakeChromeIdentity* fakeIdentity = [SigninEarlGreyAppInterface fakeIdentity1]; FakeChromeIdentity* fakeIdentity = [SigninEarlGrey fakeIdentity1];
[SigninEarlGreyAppInterface addFakeIdentity:fakeIdentity]; [SigninEarlGrey addFakeIdentity:fakeIdentity];
[SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity]; [SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity];
// Add a bookmark after sync is initialized. // Add a bookmark after sync is initialized.
...@@ -98,8 +98,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) { ...@@ -98,8 +98,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) {
[ChromeEarlGrey addFakeSyncServerBookmarkWithURL:URL title:"hoo"]; [ChromeEarlGrey addFakeSyncServerBookmarkWithURL:URL title:"hoo"];
// Sign in to sync, after a bookmark has been injected in the sync server. // Sign in to sync, after a bookmark has been injected in the sync server.
FakeChromeIdentity* fakeIdentity = [SigninEarlGreyAppInterface fakeIdentity1]; FakeChromeIdentity* fakeIdentity = [SigninEarlGrey fakeIdentity1];
[SigninEarlGreyAppInterface addFakeIdentity:fakeIdentity]; [SigninEarlGrey addFakeIdentity:fakeIdentity];
[SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity]; [SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity];
[ChromeEarlGrey waitForSyncInitialized:YES syncTimeout:kSyncOperationTimeout]; [ChromeEarlGrey waitForSyncInitialized:YES syncTimeout:kSyncOperationTimeout];
[BookmarkEarlGrey verifyBookmarksWithTitle:@"hoo" expectedCount:1]; [BookmarkEarlGrey verifyBookmarksWithTitle:@"hoo" expectedCount:1];
...@@ -108,8 +108,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) { ...@@ -108,8 +108,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) {
// Tests that the local cache guid does not change when sync is restarted. // Tests that the local cache guid does not change when sync is restarted.
- (void)testSyncCheckSameCacheGuid_SyncRestarted { - (void)testSyncCheckSameCacheGuid_SyncRestarted {
// Sign in the fake identity. // Sign in the fake identity.
FakeChromeIdentity* fakeIdentity = [SigninEarlGreyAppInterface fakeIdentity1]; FakeChromeIdentity* fakeIdentity = [SigninEarlGrey fakeIdentity1];
[SigninEarlGreyAppInterface addFakeIdentity:fakeIdentity]; [SigninEarlGrey addFakeIdentity:fakeIdentity];
[SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity]; [SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity];
[ChromeEarlGrey waitForSyncInitialized:YES syncTimeout:kSyncOperationTimeout]; [ChromeEarlGrey waitForSyncInitialized:YES syncTimeout:kSyncOperationTimeout];
...@@ -129,15 +129,14 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) { ...@@ -129,15 +129,14 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) {
// signs back in with the same account. // signs back in with the same account.
- (void)testSyncCheckDifferentCacheGuid_SignOutAndSignIn { - (void)testSyncCheckDifferentCacheGuid_SignOutAndSignIn {
// Sign in a fake identity, and store the initial sync guid. // Sign in a fake identity, and store the initial sync guid.
FakeChromeIdentity* fakeIdentity = [SigninEarlGreyAppInterface fakeIdentity1]; FakeChromeIdentity* fakeIdentity = [SigninEarlGrey fakeIdentity1];
[SigninEarlGreyAppInterface addFakeIdentity:fakeIdentity]; [SigninEarlGrey addFakeIdentity:fakeIdentity];
[SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity]; [SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity];
[ChromeEarlGrey waitForSyncInitialized:YES syncTimeout:kSyncOperationTimeout]; [ChromeEarlGrey waitForSyncInitialized:YES syncTimeout:kSyncOperationTimeout];
std::string original_guid = [ChromeEarlGrey syncCacheGUID]; std::string original_guid = [ChromeEarlGrey syncCacheGUID];
GREYAssert([SigninEarlGreyAppInterface isAuthenticated], [SigninEarlGrey verifyAuthenticated];
@"User is not signed in."); [SigninEarlGrey signOut];
[SigninEarlGreyAppInterface signOut];
[ChromeEarlGrey waitForSyncInitialized:NO syncTimeout:kSyncOperationTimeout]; [ChromeEarlGrey waitForSyncInitialized:NO syncTimeout:kSyncOperationTimeout];
// Sign the user back in, and verify the guid has changed. // Sign the user back in, and verify the guid has changed.
...@@ -153,14 +152,13 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) { ...@@ -153,14 +152,13 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) {
// Test for http://crbug.com/413611 . // Test for http://crbug.com/413611 .
- (void)testSyncCheckSameCacheGuid_SyncRestartedAfterSignOutAndSignIn { - (void)testSyncCheckSameCacheGuid_SyncRestartedAfterSignOutAndSignIn {
// Sign in a fake idenitty. // Sign in a fake idenitty.
FakeChromeIdentity* fakeIdentity = [SigninEarlGreyAppInterface fakeIdentity1]; FakeChromeIdentity* fakeIdentity = [SigninEarlGrey fakeIdentity1];
[SigninEarlGreyAppInterface addFakeIdentity:fakeIdentity]; [SigninEarlGrey addFakeIdentity:fakeIdentity];
[SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity]; [SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity];
[ChromeEarlGrey waitForSyncInitialized:YES syncTimeout:kSyncOperationTimeout]; [ChromeEarlGrey waitForSyncInitialized:YES syncTimeout:kSyncOperationTimeout];
GREYAssert([SigninEarlGreyAppInterface isAuthenticated], [SigninEarlGrey verifyAuthenticated];
@"User is not signed in."); [SigninEarlGrey signOut];
[SigninEarlGreyAppInterface signOut];
[ChromeEarlGrey waitForSyncInitialized:NO syncTimeout:kSyncOperationTimeout]; [ChromeEarlGrey waitForSyncInitialized:NO syncTimeout:kSyncOperationTimeout];
// Sign the user back in. // Sign the user back in.
...@@ -193,8 +191,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) { ...@@ -193,8 +191,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) {
}]; }];
// Sign in to sync. // Sign in to sync.
FakeChromeIdentity* fakeIdentity = [SigninEarlGreyAppInterface fakeIdentity1]; FakeChromeIdentity* fakeIdentity = [SigninEarlGrey fakeIdentity1];
[SigninEarlGreyAppInterface addFakeIdentity:fakeIdentity]; [SigninEarlGrey addFakeIdentity:fakeIdentity];
[SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity]; [SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity];
// Verify that the autofill profile has been downloaded. // Verify that the autofill profile has been downloaded.
...@@ -221,8 +219,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) { ...@@ -221,8 +219,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) {
}]; }];
// Sign in to sync. // Sign in to sync.
FakeChromeIdentity* fakeIdentity = [SigninEarlGreyAppInterface fakeIdentity1]; FakeChromeIdentity* fakeIdentity = [SigninEarlGrey fakeIdentity1];
[SigninEarlGreyAppInterface addFakeIdentity:fakeIdentity]; [SigninEarlGrey addFakeIdentity:fakeIdentity];
[SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity]; [SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity];
// Verify that the autofill profile has been downloaded. // Verify that the autofill profile has been downloaded.
...@@ -266,8 +264,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) { ...@@ -266,8 +264,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) {
}]; }];
// Sign in to sync. // Sign in to sync.
FakeChromeIdentity* fakeIdentity = [SigninEarlGreyAppInterface fakeIdentity1]; FakeChromeIdentity* fakeIdentity = [SigninEarlGrey fakeIdentity1];
[SigninEarlGreyAppInterface addFakeIdentity:fakeIdentity]; [SigninEarlGrey addFakeIdentity:fakeIdentity];
[SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity]; [SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity];
// Verify that the autofill profile has been downloaded // Verify that the autofill profile has been downloaded
...@@ -306,8 +304,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) { ...@@ -306,8 +304,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) {
[ChromeEarlGrey loadURL:URL2]; [ChromeEarlGrey loadURL:URL2];
// Sign in to sync, after opening two tabs. // Sign in to sync, after opening two tabs.
FakeChromeIdentity* fakeIdentity = [SigninEarlGreyAppInterface fakeIdentity1]; FakeChromeIdentity* fakeIdentity = [SigninEarlGrey fakeIdentity1];
[SigninEarlGreyAppInterface addFakeIdentity:fakeIdentity]; [SigninEarlGrey addFakeIdentity:fakeIdentity];
[SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity]; [SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity];
// Verify the sessions on the sync server. // Verify the sessions on the sync server.
...@@ -333,8 +331,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) { ...@@ -333,8 +331,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) {
[ChromeEarlGrey addHistoryServiceTypedURL:mockURL]; [ChromeEarlGrey addHistoryServiceTypedURL:mockURL];
// Sign in to sync. // Sign in to sync.
FakeChromeIdentity* fakeIdentity = [SigninEarlGreyAppInterface fakeIdentity1]; FakeChromeIdentity* fakeIdentity = [SigninEarlGrey fakeIdentity1];
[SigninEarlGreyAppInterface addFakeIdentity:fakeIdentity]; [SigninEarlGrey addFakeIdentity:fakeIdentity];
[SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity]; [SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity];
[ChromeEarlGrey waitForSyncInitialized:YES syncTimeout:kSyncOperationTimeout]; [ChromeEarlGrey waitForSyncInitialized:YES syncTimeout:kSyncOperationTimeout];
...@@ -360,8 +358,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) { ...@@ -360,8 +358,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) {
[ChromeEarlGrey addFakeSyncServerTypedURL:mockURL]; [ChromeEarlGrey addFakeSyncServerTypedURL:mockURL];
// Sign in to sync. // Sign in to sync.
FakeChromeIdentity* fakeIdentity = [SigninEarlGreyAppInterface fakeIdentity1]; FakeChromeIdentity* fakeIdentity = [SigninEarlGrey fakeIdentity1];
[SigninEarlGreyAppInterface addFakeIdentity:fakeIdentity]; [SigninEarlGrey addFakeIdentity:fakeIdentity];
[SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity]; [SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity];
[ChromeEarlGrey waitForSyncInitialized:YES syncTimeout:kSyncOperationTimeout]; [ChromeEarlGrey waitForSyncInitialized:YES syncTimeout:kSyncOperationTimeout];
...@@ -386,8 +384,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) { ...@@ -386,8 +384,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) {
[ChromeEarlGrey addFakeSyncServerTypedURL:mockURL]; [ChromeEarlGrey addFakeSyncServerTypedURL:mockURL];
// Sign in to sync. // Sign in to sync.
FakeChromeIdentity* fakeIdentity = [SigninEarlGreyAppInterface fakeIdentity1]; FakeChromeIdentity* fakeIdentity = [SigninEarlGrey fakeIdentity1];
[SigninEarlGreyAppInterface addFakeIdentity:fakeIdentity]; [SigninEarlGrey addFakeIdentity:fakeIdentity];
[SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity]; [SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity];
[ChromeEarlGrey waitForSyncInitialized:YES syncTimeout:kSyncOperationTimeout]; [ChromeEarlGrey waitForSyncInitialized:YES syncTimeout:kSyncOperationTimeout];
...@@ -420,8 +418,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) { ...@@ -420,8 +418,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) {
[ChromeEarlGrey addHistoryServiceTypedURL:mockURL]; [ChromeEarlGrey addHistoryServiceTypedURL:mockURL];
// Sign in to sync. // Sign in to sync.
FakeChromeIdentity* fakeIdentity = [SigninEarlGreyAppInterface fakeIdentity1]; FakeChromeIdentity* fakeIdentity = [SigninEarlGrey fakeIdentity1];
[SigninEarlGreyAppInterface addFakeIdentity:fakeIdentity]; [SigninEarlGrey addFakeIdentity:fakeIdentity];
[SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity]; [SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity];
[ChromeEarlGrey waitForSyncInitialized:YES syncTimeout:kSyncOperationTimeout]; [ChromeEarlGrey waitForSyncInitialized:YES syncTimeout:kSyncOperationTimeout];
...@@ -462,8 +460,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) { ...@@ -462,8 +460,8 @@ void AssertNumberOfEntities(int entity_count, syncer::ModelType entity_type) {
originator_client_item_id:"1"]; originator_client_item_id:"1"];
// Sign in to sync. // Sign in to sync.
FakeChromeIdentity* fakeIdentity = [SigninEarlGreyAppInterface fakeIdentity1]; FakeChromeIdentity* fakeIdentity = [SigninEarlGrey fakeIdentity1];
[SigninEarlGreyAppInterface addFakeIdentity:fakeIdentity]; [SigninEarlGrey addFakeIdentity:fakeIdentity];
[SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity]; [SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity];
[ChromeEarlGrey waitForSyncInitialized:YES syncTimeout:kSyncOperationTimeout]; [ChromeEarlGrey waitForSyncInitialized:YES syncTimeout:kSyncOperationTimeout];
......
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