| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 return ButtonWithAccessibilityLabelId(IDS_IOS_CLEAR_BROWSING_DATA_TITLE); | 121 return ButtonWithAccessibilityLabelId(IDS_IOS_CLEAR_BROWSING_DATA_TITLE); |
| 123 } | 122 } |
| 124 // Matcher for the Search Engine cell on the main Settings screen. | 123 // Matcher for the Search Engine cell on the main Settings screen. |
| 125 id<GREYMatcher> SearchEngineButton() { | 124 id<GREYMatcher> SearchEngineButton() { |
| 126 return ButtonWithAccessibilityLabelId(IDS_IOS_SEARCH_ENGINE_SETTING_TITLE); | 125 return ButtonWithAccessibilityLabelId(IDS_IOS_SEARCH_ENGINE_SETTING_TITLE); |
| 127 } | 126 } |
| 128 // Matcher for the Autofill Forms cell on the main Settings screen. | 127 // Matcher for the Autofill Forms cell on the main Settings screen. |
| 129 id<GREYMatcher> AutofillButton() { | 128 id<GREYMatcher> AutofillButton() { |
| 130 return ButtonWithAccessibilityLabelId(IDS_IOS_AUTOFILL); | 129 return ButtonWithAccessibilityLabelId(IDS_IOS_AUTOFILL); |
| 131 } | 130 } |
| 132 // Matcher for the Google Apps cell on the main Settings screen. | |
| 133 id<GREYMatcher> GoogleAppsButton() { | |
| 134 return ButtonWithAccessibilityLabelId(IDS_IOS_GOOGLE_APPS_SM_SETTINGS); | |
| 135 } | |
| 136 // Matcher for the Google Chrome cell on the main Settings screen. | 131 // Matcher for the Google Chrome cell on the main Settings screen. |
| 137 id<GREYMatcher> GoogleChromeButton() { | 132 id<GREYMatcher> GoogleChromeButton() { |
| 138 return ButtonWithAccessibilityLabelId(IDS_IOS_PRODUCT_NAME); | 133 return ButtonWithAccessibilityLabelId(IDS_IOS_PRODUCT_NAME); |
| 139 } | 134 } |
| 140 // Matcher for the Google Chrome cell on the main Settings screen. | 135 // Matcher for the Google Chrome cell on the main Settings screen. |
| 141 id<GREYMatcher> VoiceSearchButton() { | 136 id<GREYMatcher> VoiceSearchButton() { |
| 142 return grey_allOf(grey_accessibilityID(kSettingsVoiceSearchCellId), | 137 return grey_allOf(grey_accessibilityID(kSettingsVoiceSearchCellId), |
| 143 grey_accessibilityTrait(UIAccessibilityTraitButton), nil); | 138 grey_accessibilityTrait(UIAccessibilityTraitButton), nil); |
| 144 } | 139 } |
| 145 // Matcher for the Preload Webpages button on the bandwidth UI. | 140 // Matcher for the Preload Webpages button on the bandwidth UI. |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 } | 858 } |
| 864 | 859 |
| 865 // Verifies the UI elements are accessible on the Autofill Forms page. | 860 // Verifies the UI elements are accessible on the Autofill Forms page. |
| 866 - (void)testAccessibilityOnAutofillForms { | 861 - (void)testAccessibilityOnAutofillForms { |
| 867 [ChromeEarlGreyUI openSettingsMenu]; | 862 [ChromeEarlGreyUI openSettingsMenu]; |
| 868 [ChromeEarlGreyUI tapSettingsMenuButton:AutofillButton()]; | 863 [ChromeEarlGreyUI tapSettingsMenuButton:AutofillButton()]; |
| 869 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 864 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 870 [self closeSubSettingsMenu]; | 865 [self closeSubSettingsMenu]; |
| 871 } | 866 } |
| 872 | 867 |
| 873 // Verifies the UI elements are accessible on the Google Apps page. | |
| 874 - (void)testAccessibilityOnGoogleApps { | |
| 875 // TODO(crbug/711511): Remove when Native App Launcher is full deprecated. | |
| 876 if (!experimental_flags::IsNativeAppLauncherEnabled()) | |
| 877 return; | |
| 878 [ChromeEarlGreyUI openSettingsMenu]; | |
| 879 [ChromeEarlGreyUI tapSettingsMenuButton:GoogleAppsButton()]; | |
| 880 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | |
| 881 [self closeSubSettingsMenu]; | |
| 882 } | |
| 883 | |
| 884 // Verifies the UI elements are accessible on the About Chrome page. | 868 // Verifies the UI elements are accessible on the About Chrome page. |
| 885 - (void)testAccessibilityOnGoogleChrome { | 869 - (void)testAccessibilityOnGoogleChrome { |
| 886 [ChromeEarlGreyUI openSettingsMenu]; | 870 [ChromeEarlGreyUI openSettingsMenu]; |
| 887 [ChromeEarlGreyUI tapSettingsMenuButton:GoogleChromeButton()]; | 871 [ChromeEarlGreyUI tapSettingsMenuButton:GoogleChromeButton()]; |
| 888 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 872 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 889 [self closeSubSettingsMenu]; | 873 [self closeSubSettingsMenu]; |
| 890 } | 874 } |
| 891 | 875 |
| 892 // Verifies the UI elements are accessible on the Voice Search page. | 876 // Verifies the UI elements are accessible on the Voice Search page. |
| 893 - (void)testAccessibilityOnVoiceSearch { | 877 - (void)testAccessibilityOnVoiceSearch { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 // Verifies the UI elements are accessible on the Send Usage Data page. | 970 // Verifies the UI elements are accessible on the Send Usage Data page. |
| 987 - (void)testAccessibilityOnSendUsageData { | 971 - (void)testAccessibilityOnSendUsageData { |
| 988 [ChromeEarlGreyUI openSettingsMenu]; | 972 [ChromeEarlGreyUI openSettingsMenu]; |
| 989 [ChromeEarlGreyUI tapSettingsMenuButton:PrivacyButton()]; | 973 [ChromeEarlGreyUI tapSettingsMenuButton:PrivacyButton()]; |
| 990 [ChromeEarlGreyUI tapPrivacyMenuButton:SendUsageDataButton()]; | 974 [ChromeEarlGreyUI tapPrivacyMenuButton:SendUsageDataButton()]; |
| 991 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 975 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 992 [self closeSubSettingsMenu]; | 976 [self closeSubSettingsMenu]; |
| 993 } | 977 } |
| 994 | 978 |
| 995 @end | 979 @end |
| OLD | NEW |