Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "components/metrics/metrics_pref_names.h" | 10 #include "components/metrics/metrics_pref_names.h" |
| 10 #include "components/metrics/metrics_reporting_default_state.h" | 11 #include "components/metrics/metrics_reporting_default_state.h" |
| 11 #include "components/prefs/pref_member.h" | 12 #include "components/prefs/pref_member.h" |
| 12 #include "components/prefs/pref_service.h" | 13 #include "components/prefs/pref_service.h" |
| 13 #include "components/signin/core/browser/signin_manager.h" | 14 #include "components/signin/core/browser/signin_manager.h" |
| 14 #import "ios/chrome/app/main_controller.h" | 15 #import "ios/chrome/app/main_controller.h" |
| 15 #include "ios/chrome/browser/application_context.h" | 16 #include "ios/chrome/browser/application_context.h" |
| 16 #import "ios/chrome/browser/geolocation/omnibox_geolocation_controller+Testing.h " | 17 #import "ios/chrome/browser/geolocation/omnibox_geolocation_controller+Testing.h " |
| 17 #import "ios/chrome/browser/geolocation/omnibox_geolocation_controller.h" | 18 #import "ios/chrome/browser/geolocation/omnibox_geolocation_controller.h" |
| 18 #import "ios/chrome/browser/geolocation/test_location_manager.h" | 19 #import "ios/chrome/browser/geolocation/test_location_manager.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 208 // Undo the sign-in and dismiss the Sign In screen. | 209 // Undo the sign-in and dismiss the Sign In screen. |
| 209 [[EarlGrey selectElementWithMatcher:UndoAccountConsistencyButton()] | 210 [[EarlGrey selectElementWithMatcher:UndoAccountConsistencyButton()] |
| 210 performAction:grey_tap()]; | 211 performAction:grey_tap()]; |
| 211 [[EarlGrey selectElementWithMatcher:FirstRunAccountConsistencySkipButton()] | 212 [[EarlGrey selectElementWithMatcher:FirstRunAccountConsistencySkipButton()] |
| 212 performAction:grey_tap()]; | 213 performAction:grey_tap()]; |
| 213 | 214 |
| 214 // |identity| shouldn't be signed in. | 215 // |identity| shouldn't be signed in. |
| 215 AssertAuthenticatedIdentityInActiveProfile(nil); | 216 AssertAuthenticatedIdentityInActiveProfile(nil); |
| 216 } | 217 } |
| 217 | 218 |
| 218 // Signs in to an account and then taps the Advanced link to go to settings. | 219 - (void)testSignInAndTapSettingsLink { |
| 219 // TODO(crbug.com/718023): Re-enable test. | |
| 220 - (void)DISABLED_testSignInAndTapSettingsLink { | |
| 221 ChromeIdentity* identity = GetFakeIdentity(); | 220 ChromeIdentity* identity = GetFakeIdentity(); |
| 222 ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()->AddIdentity( | 221 ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()->AddIdentity( |
| 223 identity); | 222 identity); |
| 224 | 223 |
| 225 // Launch First Run and accept tems of services. | 224 // Launch First Run and accept tems of services. |
| 226 [chrome_test_util::GetMainController() showFirstRunUI]; | 225 [chrome_test_util::GetMainController() showFirstRunUI]; |
| 227 [[EarlGrey selectElementWithMatcher:FirstRunOptInAcceptButton()] | 226 [[EarlGrey selectElementWithMatcher:FirstRunOptInAcceptButton()] |
| 228 performAction:grey_tap()]; | 227 performAction:grey_tap()]; |
| 229 | 228 |
| 230 // Sign In |identity|. | 229 // Sign In |identity|. |
| 231 [[EarlGrey selectElementWithMatcher:AccountConsistencySetupSigninButton()] | 230 [[EarlGrey selectElementWithMatcher:AccountConsistencySetupSigninButton()] |
| 232 performAction:grey_tap()]; | 231 performAction:grey_tap()]; |
| 233 AssertAuthenticatedIdentityInActiveProfile(identity); | 232 AssertAuthenticatedIdentityInActiveProfile(identity); |
| 234 | 233 |
| 234 // Short delay to allow animation to complete and let time for the "Settings" | |
| 235 // label to arrive (issue with flakyness, see crbug.com/718023). | |
| 236 base::test::ios::SpinRunLoopWithMaxDelay(base::TimeDelta::FromSecondsD(0.5)); | |
|
baxley
2017/05/31 15:51:29
Similar to the other comment, could you add in the
| |
| 237 | |
| 235 // Tap Settings link. | 238 // Tap Settings link. |
| 236 id<GREYMatcher> settings_link_matcher = grey_allOf( | 239 id<GREYMatcher> settings_link_matcher = grey_allOf( |
| 237 grey_accessibilityLabel(@"Settings"), grey_sufficientlyVisible(), nil); | 240 grey_accessibilityLabel(@"Settings"), grey_sufficientlyVisible(), nil); |
| 238 [[EarlGrey selectElementWithMatcher:settings_link_matcher] | 241 [[EarlGrey selectElementWithMatcher:settings_link_matcher] |
| 239 performAction:grey_tap()]; | 242 performAction:grey_tap()]; |
| 240 | 243 |
| 241 // Check Sync hasn't started yet, allowing the user to change somes settings. | 244 // Check Sync hasn't started yet, allowing the user to change somes settings. |
| 242 SyncSetupService* sync_service = SyncSetupServiceFactory::GetForBrowserState( | 245 SyncSetupService* sync_service = SyncSetupServiceFactory::GetForBrowserState( |
| 243 chrome_test_util::GetOriginalBrowserState()); | 246 chrome_test_util::GetOriginalBrowserState()); |
| 244 GREYAssertFalse(sync_service->HasFinishedInitialSetup(), | 247 GREYAssertFalse(sync_service->HasFinishedInitialSetup(), |
| 245 @"Sync shouldn't have finished its original setup yet"); | 248 @"Sync shouldn't have finished its original setup yet"); |
| 246 | 249 |
| 247 // Close Settings, user is still signed in and sync is now starting. | 250 // Close Settings, user is still signed in and sync is now starting. |
| 248 [[EarlGrey selectElementWithMatcher:NavigationBarDoneButton()] | 251 [[EarlGrey selectElementWithMatcher:NavigationBarDoneButton()] |
| 249 performAction:grey_tap()]; | 252 performAction:grey_tap()]; |
| 250 AssertAuthenticatedIdentityInActiveProfile(identity); | 253 AssertAuthenticatedIdentityInActiveProfile(identity); |
| 251 GREYAssertTrue(sync_service->HasFinishedInitialSetup(), | 254 GREYAssertTrue(sync_service->HasFinishedInitialSetup(), |
| 252 @"Sync should have finished its original setup"); | 255 @"Sync should have finished its original setup"); |
| 253 } | 256 } |
| 254 | 257 |
| 255 @end | 258 @end |
| OLD | NEW |