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 <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" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 return ButtonWithAccessibilityLabelId(IDS_IOS_BLOCK_POPUPS); | 155 return ButtonWithAccessibilityLabelId(IDS_IOS_BLOCK_POPUPS); |
| 156 } | 156 } |
| 157 // Matcher for the Privacy Translate Settings button on the privacy UI. | 157 // Matcher for the Privacy Translate Settings button on the privacy UI. |
| 158 id<GREYMatcher> TranslateSettingsButton() { | 158 id<GREYMatcher> TranslateSettingsButton() { |
| 159 return ButtonWithAccessibilityLabelId(IDS_IOS_TRANSLATE_SETTING); | 159 return ButtonWithAccessibilityLabelId(IDS_IOS_TRANSLATE_SETTING); |
| 160 } | 160 } |
| 161 // Matcher for the save button in the save password bar. | 161 // Matcher for the save button in the save password bar. |
| 162 id<GREYMatcher> SavePasswordButton() { | 162 id<GREYMatcher> SavePasswordButton() { |
| 163 return ButtonWithAccessibilityLabelId(IDS_IOS_PASSWORD_MANAGER_SAVE_BUTTON); | 163 return ButtonWithAccessibilityLabelId(IDS_IOS_PASSWORD_MANAGER_SAVE_BUTTON); |
| 164 } | 164 } |
| 165 // Matcher for the Content Settings button on the main Settings screen. | |
| 166 id<GREYMatcher> ContentSettingsButton() { | |
| 167 return ButtonWithAccessibilityLabelId(IDS_IOS_CONTENT_SETTINGS_TITLE); | |
| 168 } | |
| 169 // Matcher for the Bandwidth Settings button on the main Settings screen. | |
| 170 id<GREYMatcher> BandwidthSettingsButton() { | |
| 171 return ButtonWithAccessibilityLabelId(IDS_IOS_BANDWIDTH_MANAGEMENT_SETTINGS); | |
| 172 } | |
| 165 | 173 |
| 166 // Run as a task to check if a certificate has been added to the ChannelIDStore. | 174 // Run as a task to check if a certificate has been added to the ChannelIDStore. |
| 167 // Signals the given |semaphore| if the cert was added, or reposts itself | 175 // Signals the given |semaphore| if the cert was added, or reposts itself |
| 168 // otherwise. | 176 // otherwise. |
| 169 void CheckCertificate(scoped_refptr<net::URLRequestContextGetter> getter, | 177 void CheckCertificate(scoped_refptr<net::URLRequestContextGetter> getter, |
| 170 dispatch_semaphore_t semaphore) { | 178 dispatch_semaphore_t semaphore) { |
| 171 net::ChannelIDService* channel_id_service = | 179 net::ChannelIDService* channel_id_service = |
| 172 getter->GetURLRequestContext()->channel_id_service(); | 180 getter->GetURLRequestContext()->channel_id_service(); |
| 173 if (channel_id_service->channel_id_count() == 0) { | 181 if (channel_id_service->channel_id_count() == 0) { |
| 174 // If the channel_id_count is still 0, no certs have been added yet. | 182 // If the channel_id_count is still 0, no certs have been added yet. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 } | 245 } |
| 238 | 246 |
| 239 } // namespace | 247 } // namespace |
| 240 | 248 |
| 241 // Settings tests for Chrome. | 249 // Settings tests for Chrome. |
| 242 @interface SettingsTestCase : ChromeTestCase | 250 @interface SettingsTestCase : ChromeTestCase |
| 243 @end | 251 @end |
| 244 | 252 |
| 245 @implementation SettingsTestCase | 253 @implementation SettingsTestCase |
| 246 | 254 |
| 247 // Opens the a submenu from the settings page. Must be called from the NTP. | |
| 248 // TODO(crbug.com/684619): Investigate why usingSearchAction doesn't scroll | |
| 249 // until the bottom. | |
| 250 - (void)openSubSettingMenu:(id<GREYMatcher>)settingToTap { | |
| 251 const CGFloat kScrollDisplacement = 150.0; | |
| 252 id<GREYMatcher> settingsCollectionViewMatcher = | |
| 253 grey_accessibilityID(kSettingsCollectionViewId); | |
| 254 | |
| 255 [ChromeEarlGreyUI openSettingsMenu]; | |
| 256 [[[EarlGrey selectElementWithMatcher:settingToTap] | |
| 257 usingSearchAction:grey_scrollInDirection(kGREYDirectionDown, | |
| 258 kScrollDisplacement) | |
| 259 onElementWithMatcher:settingsCollectionViewMatcher] | |
| 260 performAction:grey_tap()]; | |
| 261 } | |
| 262 | |
| 263 // Closes a sub-settings menu, and then the general Settings menu. | 255 // Closes a sub-settings menu, and then the general Settings menu. |
| 264 - (void)closeSubSettingsMenu { | 256 - (void)closeSubSettingsMenu { |
| 265 [[EarlGrey | 257 [[EarlGrey |
| 266 selectElementWithMatcher:grey_allOf( | 258 selectElementWithMatcher:grey_allOf( |
| 267 grey_accessibilityID(@"ic_arrow_back"), | 259 grey_accessibilityID(@"ic_arrow_back"), |
| 268 grey_accessibilityTrait( | 260 grey_accessibilityTrait( |
| 269 UIAccessibilityTraitButton), | 261 UIAccessibilityTraitButton), |
| 270 nil)] performAction:grey_tap()]; | 262 nil)] performAction:grey_tap()]; |
| 271 [[EarlGrey selectElementWithMatcher:NavigationBarDoneButton()] | 263 [[EarlGrey selectElementWithMatcher:NavigationBarDoneButton()] |
| 272 performAction:grey_tap()]; | 264 performAction:grey_tap()]; |
| 273 } | 265 } |
| 274 | 266 |
| 275 // Performs the steps to clear browsing data. Must be called on the | 267 // Performs the steps to clear browsing data. Must be called on the |
| 276 // Clear Browsing Data settings screen, after having selected the data types | 268 // Clear Browsing Data settings screen, after having selected the data types |
| 277 // scheduled for removal. | 269 // scheduled for removal. |
| 278 - (void)clearBrowsingData { | 270 - (void)clearBrowsingData { |
| 279 [[EarlGrey selectElementWithMatcher:ClearBrowsingDataButton()] | 271 [ChromeEarlGreyUI tapButtonInClearBrowsingDataMenu:ClearBrowsingDataButton()]; |
| 280 performAction:grey_tap()]; | |
| 281 [[EarlGrey selectElementWithMatcher:ConfirmClearBrowsingDataButton()] | 272 [[EarlGrey selectElementWithMatcher:ConfirmClearBrowsingDataButton()] |
| 282 performAction:grey_tap()]; | 273 performAction:grey_tap()]; |
| 274 | |
| 275 // Before returning, make sure that the top of the Clear Browsing Data | |
| 276 // settings screen is visible to match the state at the start of the method. | |
| 277 id<GREYMatcher> clearBrowsingDataViewMatcher = | |
|
Eugene But (OOO till 7-30)
2017/05/09 00:15:03
nit: Do you want to create a function for this mat
baxley
2017/05/09 18:39:19
Good idea. It's used in a few files so I put it in
| |
| 278 grey_accessibilityID(kClearBrowsingDataCollectionViewId); | |
| 279 [[EarlGrey selectElementWithMatcher:clearBrowsingDataViewMatcher] | |
| 280 performAction:grey_scrollToContentEdge(kGREYContentEdgeTop)]; | |
| 283 } | 281 } |
| 284 | 282 |
| 285 // Exits Settings by clicking on the Done button. | 283 // Exits Settings by clicking on the Done button. |
| 286 - (void)dismissSettings { | 284 - (void)dismissSettings { |
| 287 // Dismiss the settings. | 285 // Dismiss the settings. |
| 288 [[EarlGrey selectElementWithMatcher:NavigationBarDoneButton()] | 286 [[EarlGrey selectElementWithMatcher:NavigationBarDoneButton()] |
| 289 performAction:grey_tap()]; | 287 performAction:grey_tap()]; |
| 290 | 288 |
| 291 // Wait for UI components to finish loading. | 289 // Wait for UI components to finish loading. |
| 292 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; | 290 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; |
| 293 } | 291 } |
| 294 | 292 |
| 295 // From the NTP, clears the cookies and site data via the UI. | 293 // From the NTP, clears the cookies and site data via the UI. |
| 296 - (void)clearCookiesAndSiteData { | 294 - (void)clearCookiesAndSiteData { |
| 297 [ChromeEarlGreyUI openSettingsMenu]; | 295 [ChromeEarlGreyUI openSettingsMenu]; |
| 298 [[EarlGrey selectElementWithMatcher:PrivacyButton()] | 296 [ChromeEarlGreyUI tapButtonInSettingsMenu:PrivacyButton()]; |
| 299 performAction:grey_tap()]; | 297 [ChromeEarlGreyUI tapButtonInPrivacyMenu:ClearBrowsingDataCell()]; |
| 300 [[EarlGrey selectElementWithMatcher:ClearBrowsingDataCell()] | |
| 301 performAction:grey_tap()]; | |
| 302 | 298 |
| 303 // "Browsing history", "Cookies, Site Data" and "Cached Images and Files" | 299 // "Browsing history", "Cookies, Site Data" and "Cached Images and Files" |
| 304 // are the default checked options when the prefs are registered. Uncheck | 300 // are the default checked options when the prefs are registered. Uncheck |
| 305 // "Browsing history" and "Cached Images and Files". | 301 // "Browsing history" and "Cached Images and Files". |
| 306 // Prefs are reset to default at the end of each test. | 302 // Prefs are reset to default at the end of each test. |
| 307 [[EarlGrey selectElementWithMatcher:ClearBrowsingHistoryButton()] | 303 [[EarlGrey selectElementWithMatcher:ClearBrowsingHistoryButton()] |
| 308 performAction:grey_tap()]; | 304 performAction:grey_tap()]; |
| 309 [[EarlGrey selectElementWithMatcher:ClearCacheButton()] | 305 [[EarlGrey selectElementWithMatcher:ClearCacheButton()] |
| 310 performAction:grey_tap()]; | 306 performAction:grey_tap()]; |
| 311 | 307 |
| 312 [self clearBrowsingData]; | 308 [self clearBrowsingData]; |
| 313 [self dismissSettings]; | 309 [self dismissSettings]; |
| 314 } | 310 } |
| 315 | 311 |
| 316 // From the NTP, clears the saved passwords via the UI. | 312 // From the NTP, clears the saved passwords via the UI. |
| 317 - (void)clearPasswords { | 313 - (void)clearPasswords { |
| 318 [ChromeEarlGreyUI openSettingsMenu]; | 314 [ChromeEarlGreyUI openSettingsMenu]; |
| 319 [[EarlGrey selectElementWithMatcher:PrivacyButton()] | 315 [ChromeEarlGreyUI tapButtonInSettingsMenu:PrivacyButton()]; |
| 320 performAction:grey_tap()]; | 316 [ChromeEarlGreyUI tapButtonInPrivacyMenu:ClearBrowsingDataCell()]; |
| 321 [[EarlGrey selectElementWithMatcher:ClearBrowsingDataCell()] | |
| 322 performAction:grey_tap()]; | |
| 323 | 317 |
| 324 // "Browsing history", "Cookies, Site Data" and "Cached Images and Files" | 318 // "Browsing history", "Cookies, Site Data" and "Cached Images and Files" |
| 325 // are the default checked options when the prefs are registered. Unckeck all | 319 // are the default checked options when the prefs are registered. Unckeck all |
| 326 // of them and check "Passwords". | 320 // of them and check "Passwords". |
| 327 [[EarlGrey selectElementWithMatcher:ClearBrowsingHistoryButton()] | 321 [[EarlGrey selectElementWithMatcher:ClearBrowsingHistoryButton()] |
| 328 performAction:grey_tap()]; | 322 performAction:grey_tap()]; |
| 329 [[EarlGrey selectElementWithMatcher:ClearCookiesButton()] | 323 [[EarlGrey selectElementWithMatcher:ClearCookiesButton()] |
| 330 performAction:grey_tap()]; | 324 performAction:grey_tap()]; |
| 331 [[EarlGrey selectElementWithMatcher:ClearCacheButton()] | 325 [[EarlGrey selectElementWithMatcher:ClearCacheButton()] |
| 332 performAction:grey_tap()]; | 326 performAction:grey_tap()]; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 387 preferences->SetBoolean(browsing_data::prefs::kDeleteCookies, true); | 381 preferences->SetBoolean(browsing_data::prefs::kDeleteCookies, true); |
| 388 preferences->SetBoolean(browsing_data::prefs::kDeletePasswords, false); | 382 preferences->SetBoolean(browsing_data::prefs::kDeletePasswords, false); |
| 389 preferences->SetBoolean(browsing_data::prefs::kDeleteFormData, false); | 383 preferences->SetBoolean(browsing_data::prefs::kDeleteFormData, false); |
| 390 } | 384 } |
| 391 | 385 |
| 392 // Checks the presence (or absence) of saved passwords. | 386 // Checks the presence (or absence) of saved passwords. |
| 393 // If |saved| is YES, it checks that there is a Saved Passwords section. | 387 // If |saved| is YES, it checks that there is a Saved Passwords section. |
| 394 // If |saved| is NO, it checks that there is no Saved Passwords section. | 388 // If |saved| is NO, it checks that there is no Saved Passwords section. |
| 395 - (void)checkIfPasswordsSaved:(BOOL)saved { | 389 - (void)checkIfPasswordsSaved:(BOOL)saved { |
| 396 [ChromeEarlGreyUI openSettingsMenu]; | 390 [ChromeEarlGreyUI openSettingsMenu]; |
| 397 [[EarlGrey selectElementWithMatcher:PasswordsButton()] | 391 [ChromeEarlGreyUI tapButtonInSettingsMenu:PasswordsButton()]; |
| 398 performAction:grey_tap()]; | |
| 399 | 392 |
| 400 id<GREYMatcher> visibilityMatcher = | 393 id<GREYMatcher> visibilityMatcher = |
| 401 saved ? grey_sufficientlyVisible() : grey_notVisible(); | 394 saved ? grey_sufficientlyVisible() : grey_notVisible(); |
| 402 [[EarlGrey selectElementWithMatcher: | 395 [[EarlGrey selectElementWithMatcher: |
| 403 grey_text(l10n_util::GetNSString( | 396 grey_text(l10n_util::GetNSString( |
| 404 IDS_PASSWORD_MANAGER_SHOW_PASSWORDS_TAB_TITLE))] | 397 IDS_PASSWORD_MANAGER_SHOW_PASSWORDS_TAB_TITLE))] |
| 405 assertWithMatcher:visibilityMatcher]; | 398 assertWithMatcher:visibilityMatcher]; |
| 406 | 399 |
| 407 // Close the Settings. | 400 // Close the Settings. |
| 408 [self closeSubSettingsMenu]; | 401 [self closeSubSettingsMenu]; |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 768 // Verifies the UI elements are accessible on the Settings page. | 761 // Verifies the UI elements are accessible on the Settings page. |
| 769 - (void)testAccessibilityOnSettingsPage { | 762 - (void)testAccessibilityOnSettingsPage { |
| 770 [ChromeEarlGreyUI openSettingsMenu]; | 763 [ChromeEarlGreyUI openSettingsMenu]; |
| 771 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 764 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 772 [[EarlGrey selectElementWithMatcher:NavigationBarDoneButton()] | 765 [[EarlGrey selectElementWithMatcher:NavigationBarDoneButton()] |
| 773 performAction:grey_tap()]; | 766 performAction:grey_tap()]; |
| 774 } | 767 } |
| 775 | 768 |
| 776 // Verifies the UI elements are accessible on the Content Settings page. | 769 // Verifies the UI elements are accessible on the Content Settings page. |
| 777 - (void)testAccessibilityOnContentSettingsPage { | 770 - (void)testAccessibilityOnContentSettingsPage { |
| 778 [self openSubSettingMenu:chrome_test_util::ButtonWithAccessibilityLabelId( | 771 [ChromeEarlGreyUI openSettingsMenu]; |
| 779 IDS_IOS_CONTENT_SETTINGS_TITLE)]; | 772 [ChromeEarlGreyUI tapButtonInSettingsMenu:ContentSettingsButton()]; |
| 780 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 773 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 781 [self closeSubSettingsMenu]; | 774 [self closeSubSettingsMenu]; |
| 782 } | 775 } |
| 783 | 776 |
| 784 // Verifies the UI elements are accessible on the Content Settings | 777 // Verifies the UI elements are accessible on the Content Settings |
| 785 // Block Popups page. | 778 // Block Popups page. |
| 786 - (void)testAccessibilityOnContentSettingsBlockPopupsPage { | 779 - (void)testAccessibilityOnContentSettingsBlockPopupsPage { |
| 787 [self openSubSettingMenu:chrome_test_util::ButtonWithAccessibilityLabelId( | 780 [ChromeEarlGreyUI openSettingsMenu]; |
| 788 IDS_IOS_CONTENT_SETTINGS_TITLE)]; | 781 [ChromeEarlGreyUI tapButtonInSettingsMenu:ContentSettingsButton()]; |
| 789 [[EarlGrey selectElementWithMatcher:BlockPopupsButton()] | 782 [[EarlGrey selectElementWithMatcher:BlockPopupsButton()] |
| 790 performAction:grey_tap()]; | 783 performAction:grey_tap()]; |
| 791 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 784 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 792 [self closeSubSettingsMenu]; | 785 [self closeSubSettingsMenu]; |
| 793 } | 786 } |
| 794 | 787 |
| 795 // Verifies the UI elements are accessible on the Content Translations Settings | 788 // Verifies the UI elements are accessible on the Content Translations Settings |
| 796 // page. | 789 // page. |
| 797 - (void)testAccessibilityOnContentSettingsTranslatePage { | 790 - (void)testAccessibilityOnContentSettingsTranslatePage { |
| 798 [self openSubSettingMenu:chrome_test_util::ButtonWithAccessibilityLabelId( | 791 [ChromeEarlGreyUI openSettingsMenu]; |
| 799 IDS_IOS_CONTENT_SETTINGS_TITLE)]; | 792 [ChromeEarlGreyUI tapButtonInSettingsMenu:ContentSettingsButton()]; |
| 800 [[EarlGrey selectElementWithMatcher:TranslateSettingsButton()] | 793 [[EarlGrey selectElementWithMatcher:TranslateSettingsButton()] |
| 801 performAction:grey_tap()]; | 794 performAction:grey_tap()]; |
| 802 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 795 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 803 [self closeSubSettingsMenu]; | 796 [self closeSubSettingsMenu]; |
| 804 } | 797 } |
| 805 | 798 |
| 806 // Verifies the UI elements are accessible on the Privacy Settings page. | 799 // Verifies the UI elements are accessible on the Privacy Settings page. |
| 807 - (void)testAccessibilityOnPrivacySettingsPage { | 800 - (void)testAccessibilityOnPrivacySettingsPage { |
| 808 [self openSubSettingMenu:chrome_test_util::ButtonWithAccessibilityLabelId( | 801 [ChromeEarlGreyUI openSettingsMenu]; |
| 809 IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY)]; | 802 [ChromeEarlGreyUI tapButtonInSettingsMenu:PrivacyButton()]; |
| 810 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 803 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 811 [self closeSubSettingsMenu]; | 804 [self closeSubSettingsMenu]; |
| 812 } | 805 } |
| 813 | 806 |
| 814 // Verifies the UI elements are accessible on the Privacy Handoff Settings | 807 // Verifies the UI elements are accessible on the Privacy Handoff Settings |
| 815 // page. | 808 // page. |
| 816 - (void)testAccessibilityOnPrivacyHandoffSettingsPage { | 809 - (void)testAccessibilityOnPrivacyHandoffSettingsPage { |
| 817 [self openSubSettingMenu:chrome_test_util::ButtonWithAccessibilityLabelId( | 810 [ChromeEarlGreyUI openSettingsMenu]; |
| 818 IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY)]; | 811 [ChromeEarlGreyUI tapButtonInSettingsMenu:PrivacyButton()]; |
| 819 [[EarlGrey selectElementWithMatcher:PrivacyHandoffButton()] | 812 [[EarlGrey selectElementWithMatcher:PrivacyHandoffButton()] |
| 820 performAction:grey_tap()]; | 813 performAction:grey_tap()]; |
| 821 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 814 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 822 [self closeSubSettingsMenu]; | 815 [self closeSubSettingsMenu]; |
| 823 } | 816 } |
| 824 | 817 |
| 825 // Verifies the UI elements are accessible on the Privacy Clear Browsing Data | 818 // Verifies the UI elements are accessible on the Privacy Clear Browsing Data |
| 826 // Settings page. | 819 // Settings page. |
| 827 - (void)testAccessibilityOnPrivacyClearBrowsingHistoryPage { | 820 - (void)testAccessibilityOnPrivacyClearBrowsingHistoryPage { |
| 828 [self openSubSettingMenu:chrome_test_util::ButtonWithAccessibilityLabelId( | 821 [ChromeEarlGreyUI openSettingsMenu]; |
| 829 IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY)]; | 822 [ChromeEarlGreyUI tapButtonInSettingsMenu:PrivacyButton()]; |
| 830 [[EarlGrey selectElementWithMatcher:ClearBrowsingDataButton()] | 823 [ChromeEarlGreyUI tapButtonInPrivacyMenu:ClearBrowsingDataButton()]; |
| 831 performAction:grey_tap()]; | |
| 832 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 824 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 833 [self closeSubSettingsMenu]; | 825 [self closeSubSettingsMenu]; |
| 834 } | 826 } |
| 835 | 827 |
| 836 // Verifies the UI elements are accessible on the Bandwidth Management Settings | 828 // Verifies the UI elements are accessible on the Bandwidth Management Settings |
| 837 // page. | 829 // page. |
| 838 - (void)testAccessibilityOnBandwidthManagementSettingsPage { | 830 - (void)testAccessibilityOnBandwidthManagementSettingsPage { |
| 839 [self openSubSettingMenu:chrome_test_util::ButtonWithAccessibilityLabelId( | 831 [ChromeEarlGreyUI openSettingsMenu]; |
| 840 IDS_IOS_BANDWIDTH_MANAGEMENT_SETTINGS)]; | 832 [ChromeEarlGreyUI tapButtonInSettingsMenu:BandwidthSettingsButton()]; |
| 841 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 833 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 842 [self closeSubSettingsMenu]; | 834 [self closeSubSettingsMenu]; |
| 843 } | 835 } |
| 844 | 836 |
| 845 // Verifies the UI elements are accessible on the Bandwidth Preload Webpages | 837 // Verifies the UI elements are accessible on the Bandwidth Preload Webpages |
| 846 // Settings page. | 838 // Settings page. |
| 847 - (void)testAccessibilityOnBandwidthPreloadWebpagesSettingsPage { | 839 - (void)testAccessibilityOnBandwidthPreloadWebpagesSettingsPage { |
| 848 [self openSubSettingMenu:chrome_test_util::ButtonWithAccessibilityLabelId( | 840 [ChromeEarlGreyUI openSettingsMenu]; |
| 849 IDS_IOS_BANDWIDTH_MANAGEMENT_SETTINGS)]; | 841 [ChromeEarlGreyUI tapButtonInSettingsMenu:BandwidthSettingsButton()]; |
| 850 [[EarlGrey selectElementWithMatcher:BandwidthPreloadWebpagesButton()] | 842 [[EarlGrey selectElementWithMatcher:BandwidthPreloadWebpagesButton()] |
| 851 performAction:grey_tap()]; | 843 performAction:grey_tap()]; |
| 852 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 844 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 853 [self closeSubSettingsMenu]; | 845 [self closeSubSettingsMenu]; |
| 854 } | 846 } |
| 855 | 847 |
| 856 // Verifies the UI elements are accessible on the Save Passwords page. | 848 // Verifies the UI elements are accessible on the Save Passwords page. |
| 857 - (void)testAccessibilityOnSavePasswords { | 849 - (void)testAccessibilityOnSavePasswords { |
| 858 [ChromeEarlGreyUI openSettingsMenu]; | 850 [ChromeEarlGreyUI openSettingsMenu]; |
| 859 [[EarlGrey selectElementWithMatcher:PasswordsButton()] | 851 [[EarlGrey selectElementWithMatcher:PasswordsButton()] |
| 860 performAction:grey_tap()]; | 852 performAction:grey_tap()]; |
| 861 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 853 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 862 [self closeSubSettingsMenu]; | 854 [self closeSubSettingsMenu]; |
| 863 } | 855 } |
| 864 | 856 |
| 865 // Verifies the UI elements are accessible on the Search engine page. | 857 // Verifies the UI elements are accessible on the Search engine page. |
| 866 - (void)testAccessibilityOnSearchEngine { | 858 - (void)testAccessibilityOnSearchEngine { |
| 867 [ChromeEarlGreyUI openSettingsMenu]; | 859 [ChromeEarlGreyUI openSettingsMenu]; |
| 868 [[EarlGrey selectElementWithMatcher:SearchEngineButton()] | 860 [[EarlGrey selectElementWithMatcher:SearchEngineButton()] |
| 869 performAction:grey_tap()]; | 861 performAction:grey_tap()]; |
| 870 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 862 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 871 [self closeSubSettingsMenu]; | 863 [self closeSubSettingsMenu]; |
| 872 } | 864 } |
| 873 | 865 |
| 874 // Verifies the UI elements are accessible on the Autofill Forms page. | 866 // Verifies the UI elements are accessible on the Autofill Forms page. |
| 875 - (void)testAccessibilityOnAutofillForms { | 867 - (void)testAccessibilityOnAutofillForms { |
| 876 [ChromeEarlGreyUI openSettingsMenu]; | 868 [ChromeEarlGreyUI openSettingsMenu]; |
| 877 [[EarlGrey selectElementWithMatcher:AutofillButton()] | 869 [ChromeEarlGreyUI tapButtonInSettingsMenu:AutofillButton()]; |
| 878 performAction:grey_tap()]; | |
| 879 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 870 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 880 [self closeSubSettingsMenu]; | 871 [self closeSubSettingsMenu]; |
| 881 } | 872 } |
| 882 | 873 |
| 883 // Verifies the UI elements are accessible on the Google Apps page. | 874 // Verifies the UI elements are accessible on the Google Apps page. |
| 884 - (void)testAccessibilityOnGoogleApps { | 875 - (void)testAccessibilityOnGoogleApps { |
| 885 // TODO(crbug/711511): Remove when Native App Launcher is full deprecated. | 876 // TODO(crbug/711511): Remove when Native App Launcher is full deprecated. |
| 886 if (!experimental_flags::IsNativeAppLauncherEnabled()) | 877 if (!experimental_flags::IsNativeAppLauncherEnabled()) |
| 887 return; | 878 return; |
| 888 [self openSubSettingMenu:GoogleAppsButton()]; | 879 [ChromeEarlGreyUI openSettingsMenu]; |
| 880 [ChromeEarlGreyUI tapButtonInSettingsMenu:GoogleAppsButton()]; | |
| 889 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 881 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 890 [self closeSubSettingsMenu]; | 882 [self closeSubSettingsMenu]; |
| 891 } | 883 } |
| 892 | 884 |
| 893 // Verifies the UI elements are accessible on the About Chrome page. | 885 // Verifies the UI elements are accessible on the About Chrome page. |
| 894 - (void)testAccessibilityOnGoogleChrome { | 886 - (void)testAccessibilityOnGoogleChrome { |
| 895 [self openSubSettingMenu:GoogleChromeButton()]; | 887 [ChromeEarlGreyUI openSettingsMenu]; |
| 888 [ChromeEarlGreyUI tapButtonInSettingsMenu:GoogleChromeButton()]; | |
| 896 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 889 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 897 [self closeSubSettingsMenu]; | 890 [self closeSubSettingsMenu]; |
| 898 } | 891 } |
| 899 | 892 |
| 900 // Verifies the UI elements are accessible on the Voice Search page. | 893 // Verifies the UI elements are accessible on the Voice Search page. |
| 901 - (void)testAccessibilityOnVoiceSearch { | 894 - (void)testAccessibilityOnVoiceSearch { |
| 902 [self openSubSettingMenu:VoiceSearchButton()]; | 895 [ChromeEarlGreyUI openSettingsMenu]; |
| 896 [ChromeEarlGreyUI tapButtonInSettingsMenu:VoiceSearchButton()]; | |
| 903 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 897 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 904 [self closeSubSettingsMenu]; | 898 [self closeSubSettingsMenu]; |
| 905 } | 899 } |
| 906 | 900 |
| 907 // Verifies the UI elements are accessible on the Passwords page. | 901 // Verifies the UI elements are accessible on the Passwords page. |
| 908 - (void)testAccessibilityOnPasswords { | 902 - (void)testAccessibilityOnPasswords { |
| 909 [self openPasswordSettings]; | 903 [self openPasswordSettings]; |
| 910 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 904 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 911 [self closeSubSettingsMenu]; | 905 [self closeSubSettingsMenu]; |
| 912 } | 906 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 986 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; | 980 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; |
| 987 | 981 |
| 988 // Verify that the Settings register keyboard commands. | 982 // Verify that the Settings register keyboard commands. |
| 989 GREYAssertNotNil(settings.keyCommands, | 983 GREYAssertNotNil(settings.keyCommands, |
| 990 @"Settings should register key commands when presented."); | 984 @"Settings should register key commands when presented."); |
| 991 } | 985 } |
| 992 | 986 |
| 993 // Verifies the UI elements are accessible on the Send Usage Data page. | 987 // Verifies the UI elements are accessible on the Send Usage Data page. |
| 994 - (void)testAccessibilityOnSendUsageData { | 988 - (void)testAccessibilityOnSendUsageData { |
| 995 [ChromeEarlGreyUI openSettingsMenu]; | 989 [ChromeEarlGreyUI openSettingsMenu]; |
| 996 [[EarlGrey selectElementWithMatcher:PrivacyButton()] | 990 [ChromeEarlGreyUI tapButtonInSettingsMenu:PrivacyButton()]; |
| 997 performAction:grey_tap()]; | 991 [ChromeEarlGreyUI tapButtonInPrivacyMenu:SendUsageDataButton()]; |
| 998 [[EarlGrey selectElementWithMatcher:SendUsageDataButton()] | |
| 999 performAction:grey_tap()]; | |
| 1000 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 992 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 1001 [self closeSubSettingsMenu]; | 993 [self closeSubSettingsMenu]; |
| 1002 } | 994 } |
| 1003 | 995 |
| 1004 @end | 996 @end |
| OLD | NEW |