| 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 <UIKit/UIKit.h> | 6 #import <UIKit/UIKit.h> |
| 7 #import <XCTest/XCTest.h> | 7 #import <XCTest/XCTest.h> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #import "base/mac/bind_objc_block.h" | 11 #import "base/mac/bind_objc_block.h" |
| 12 #include "base/mac/foundation_util.h" | 12 #include "base/mac/foundation_util.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
| 15 #include "components/browsing_data/core/pref_names.h" | 15 #include "components/browsing_data/core/pref_names.h" |
| 16 #include "components/metrics/metrics_pref_names.h" | 16 #include "components/metrics/metrics_pref_names.h" |
| 17 #include "components/password_manager/core/common/password_manager_pref_names.h" | 17 #include "components/password_manager/core/common/password_manager_pref_names.h" |
| 18 #include "components/prefs/pref_member.h" | 18 #include "components/prefs/pref_member.h" |
| 19 #include "components/prefs/pref_service.h" | 19 #include "components/prefs/pref_service.h" |
| 20 #include "components/strings/grit/components_strings.h" | 20 #include "components/strings/grit/components_strings.h" |
| 21 #import "ios/chrome/app/main_controller.h" | 21 #import "ios/chrome/app/main_controller.h" |
| 22 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 22 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 23 #include "ios/chrome/browser/content_settings/host_content_settings_map_factory.
h" | 23 #include "ios/chrome/browser/content_settings/host_content_settings_map_factory.
h" |
| 24 #include "ios/chrome/browser/experimental_flags.h" | |
| 25 #include "ios/chrome/browser/pref_names.h" | 24 #include "ios/chrome/browser/pref_names.h" |
| 26 #import "ios/chrome/browser/ui/browser_view_controller.h" | 25 #import "ios/chrome/browser/ui/browser_view_controller.h" |
| 27 #import "ios/chrome/browser/ui/settings/clear_browsing_data_collection_view_cont
roller.h" | 26 #import "ios/chrome/browser/ui/settings/clear_browsing_data_collection_view_cont
roller.h" |
| 28 #import "ios/chrome/browser/ui/settings/settings_collection_view_controller.h" | 27 #import "ios/chrome/browser/ui/settings/settings_collection_view_controller.h" |
| 29 #include "ios/chrome/browser/ui/tools_menu/tools_menu_constants.h" | 28 #include "ios/chrome/browser/ui/tools_menu/tools_menu_constants.h" |
| 30 #import "ios/chrome/browser/ui/tools_menu/tools_popup_controller.h" | 29 #import "ios/chrome/browser/ui/tools_menu/tools_popup_controller.h" |
| 31 #include "ios/chrome/grit/ios_chromium_strings.h" | 30 #include "ios/chrome/grit/ios_chromium_strings.h" |
| 32 #include "ios/chrome/grit/ios_strings.h" | 31 #include "ios/chrome/grit/ios_strings.h" |
| 33 #include "ios/chrome/grit/ios_theme_resources.h" | 32 #include "ios/chrome/grit/ios_theme_resources.h" |
| 34 #import "ios/chrome/test/app/chrome_test_util.h" | 33 #import "ios/chrome/test/app/chrome_test_util.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 return ButtonWithAccessibilityLabelId(IDS_IOS_CLEAR_BROWSING_DATA_TITLE); | 123 return ButtonWithAccessibilityLabelId(IDS_IOS_CLEAR_BROWSING_DATA_TITLE); |
| 125 } | 124 } |
| 126 // Matcher for the Search Engine cell on the main Settings screen. | 125 // Matcher for the Search Engine cell on the main Settings screen. |
| 127 id<GREYMatcher> SearchEngineButton() { | 126 id<GREYMatcher> SearchEngineButton() { |
| 128 return ButtonWithAccessibilityLabelId(IDS_IOS_SEARCH_ENGINE_SETTING_TITLE); | 127 return ButtonWithAccessibilityLabelId(IDS_IOS_SEARCH_ENGINE_SETTING_TITLE); |
| 129 } | 128 } |
| 130 // Matcher for the Autofill Forms cell on the main Settings screen. | 129 // Matcher for the Autofill Forms cell on the main Settings screen. |
| 131 id<GREYMatcher> AutofillButton() { | 130 id<GREYMatcher> AutofillButton() { |
| 132 return ButtonWithAccessibilityLabelId(IDS_IOS_AUTOFILL); | 131 return ButtonWithAccessibilityLabelId(IDS_IOS_AUTOFILL); |
| 133 } | 132 } |
| 134 // Matcher for the Google Apps cell on the main Settings screen. | |
| 135 id<GREYMatcher> GoogleAppsButton() { | |
| 136 return ButtonWithAccessibilityLabelId(IDS_IOS_GOOGLE_APPS_SM_SETTINGS); | |
| 137 } | |
| 138 // Matcher for the Google Chrome cell on the main Settings screen. | 133 // Matcher for the Google Chrome cell on the main Settings screen. |
| 139 id<GREYMatcher> GoogleChromeButton() { | 134 id<GREYMatcher> GoogleChromeButton() { |
| 140 return ButtonWithAccessibilityLabelId(IDS_IOS_PRODUCT_NAME); | 135 return ButtonWithAccessibilityLabelId(IDS_IOS_PRODUCT_NAME); |
| 141 } | 136 } |
| 142 // Matcher for the Google Chrome cell on the main Settings screen. | 137 // Matcher for the Google Chrome cell on the main Settings screen. |
| 143 id<GREYMatcher> VoiceSearchButton() { | 138 id<GREYMatcher> VoiceSearchButton() { |
| 144 return grey_allOf(grey_accessibilityID(kSettingsVoiceSearchCellId), | 139 return grey_allOf(grey_accessibilityID(kSettingsVoiceSearchCellId), |
| 145 grey_accessibilityTrait(UIAccessibilityTraitButton), nil); | 140 grey_accessibilityTrait(UIAccessibilityTraitButton), nil); |
| 146 } | 141 } |
| 147 // Matcher for the Preload Webpages button on the bandwidth UI. | 142 // Matcher for the Preload Webpages button on the bandwidth UI. |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 } | 869 } |
| 875 | 870 |
| 876 // Verifies the UI elements are accessible on the Autofill Forms page. | 871 // Verifies the UI elements are accessible on the Autofill Forms page. |
| 877 - (void)testAccessibilityOnAutofillForms { | 872 - (void)testAccessibilityOnAutofillForms { |
| 878 [ChromeEarlGreyUI openSettingsMenu]; | 873 [ChromeEarlGreyUI openSettingsMenu]; |
| 879 [ChromeEarlGreyUI tapSettingsMenuButton:AutofillButton()]; | 874 [ChromeEarlGreyUI tapSettingsMenuButton:AutofillButton()]; |
| 880 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 875 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 881 [self closeSubSettingsMenu]; | 876 [self closeSubSettingsMenu]; |
| 882 } | 877 } |
| 883 | 878 |
| 884 // Verifies the UI elements are accessible on the Google Apps page. | |
| 885 - (void)testAccessibilityOnGoogleApps { | |
| 886 // TODO(crbug/711511): Remove when Native App Launcher is full deprecated. | |
| 887 if (!experimental_flags::IsNativeAppLauncherEnabled()) | |
| 888 return; | |
| 889 [ChromeEarlGreyUI openSettingsMenu]; | |
| 890 [ChromeEarlGreyUI tapSettingsMenuButton:GoogleAppsButton()]; | |
| 891 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | |
| 892 [self closeSubSettingsMenu]; | |
| 893 } | |
| 894 | |
| 895 // Verifies the UI elements are accessible on the About Chrome page. | 879 // Verifies the UI elements are accessible on the About Chrome page. |
| 896 - (void)testAccessibilityOnGoogleChrome { | 880 - (void)testAccessibilityOnGoogleChrome { |
| 897 [ChromeEarlGreyUI openSettingsMenu]; | 881 [ChromeEarlGreyUI openSettingsMenu]; |
| 898 [ChromeEarlGreyUI tapSettingsMenuButton:GoogleChromeButton()]; | 882 [ChromeEarlGreyUI tapSettingsMenuButton:GoogleChromeButton()]; |
| 899 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 883 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 900 [self closeSubSettingsMenu]; | 884 [self closeSubSettingsMenu]; |
| 901 } | 885 } |
| 902 | 886 |
| 903 // Verifies the UI elements are accessible on the Voice Search page. | 887 // Verifies the UI elements are accessible on the Voice Search page. |
| 904 - (void)testAccessibilityOnVoiceSearch { | 888 - (void)testAccessibilityOnVoiceSearch { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 // Verifies the UI elements are accessible on the Send Usage Data page. | 972 // Verifies the UI elements are accessible on the Send Usage Data page. |
| 989 - (void)testAccessibilityOnSendUsageData { | 973 - (void)testAccessibilityOnSendUsageData { |
| 990 [ChromeEarlGreyUI openSettingsMenu]; | 974 [ChromeEarlGreyUI openSettingsMenu]; |
| 991 [ChromeEarlGreyUI tapSettingsMenuButton:PrivacyButton()]; | 975 [ChromeEarlGreyUI tapSettingsMenuButton:PrivacyButton()]; |
| 992 [ChromeEarlGreyUI tapPrivacyMenuButton:SendUsageDataButton()]; | 976 [ChromeEarlGreyUI tapPrivacyMenuButton:SendUsageDataButton()]; |
| 993 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 977 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 994 [self closeSubSettingsMenu]; | 978 [self closeSubSettingsMenu]; |
| 995 } | 979 } |
| 996 | 980 |
| 997 @end | 981 @end |
| OLD | NEW |