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