| 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 #include "components/metrics/metrics_pref_names.h" | 9 #include "components/metrics/metrics_pref_names.h" |
| 10 #include "components/metrics/metrics_reporting_default_state.h" | 10 #include "components/metrics/metrics_reporting_default_state.h" |
| 11 #include "components/prefs/pref_member.h" | 11 #include "components/prefs/pref_member.h" |
| 12 #include "components/prefs/pref_service.h" | 12 #include "components/prefs/pref_service.h" |
| 13 #include "components/signin/core/browser/signin_manager.h" | 13 #include "components/signin/core/browser/signin_manager.h" |
| 14 #import "ios/chrome/app/main_controller.h" | 14 #import "ios/chrome/app/main_controller.h" |
| 15 #include "ios/chrome/browser/application_context.h" | 15 #include "ios/chrome/browser/application_context.h" |
| 16 #import "ios/chrome/browser/geolocation/omnibox_geolocation_controller+Testing.h
" | 16 #import "ios/chrome/browser/geolocation/omnibox_geolocation_controller+Testing.h
" |
| 17 #import "ios/chrome/browser/geolocation/omnibox_geolocation_controller.h" | 17 #import "ios/chrome/browser/geolocation/omnibox_geolocation_controller.h" |
| 18 #import "ios/chrome/browser/geolocation/test_location_manager.h" | 18 #import "ios/chrome/browser/geolocation/test_location_manager.h" |
| 19 #include "ios/chrome/browser/signin/signin_manager_factory.h" | 19 #include "ios/chrome/browser/signin/signin_manager_factory.h" |
| 20 #include "ios/chrome/browser/sync/sync_setup_service.h" | 20 #include "ios/chrome/browser/sync/sync_setup_service.h" |
| 21 #include "ios/chrome/browser/sync/sync_setup_service_factory.h" | 21 #include "ios/chrome/browser/sync/sync_setup_service_factory.h" |
| 22 #import "ios/chrome/browser/ui/first_run/first_run_chrome_signin_view_controller
.h" | 22 #import "ios/chrome/browser/ui/first_run/first_run_chrome_signin_view_controller
.h" |
| 23 #include "ios/chrome/browser/ui/first_run/welcome_to_chrome_view_controller.h" | 23 #include "ios/chrome/browser/ui/first_run/welcome_to_chrome_view_controller.h" |
| 24 #include "ios/chrome/grit/ios_chromium_strings.h" |
| 24 #include "ios/chrome/grit/ios_strings.h" | 25 #include "ios/chrome/grit/ios_strings.h" |
| 25 #import "ios/chrome/test/app/chrome_test_util.h" | 26 #import "ios/chrome/test/app/chrome_test_util.h" |
| 26 #import "ios/chrome/test/earl_grey/chrome_matchers.h" | 27 #import "ios/chrome/test/earl_grey/chrome_matchers.h" |
| 27 #import "ios/chrome/test/earl_grey/chrome_test_case.h" | 28 #import "ios/chrome/test/earl_grey/chrome_test_case.h" |
| 28 #import "ios/public/provider/chrome/browser/signin/fake_chrome_identity.h" | 29 #import "ios/public/provider/chrome/browser/signin/fake_chrome_identity.h" |
| 29 #import "ios/public/provider/chrome/browser/signin/fake_chrome_identity_service.
h" | 30 #import "ios/public/provider/chrome/browser/signin/fake_chrome_identity_service.
h" |
| 30 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
| 31 | 32 |
| 32 #if !defined(__has_feature) || !__has_feature(objc_arc) | 33 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 33 #error "This file requires ARC support." | 34 #error "This file requires ARC support." |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 108 |
| 108 // Navigates to the terms of service and back. | 109 // Navigates to the terms of service and back. |
| 109 - (void)testTermsAndConditions { | 110 - (void)testTermsAndConditions { |
| 110 [chrome_test_util::GetMainController() showFirstRunUI]; | 111 [chrome_test_util::GetMainController() showFirstRunUI]; |
| 111 | 112 |
| 112 id<GREYMatcher> termsOfServiceLink = | 113 id<GREYMatcher> termsOfServiceLink = |
| 113 grey_accessibilityLabel(@"Terms of Service"); | 114 grey_accessibilityLabel(@"Terms of Service"); |
| 114 [[EarlGrey selectElementWithMatcher:termsOfServiceLink] | 115 [[EarlGrey selectElementWithMatcher:termsOfServiceLink] |
| 115 performAction:grey_tap()]; | 116 performAction:grey_tap()]; |
| 116 | 117 |
| 117 [[EarlGrey selectElementWithMatcher:grey_text(@"Chromium Terms of Service")] | 118 [[EarlGrey selectElementWithMatcher:grey_text(l10n_util::GetNSString( |
| 119 IDS_IOS_FIRSTRUN_TERMS_TITLE))] |
| 118 assertWithMatcher:grey_sufficientlyVisible()]; | 120 assertWithMatcher:grey_sufficientlyVisible()]; |
| 119 | 121 |
| 120 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"back_bar_button")] | 122 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"back_bar_button")] |
| 121 performAction:grey_tap()]; | 123 performAction:grey_tap()]; |
| 122 | 124 |
| 123 // Ensure we went back to the First Run screen. | 125 // Ensure we went back to the First Run screen. |
| 124 [[EarlGrey selectElementWithMatcher:termsOfServiceLink] | 126 [[EarlGrey selectElementWithMatcher:termsOfServiceLink] |
| 125 assertWithMatcher:grey_sufficientlyVisible()]; | 127 assertWithMatcher:grey_sufficientlyVisible()]; |
| 126 } | 128 } |
| 127 | 129 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 @"Sync shouldn't have finished its original setup yet"); | 219 @"Sync shouldn't have finished its original setup yet"); |
| 218 | 220 |
| 219 // Close Settings, user is still signed in and sync is now starting. | 221 // Close Settings, user is still signed in and sync is now starting. |
| 220 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); | 222 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); |
| 221 AssertAuthenticatedIdentityInActiveProfile(identity); | 223 AssertAuthenticatedIdentityInActiveProfile(identity); |
| 222 GREYAssertTrue(sync_service->HasFinishedInitialSetup(), | 224 GREYAssertTrue(sync_service->HasFinishedInitialSetup(), |
| 223 @"Sync should have finished its original setup"); | 225 @"Sync should have finished its original setup"); |
| 224 } | 226 } |
| 225 | 227 |
| 226 @end | 228 @end |
| OLD | NEW |