Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: ios/chrome/browser/ui/authentication/signin_interaction_controller_egtest.mm

Issue 2861243002: Use NavigationBarDoneButton() matcher in EarlGrey tests. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ios/chrome/browser/ui/history/history_ui_egtest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import <EarlGrey/EarlGrey.h> 5 #import <EarlGrey/EarlGrey.h>
6 #import <XCTest/XCTest.h> 6 #import <XCTest/XCTest.h>
7 7
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #import "base/test/ios/wait_util.h" 9 #import "base/test/ios/wait_util.h"
10 #include "components/signin/core/browser/signin_manager.h" 10 #include "components/signin/core/browser/signin_manager.h"
(...skipping 12 matching lines...) Expand all
23 #import "ios/chrome/test/earl_grey/chrome_matchers.h" 23 #import "ios/chrome/test/earl_grey/chrome_matchers.h"
24 #import "ios/chrome/test/earl_grey/chrome_test_case.h" 24 #import "ios/chrome/test/earl_grey/chrome_test_case.h"
25 #import "ios/public/provider/chrome/browser/signin/fake_chrome_identity.h" 25 #import "ios/public/provider/chrome/browser/signin/fake_chrome_identity.h"
26 #import "ios/public/provider/chrome/browser/signin/fake_chrome_identity_service. h" 26 #import "ios/public/provider/chrome/browser/signin/fake_chrome_identity_service. h"
27 #import "ios/testing/wait_util.h" 27 #import "ios/testing/wait_util.h"
28 28
29 #if !defined(__has_feature) || !__has_feature(objc_arc) 29 #if !defined(__has_feature) || !__has_feature(objc_arc)
30 #error "This file requires ARC support." 30 #error "This file requires ARC support."
31 #endif 31 #endif
32 32
33 using chrome_test_util::NavigationBarDoneButton;
34
33 namespace { 35 namespace {
34 36
35 // Returns a fake identity. 37 // Returns a fake identity.
36 ChromeIdentity* GetFakeIdentity1() { 38 ChromeIdentity* GetFakeIdentity1() {
37 return [FakeChromeIdentity identityWithEmail:@"foo@gmail.com" 39 return [FakeChromeIdentity identityWithEmail:@"foo@gmail.com"
38 gaiaID:@"fooID" 40 gaiaID:@"fooID"
39 name:@"Fake Foo"]; 41 name:@"Fake Foo"];
40 } 42 }
41 43
42 // Returns a second fake identity. 44 // Returns a second fake identity.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 // Open the sign in screen. 138 // Open the sign in screen.
137 OpenSignInFromSettings(); 139 OpenSignInFromSettings();
138 140
139 // Select the user. 141 // Select the user.
140 TapButtonWithAccessibilityLabel(identity.userEmail); 142 TapButtonWithAccessibilityLabel(identity.userEmail);
141 143
142 // Sign in and confirm. 144 // Sign in and confirm.
143 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SIGNIN_BUTTON); 145 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SIGNIN_BUTTON);
144 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_CONFIRMATION_OK_BUTTON); 146 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_CONFIRMATION_OK_BUTTON);
145 147
146 // Close Settings. 148 [[EarlGrey selectElementWithMatcher:NavigationBarDoneButton()]
147 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); 149 performAction:grey_tap()];
148 150
149 // Check |identity| is signed-in. 151 // Check |identity| is signed-in.
150 AssertAuthenticatedIdentityInActiveProfile(identity); 152 AssertAuthenticatedIdentityInActiveProfile(identity);
151 } 153 }
152 154
153 // Tests signing in with one account, switching sync account to a second and 155 // Tests signing in with one account, switching sync account to a second and
154 // choosing to keep the browsing data separate during the switch. 156 // choosing to keep the browsing data separate during the switch.
155 - (void)testSignInSwitchAccountsAndKeepDataSeparate { 157 - (void)testSignInSwitchAccountsAndKeepDataSeparate {
156 // Set up the fake identities. 158 // Set up the fake identities.
157 ios::FakeChromeIdentityService* identity_service = 159 ios::FakeChromeIdentityService* identity_service =
(...skipping 20 matching lines...) Expand all
178 // Keep data separate, with synchronization off due to an infinite spinner. 180 // Keep data separate, with synchronization off due to an infinite spinner.
179 SetEarlGreySynchronizationEnabled(NO); 181 SetEarlGreySynchronizationEnabled(NO);
180 WaitForMatcher(grey_accessibilityID(kImportDataKeepSeparateCellId)); 182 WaitForMatcher(grey_accessibilityID(kImportDataKeepSeparateCellId));
181 TapViewWithAccessibilityId(kImportDataKeepSeparateCellId); 183 TapViewWithAccessibilityId(kImportDataKeepSeparateCellId);
182 TapButtonWithLabelId(IDS_IOS_OPTIONS_IMPORT_DATA_CONTINUE_BUTTON); 184 TapButtonWithLabelId(IDS_IOS_OPTIONS_IMPORT_DATA_CONTINUE_BUTTON);
183 SetEarlGreySynchronizationEnabled(YES); 185 SetEarlGreySynchronizationEnabled(YES);
184 186
185 // Check the signed-in user did change. 187 // Check the signed-in user did change.
186 AssertAuthenticatedIdentityInActiveProfile(identity2); 188 AssertAuthenticatedIdentityInActiveProfile(identity2);
187 189
188 // Close Settings. 190 [[EarlGrey selectElementWithMatcher:NavigationBarDoneButton()]
189 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); 191 performAction:grey_tap()];
190 } 192 }
191 193
192 // Tests signing in with one account, switching sync account to a second and 194 // Tests signing in with one account, switching sync account to a second and
193 // choosing to import the browsing data during the switch. 195 // choosing to import the browsing data during the switch.
194 - (void)testSignInSwitchAccountsAndImportData { 196 - (void)testSignInSwitchAccountsAndImportData {
195 // Set up the fake identities. 197 // Set up the fake identities.
196 ios::FakeChromeIdentityService* identity_service = 198 ios::FakeChromeIdentityService* identity_service =
197 ios::FakeChromeIdentityService::GetInstanceFromChromeProvider(); 199 ios::FakeChromeIdentityService::GetInstanceFromChromeProvider();
198 ChromeIdentity* identity1 = GetFakeIdentity1(); 200 ChromeIdentity* identity1 = GetFakeIdentity1();
199 ChromeIdentity* identity2 = GetFakeIdentity2(); 201 ChromeIdentity* identity2 = GetFakeIdentity2();
(...skipping 17 matching lines...) Expand all
217 // Import data, with synchronization off due to an infinite spinner. 219 // Import data, with synchronization off due to an infinite spinner.
218 SetEarlGreySynchronizationEnabled(NO); 220 SetEarlGreySynchronizationEnabled(NO);
219 WaitForMatcher(grey_accessibilityID(kImportDataImportCellId)); 221 WaitForMatcher(grey_accessibilityID(kImportDataImportCellId));
220 TapViewWithAccessibilityId(kImportDataImportCellId); 222 TapViewWithAccessibilityId(kImportDataImportCellId);
221 TapButtonWithLabelId(IDS_IOS_OPTIONS_IMPORT_DATA_CONTINUE_BUTTON); 223 TapButtonWithLabelId(IDS_IOS_OPTIONS_IMPORT_DATA_CONTINUE_BUTTON);
222 SetEarlGreySynchronizationEnabled(YES); 224 SetEarlGreySynchronizationEnabled(YES);
223 225
224 // Check the signed-in user did change. 226 // Check the signed-in user did change.
225 AssertAuthenticatedIdentityInActiveProfile(identity2); 227 AssertAuthenticatedIdentityInActiveProfile(identity2);
226 228
227 // Close Settings. 229 [[EarlGrey selectElementWithMatcher:NavigationBarDoneButton()]
228 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); 230 performAction:grey_tap()];
229 } 231 }
230 232
231 // Tests that switching from a managed account to a non-managed account works 233 // Tests that switching from a managed account to a non-managed account works
232 // correctly and displays the expected warnings. 234 // correctly and displays the expected warnings.
233 - (void)testSignInSwitchManagedAccount { 235 - (void)testSignInSwitchManagedAccount {
234 if (!experimental_flags::IsMDMIntegrationEnabled()) { 236 if (!experimental_flags::IsMDMIntegrationEnabled()) {
235 EARL_GREY_TEST_SKIPPED(@"Only enabled with MDM integration."); 237 EARL_GREY_TEST_SKIPPED(@"Only enabled with MDM integration.");
236 } 238 }
237 239
238 // Set up the fake identities. 240 // Set up the fake identities.
(...skipping 28 matching lines...) Expand all
267 // Accept warning for signout out of a managed identity, with synchronization 269 // Accept warning for signout out of a managed identity, with synchronization
268 // off due to an infinite spinner. 270 // off due to an infinite spinner.
269 SetEarlGreySynchronizationEnabled(NO); 271 SetEarlGreySynchronizationEnabled(NO);
270 WaitForMatcher(chrome_test_util::ButtonWithAccessibilityLabelId( 272 WaitForMatcher(chrome_test_util::ButtonWithAccessibilityLabelId(
271 IDS_IOS_MANAGED_SWITCH_ACCEPT_BUTTON)); 273 IDS_IOS_MANAGED_SWITCH_ACCEPT_BUTTON));
272 TapButtonWithLabelId(IDS_IOS_MANAGED_SWITCH_ACCEPT_BUTTON); 274 TapButtonWithLabelId(IDS_IOS_MANAGED_SWITCH_ACCEPT_BUTTON);
273 SetEarlGreySynchronizationEnabled(YES); 275 SetEarlGreySynchronizationEnabled(YES);
274 276
275 AssertAuthenticatedIdentityInActiveProfile(identity); 277 AssertAuthenticatedIdentityInActiveProfile(identity);
276 278
277 // Close Settings. 279 [[EarlGrey selectElementWithMatcher:NavigationBarDoneButton()]
278 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); 280 performAction:grey_tap()];
279 } 281 }
280 282
281 // Tests that signing out from the Settings works correctly. 283 // Tests that signing out from the Settings works correctly.
282 - (void)testSignInDisconnectFromChrome { 284 - (void)testSignInDisconnectFromChrome {
283 ChromeIdentity* identity = GetFakeIdentity1(); 285 ChromeIdentity* identity = GetFakeIdentity1();
284 ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()->AddIdentity( 286 ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()->AddIdentity(
285 identity); 287 identity);
286 288
287 // Sign in to |identity|. 289 // Sign in to |identity|.
288 OpenSignInFromSettings(); 290 OpenSignInFromSettings();
289 TapButtonWithAccessibilityLabel(identity.userEmail); 291 TapButtonWithAccessibilityLabel(identity.userEmail);
290 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SIGNIN_BUTTON); 292 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SIGNIN_BUTTON);
291 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_CONFIRMATION_OK_BUTTON); 293 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_CONFIRMATION_OK_BUTTON);
292 AssertAuthenticatedIdentityInActiveProfile(identity); 294 AssertAuthenticatedIdentityInActiveProfile(identity);
293 295
294 // Go to Accounts Settings and tap the sign out button. 296 // Go to Accounts Settings and tap the sign out button.
295 TapViewWithAccessibilityId(kSettingsAccountCellId); 297 TapViewWithAccessibilityId(kSettingsAccountCellId);
296 const CGFloat scroll_displacement = 100.0; 298 const CGFloat scroll_displacement = 100.0;
297 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID( 299 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(
298 kSettingsAccountsSignoutCellId)] 300 kSettingsAccountsSignoutCellId)]
299 usingSearchAction:grey_scrollInDirection(kGREYDirectionDown, 301 usingSearchAction:grey_scrollInDirection(kGREYDirectionDown,
300 scroll_displacement) 302 scroll_displacement)
301 onElementWithMatcher:grey_accessibilityID(kSettingsAccountsId)] 303 onElementWithMatcher:grey_accessibilityID(kSettingsAccountsId)]
302 performAction:grey_tap()]; 304 performAction:grey_tap()];
303 TapButtonWithLabelId(IDS_IOS_DISCONNECT_DIALOG_CONTINUE_BUTTON_MOBILE); 305 TapButtonWithLabelId(IDS_IOS_DISCONNECT_DIALOG_CONTINUE_BUTTON_MOBILE);
304 306
305 // Check that the settings home screen is shown. 307 // Check that the settings home screen is shown.
306 WaitForMatcher(grey_accessibilityID(kSettingsSignInCellId)); 308 WaitForMatcher(grey_accessibilityID(kSettingsSignInCellId));
307 309
308 // Close Settings. 310 [[EarlGrey selectElementWithMatcher:NavigationBarDoneButton()]
309 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); 311 performAction:grey_tap()];
310 312
311 // Check that there is no signed in user. 313 // Check that there is no signed in user.
312 AssertAuthenticatedIdentityInActiveProfile(nil); 314 AssertAuthenticatedIdentityInActiveProfile(nil);
313 } 315 }
314 316
315 // Tests that signing out of a managed account from the Settings works 317 // Tests that signing out of a managed account from the Settings works
316 // correctly. 318 // correctly.
317 - (void)testSignInDisconnectFromChromeManaged { 319 - (void)testSignInDisconnectFromChromeManaged {
318 if (!experimental_flags::IsMDMIntegrationEnabled()) { 320 if (!experimental_flags::IsMDMIntegrationEnabled()) {
319 EARL_GREY_TEST_SKIPPED(@"Only enabled with MDM integration."); 321 EARL_GREY_TEST_SKIPPED(@"Only enabled with MDM integration.");
(...skipping 23 matching lines...) Expand all
343 kSettingsAccountsSignoutCellId)] 345 kSettingsAccountsSignoutCellId)]
344 usingSearchAction:grey_scrollInDirection(kGREYDirectionDown, 346 usingSearchAction:grey_scrollInDirection(kGREYDirectionDown,
345 scroll_displacement) 347 scroll_displacement)
346 onElementWithMatcher:grey_accessibilityID(kSettingsAccountsId)] 348 onElementWithMatcher:grey_accessibilityID(kSettingsAccountsId)]
347 performAction:grey_tap()]; 349 performAction:grey_tap()];
348 TapButtonWithLabelId(IDS_IOS_MANAGED_DISCONNECT_DIALOG_ACCEPT); 350 TapButtonWithLabelId(IDS_IOS_MANAGED_DISCONNECT_DIALOG_ACCEPT);
349 351
350 // Check that the settings home screen is shown. 352 // Check that the settings home screen is shown.
351 WaitForMatcher(grey_accessibilityID(kSettingsSignInCellId)); 353 WaitForMatcher(grey_accessibilityID(kSettingsSignInCellId));
352 354
353 // Close Settings. 355 [[EarlGrey selectElementWithMatcher:NavigationBarDoneButton()]
354 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); 356 performAction:grey_tap()];
355 357
356 // Check that there is no signed in user. 358 // Check that there is no signed in user.
357 AssertAuthenticatedIdentityInActiveProfile(nil); 359 AssertAuthenticatedIdentityInActiveProfile(nil);
358 } 360 }
359 361
360 // Tests that signing in, tapping the Settings link on the confirmation screen 362 // Tests that signing in, tapping the Settings link on the confirmation screen
361 // and closing the Settings correctly leaves the user signed in without any 363 // and closing the Settings correctly leaves the user signed in without any
362 // Settings shown. 364 // Settings shown.
363 // TODO(crbug.com/718023): Re-enable test. 365 // TODO(crbug.com/718023): Re-enable test.
364 - (void)DISABLED_testSignInOpenSettings { 366 - (void)DISABLED_testSignInOpenSettings {
365 ChromeIdentity* identity = GetFakeIdentity1(); 367 ChromeIdentity* identity = GetFakeIdentity1();
366 ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()->AddIdentity( 368 ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()->AddIdentity(
367 identity); 369 identity);
368 370
369 // Sign in to |identity|. 371 // Sign in to |identity|.
370 OpenSignInFromSettings(); 372 OpenSignInFromSettings();
371 TapButtonWithAccessibilityLabel(identity.userEmail); 373 TapButtonWithAccessibilityLabel(identity.userEmail);
372 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SIGNIN_BUTTON); 374 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SIGNIN_BUTTON);
373 375
374 // Tap Settings link. 376 // Tap Settings link.
375 id<GREYMatcher> settings_link_matcher = grey_allOf( 377 id<GREYMatcher> settings_link_matcher = grey_allOf(
376 grey_accessibilityLabel(@"Settings"), grey_sufficientlyVisible(), nil); 378 grey_accessibilityLabel(@"Settings"), grey_sufficientlyVisible(), nil);
377 [[EarlGrey selectElementWithMatcher:settings_link_matcher] 379 [[EarlGrey selectElementWithMatcher:settings_link_matcher]
378 performAction:grey_tap()]; 380 performAction:grey_tap()];
379 381
380 // Close Settings. 382 [[EarlGrey selectElementWithMatcher:NavigationBarDoneButton()]
381 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); 383 performAction:grey_tap()];
382 384
383 // All Settings should be gone and user signed in. 385 // All Settings should be gone and user signed in.
384 id<GREYMatcher> settings_matcher = 386 id<GREYMatcher> settings_matcher =
385 chrome_test_util::StaticTextWithAccessibilityLabelId( 387 chrome_test_util::StaticTextWithAccessibilityLabelId(
386 IDS_IOS_SETTINGS_TITLE); 388 IDS_IOS_SETTINGS_TITLE);
387 [[EarlGrey selectElementWithMatcher:settings_matcher] 389 [[EarlGrey selectElementWithMatcher:settings_matcher]
388 assertWithMatcher:grey_notVisible()]; 390 assertWithMatcher:grey_notVisible()];
389 AssertAuthenticatedIdentityInActiveProfile(identity); 391 AssertAuthenticatedIdentityInActiveProfile(identity);
390 } 392 }
391 393
(...skipping 17 matching lines...) Expand all
409 // this will fail. 411 // this will fail.
410 OpenSignInFromSettings(); 412 OpenSignInFromSettings();
411 id<GREYMatcher> signin_matcher = 413 id<GREYMatcher> signin_matcher =
412 chrome_test_util::StaticTextWithAccessibilityLabelId( 414 chrome_test_util::StaticTextWithAccessibilityLabelId(
413 IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_DESCRIPTION); 415 IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_DESCRIPTION);
414 [[EarlGrey selectElementWithMatcher:signin_matcher] 416 [[EarlGrey selectElementWithMatcher:signin_matcher]
415 assertWithMatcher:grey_sufficientlyVisible()]; 417 assertWithMatcher:grey_sufficientlyVisible()];
416 418
417 // Close sign-in screen and Settings. 419 // Close sign-in screen and Settings.
418 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON); 420 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON);
419 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); 421 [[EarlGrey selectElementWithMatcher:NavigationBarDoneButton()]
422 performAction:grey_tap()];
420 } 423 }
421 424
422 // Opens the add account screen and then cancels it by opening a new tab. 425 // Opens the add account screen and then cancels it by opening a new tab.
423 // Ensures that the add account screen is correctly dismissed. crbug.com/462200 426 // Ensures that the add account screen is correctly dismissed. crbug.com/462200
424 - (void)testSignInCancelAddAccount { 427 - (void)testSignInCancelAddAccount {
425 // Add an identity to avoid arriving on the Add Account screen when opening 428 // Add an identity to avoid arriving on the Add Account screen when opening
426 // sign-in. 429 // sign-in.
427 ChromeIdentity* identity = GetFakeIdentity1(); 430 ChromeIdentity* identity = GetFakeIdentity1();
428 ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()->AddIdentity( 431 ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()->AddIdentity(
429 identity); 432 identity);
(...skipping 16 matching lines...) Expand all
446 // Re-open the sign-in screen. If it wasn't correctly dismissed previously, 449 // Re-open the sign-in screen. If it wasn't correctly dismissed previously,
447 // this will fail. 450 // this will fail.
448 OpenSignInFromSettings(); 451 OpenSignInFromSettings();
449 id<GREYMatcher> signin_matcher = 452 id<GREYMatcher> signin_matcher =
450 chrome_test_util::StaticTextWithAccessibilityLabelId( 453 chrome_test_util::StaticTextWithAccessibilityLabelId(
451 IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_DESCRIPTION); 454 IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_DESCRIPTION);
452 [[EarlGrey selectElementWithMatcher:signin_matcher] 455 [[EarlGrey selectElementWithMatcher:signin_matcher]
453 assertWithMatcher:grey_sufficientlyVisible()]; 456 assertWithMatcher:grey_sufficientlyVisible()];
454 457
455 // Close sign-in screen and Settings. 458 // Close sign-in screen and Settings.
456 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON); 459 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON);
baxley 2017/05/08 22:38:36 There's another bug to get rid of these methods, s
457 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); 460 [[EarlGrey selectElementWithMatcher:NavigationBarDoneButton()]
461 performAction:grey_tap()];
458 } 462 }
459 463
460 // Starts an authentication flow and cancel it by opening a new tab. Ensures 464 // Starts an authentication flow and cancel it by opening a new tab. Ensures
461 // that the authentication flow is correctly canceled and dismissed. 465 // that the authentication flow is correctly canceled and dismissed.
462 // crbug.com/462202 466 // crbug.com/462202
463 - (void)testSignInCancelAuthenticationFlow { 467 - (void)testSignInCancelAuthenticationFlow {
464 // Set up the fake identities. 468 // Set up the fake identities.
465 ios::FakeChromeIdentityService* identity_service = 469 ios::FakeChromeIdentityService* identity_service =
466 ios::FakeChromeIdentityService::GetInstanceFromChromeProvider(); 470 ios::FakeChromeIdentityService::GetInstanceFromChromeProvider();
467 ChromeIdentity* identity1 = GetFakeIdentity1(); 471 ChromeIdentity* identity1 = GetFakeIdentity1();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 // this will fail. 510 // this will fail.
507 OpenSignInFromSettings(); 511 OpenSignInFromSettings();
508 id<GREYMatcher> signin_matcher = 512 id<GREYMatcher> signin_matcher =
509 chrome_test_util::StaticTextWithAccessibilityLabelId( 513 chrome_test_util::StaticTextWithAccessibilityLabelId(
510 IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_DESCRIPTION); 514 IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_DESCRIPTION);
511 [[EarlGrey selectElementWithMatcher:signin_matcher] 515 [[EarlGrey selectElementWithMatcher:signin_matcher]
512 assertWithMatcher:grey_sufficientlyVisible()]; 516 assertWithMatcher:grey_sufficientlyVisible()];
513 517
514 // Close sign-in screen and Settings. 518 // Close sign-in screen and Settings.
515 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON); 519 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON);
516 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); 520 [[EarlGrey selectElementWithMatcher:NavigationBarDoneButton()]
521 performAction:grey_tap()];
517 AssertAuthenticatedIdentityInActiveProfile(nil); 522 AssertAuthenticatedIdentityInActiveProfile(nil);
518 } 523 }
519 524
520 // Opens the sign in screen from the bookmarks and then cancel it by opening a 525 // Opens the sign in screen from the bookmarks and then cancel it by opening a
521 // new tab. Ensures that the sign in screen is correctly dismissed. 526 // new tab. Ensures that the sign in screen is correctly dismissed.
522 // Regression test for crbug.com/596029. 527 // Regression test for crbug.com/596029.
523 - (void)testSignInCancelFromBookmarks { 528 - (void)testSignInCancelFromBookmarks {
524 ChromeIdentity* identity = GetFakeIdentity1(); 529 ChromeIdentity* identity = GetFakeIdentity1();
525 ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()->AddIdentity( 530 ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()->AddIdentity(
526 identity); 531 identity);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 } 583 }
579 [[EarlGrey selectElementWithMatcher:all_bookmarks_matcher] 584 [[EarlGrey selectElementWithMatcher:all_bookmarks_matcher]
580 performAction:grey_tap()]; 585 performAction:grey_tap()];
581 TapButtonWithLabelId(IDS_IOS_BOOKMARK_PROMO_SIGN_IN_BUTTON); 586 TapButtonWithLabelId(IDS_IOS_BOOKMARK_PROMO_SIGN_IN_BUTTON);
582 [[EarlGrey selectElementWithMatcher:signin_matcher] 587 [[EarlGrey selectElementWithMatcher:signin_matcher]
583 assertWithMatcher:grey_sufficientlyVisible()]; 588 assertWithMatcher:grey_sufficientlyVisible()];
584 589
585 // Close sign-in screen and Bookmarks. 590 // Close sign-in screen and Bookmarks.
586 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON); 591 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON);
587 if (!IsIPadIdiom()) { 592 if (!IsIPadIdiom()) {
588 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); 593 [[EarlGrey selectElementWithMatcher:NavigationBarDoneButton()]
594 performAction:grey_tap()];
589 } 595 }
590 } 596 }
591 597
592 @end 598 @end
OLDNEW
« no previous file with comments | « no previous file | ios/chrome/browser/ui/history/history_ui_egtest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698