| 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 30 matching lines...) Expand all Loading... |
| 41 #import "ios/web/public/test/web_view_interaction_test_util.h" | 41 #import "ios/web/public/test/web_view_interaction_test_util.h" |
| 42 #import "ios/web/public/web_state/web_state.h" | 42 #import "ios/web/public/web_state/web_state.h" |
| 43 #include "ios/web/public/web_thread.h" | 43 #include "ios/web/public/web_thread.h" |
| 44 #include "net/ssl/channel_id_service.h" | 44 #include "net/ssl/channel_id_service.h" |
| 45 #include "net/ssl/channel_id_store.h" | 45 #include "net/ssl/channel_id_store.h" |
| 46 #include "net/url_request/url_request_context.h" | 46 #include "net/url_request/url_request_context.h" |
| 47 #include "net/url_request/url_request_context_getter.h" | 47 #include "net/url_request/url_request_context_getter.h" |
| 48 #include "ui/base/l10n/l10n_util.h" | 48 #include "ui/base/l10n/l10n_util.h" |
| 49 #include "url/gurl.h" | 49 #include "url/gurl.h" |
| 50 | 50 |
| 51 using chrome_test_util::buttonWithAccessibilityLabelId; | 51 using chrome_test_util::ButtonWithAccessibilityLabelId; |
| 52 | 52 |
| 53 namespace { | 53 namespace { |
| 54 | 54 |
| 55 const char kTestOrigin1[] = "http://host1:1/"; | 55 const char kTestOrigin1[] = "http://host1:1/"; |
| 56 | 56 |
| 57 const char kUrl[] = "http://foo/browsing"; | 57 const char kUrl[] = "http://foo/browsing"; |
| 58 const char kUrlWithSetCookie[] = "http://foo/set_cookie"; | 58 const char kUrlWithSetCookie[] = "http://foo/set_cookie"; |
| 59 const char kResponse[] = "bar"; | 59 const char kResponse[] = "bar"; |
| 60 const char kResponseWithSetCookie[] = "bar with set cookie"; | 60 const char kResponseWithSetCookie[] = "bar with set cookie"; |
| 61 const char kNoCookieText[] = "No cookies"; | 61 const char kNoCookieText[] = "No cookies"; |
| 62 const char kCookie[] = "a=b"; | 62 const char kCookie[] = "a=b"; |
| 63 const char kJavaScriptGetCookies[] = | 63 const char kJavaScriptGetCookies[] = |
| 64 "var c = document.cookie ? document.cookie.split(/;\\s*/) : [];" | 64 "var c = document.cookie ? document.cookie.split(/;\\s*/) : [];" |
| 65 "if (!c.length) {" | 65 "if (!c.length) {" |
| 66 " document.documentElement.innerHTML = 'No cookies!';" | 66 " document.documentElement.innerHTML = 'No cookies!';" |
| 67 "} else {" | 67 "} else {" |
| 68 " document.documentElement.innerHTML = 'OK: ' + c.join(',');" | 68 " document.documentElement.innerHTML = 'OK: ' + c.join(',');" |
| 69 "}"; | 69 "}"; |
| 70 | 70 |
| 71 enum MetricsServiceType { | 71 enum MetricsServiceType { |
| 72 kMetrics, | 72 kMetrics, |
| 73 kBreakpad, | 73 kBreakpad, |
| 74 kBreakpadFirstLaunch, | 74 kBreakpadFirstLaunch, |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 // Matcher for the clear browsing history cell on the clear browsing data panel. | 77 // Matcher for the clear browsing history cell on the clear browsing data panel. |
| 78 id<GREYMatcher> clearBrowsingHistoryButton() { | 78 id<GREYMatcher> ClearBrowsingHistoryButton() { |
| 79 return grey_allOf(grey_accessibilityID(kClearBrowsingHistoryCellId), | 79 return grey_allOf(grey_accessibilityID(kClearBrowsingHistoryCellId), |
| 80 grey_sufficientlyVisible(), nil); | 80 grey_sufficientlyVisible(), nil); |
| 81 } | 81 } |
| 82 // Matcher for the clear cookies cell on the clear browsing data panel. | 82 // Matcher for the clear cookies cell on the clear browsing data panel. |
| 83 id<GREYMatcher> clearCookiesButton() { | 83 id<GREYMatcher> ClearCookiesButton() { |
| 84 return grey_accessibilityID(kClearCookiesCellId); | 84 return grey_accessibilityID(kClearCookiesCellId); |
| 85 } | 85 } |
| 86 // Matcher for the clear cache cell on the clear browsing data panel. | 86 // Matcher for the clear cache cell on the clear browsing data panel. |
| 87 id<GREYMatcher> clearCacheButton() { | 87 id<GREYMatcher> ClearCacheButton() { |
| 88 return grey_allOf(grey_accessibilityID(kClearCacheCellId), | 88 return grey_allOf(grey_accessibilityID(kClearCacheCellId), |
| 89 grey_sufficientlyVisible(), nil); | 89 grey_sufficientlyVisible(), nil); |
| 90 } | 90 } |
| 91 // Matcher for the clear saved passwords cell on the clear browsing data panel. | 91 // Matcher for the clear saved passwords cell on the clear browsing data panel. |
| 92 id<GREYMatcher> clearSavedPasswordsButton() { | 92 id<GREYMatcher> ClearSavedPasswordsButton() { |
| 93 return grey_allOf(grey_accessibilityID(kClearSavedPasswordsCellId), | 93 return grey_allOf(grey_accessibilityID(kClearSavedPasswordsCellId), |
| 94 grey_sufficientlyVisible(), nil); | 94 grey_sufficientlyVisible(), nil); |
| 95 } | 95 } |
| 96 // Matcher for the clear browsing data button on the clear browsing data panel. | 96 // Matcher for the clear browsing data button on the clear browsing data panel. |
| 97 id<GREYMatcher> clearBrowsingDataButton() { | 97 id<GREYMatcher> ClearBrowsingDataButton() { |
| 98 return buttonWithAccessibilityLabelId(IDS_IOS_CLEAR_BUTTON); | 98 return ButtonWithAccessibilityLabelId(IDS_IOS_CLEAR_BUTTON); |
| 99 } | 99 } |
| 100 // Matcher for the done button in the navigation bar. | 100 // Matcher for the done button in the navigation bar. |
| 101 id<GREYMatcher> navigationDoneButton() { | 101 id<GREYMatcher> NavigationDoneButton() { |
| 102 return buttonWithAccessibilityLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); | 102 return ButtonWithAccessibilityLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); |
| 103 } | 103 } |
| 104 // Matcher for the Settings button in the tools menu. | 104 // Matcher for the Settings button in the tools menu. |
| 105 id<GREYMatcher> settingsButton() { | 105 id<GREYMatcher> SettingsButton() { |
| 106 return grey_accessibilityID(kToolsMenuSettingsId); | 106 return grey_accessibilityID(kToolsMenuSettingsId); |
| 107 } | 107 } |
| 108 // Matcher for the Save Passwords cell on the main Settings screen. | 108 // Matcher for the Save Passwords cell on the main Settings screen. |
| 109 id<GREYMatcher> passwordsButton() { | 109 id<GREYMatcher> PasswordsButton() { |
| 110 return buttonWithAccessibilityLabelId(IDS_IOS_SAVE_PASSWORDS); | 110 return ButtonWithAccessibilityLabelId(IDS_IOS_SAVE_PASSWORDS); |
| 111 } | 111 } |
| 112 // Matcher for the Privacy cell on the main Settings screen. | 112 // Matcher for the Privacy cell on the main Settings screen. |
| 113 id<GREYMatcher> privacyButton() { | 113 id<GREYMatcher> PrivacyButton() { |
| 114 return buttonWithAccessibilityLabelId( | 114 return ButtonWithAccessibilityLabelId( |
| 115 IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY); | 115 IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY); |
| 116 } | 116 } |
| 117 // Matcher for the Clear Browsing Data cell on the Privacy screen. | 117 // Matcher for the Clear Browsing Data cell on the Privacy screen. |
| 118 id<GREYMatcher> clearBrowsingDataCell() { | 118 id<GREYMatcher> ClearBrowsingDataCell() { |
| 119 return buttonWithAccessibilityLabelId(IDS_IOS_CLEAR_BROWSING_DATA_TITLE); | 119 return ButtonWithAccessibilityLabelId(IDS_IOS_CLEAR_BROWSING_DATA_TITLE); |
| 120 } | 120 } |
| 121 | 121 |
| 122 // Matcher for the Search Engine cell on the main Settings screen. | 122 // Matcher for the Search Engine cell on the main Settings screen. |
| 123 id<GREYMatcher> searchEngineButton() { | 123 id<GREYMatcher> SearchEngineButton() { |
| 124 return buttonWithAccessibilityLabelId(IDS_IOS_SEARCH_ENGINE_SETTING_TITLE); | 124 return ButtonWithAccessibilityLabelId(IDS_IOS_SEARCH_ENGINE_SETTING_TITLE); |
| 125 } | 125 } |
| 126 | 126 |
| 127 // Matcher for the Autofill Forms cell on the main Settings screen. | 127 // Matcher for the Autofill Forms cell on the main Settings screen. |
| 128 id<GREYMatcher> autofillButton() { | 128 id<GREYMatcher> AutofillButton() { |
| 129 return buttonWithAccessibilityLabelId(IDS_IOS_AUTOFILL); | 129 return ButtonWithAccessibilityLabelId(IDS_IOS_AUTOFILL); |
| 130 } | 130 } |
| 131 | 131 |
| 132 // Matcher for the Google Apps cell on the main Settings screen. | 132 // Matcher for the Google Apps cell on the main Settings screen. |
| 133 id<GREYMatcher> googleAppsButton() { | 133 id<GREYMatcher> GoogleAppsButton() { |
| 134 return buttonWithAccessibilityLabelId(IDS_IOS_GOOGLE_APPS_SM_SETTINGS); | 134 return ButtonWithAccessibilityLabelId(IDS_IOS_GOOGLE_APPS_SM_SETTINGS); |
| 135 } | 135 } |
| 136 | 136 |
| 137 // Matcher for the Google Chrome cell on the main Settings screen. | 137 // Matcher for the Google Chrome cell on the main Settings screen. |
| 138 id<GREYMatcher> googleChromeButton() { | 138 id<GREYMatcher> GoogleChromeButton() { |
| 139 return buttonWithAccessibilityLabelId(IDS_IOS_PRODUCT_NAME); | 139 return ButtonWithAccessibilityLabelId(IDS_IOS_PRODUCT_NAME); |
| 140 } | 140 } |
| 141 | 141 |
| 142 // Matcher for the Google Chrome cell on the main Settings screen. | 142 // Matcher for the Google Chrome cell on the main Settings screen. |
| 143 id<GREYMatcher> voiceSearchButton() { | 143 id<GREYMatcher> VoiceSearchButton() { |
| 144 return grey_allOf(grey_accessibilityID(kSettingsVoiceSearchCellId), | 144 return grey_allOf(grey_accessibilityID(kSettingsVoiceSearchCellId), |
| 145 grey_accessibilityTrait(UIAccessibilityTraitButton), nil); | 145 grey_accessibilityTrait(UIAccessibilityTraitButton), nil); |
| 146 } | 146 } |
| 147 | 147 |
| 148 // Matcher for the Preload Webpages button on the bandwidth UI. | 148 // Matcher for the Preload Webpages button on the bandwidth UI. |
| 149 id<GREYMatcher> BandwidthPreloadWebpagesButton() { | 149 id<GREYMatcher> BandwidthPreloadWebpagesButton() { |
| 150 return buttonWithAccessibilityLabelId(IDS_IOS_OPTIONS_PRELOAD_WEBPAGES); | 150 return ButtonWithAccessibilityLabelId(IDS_IOS_OPTIONS_PRELOAD_WEBPAGES); |
| 151 } | 151 } |
| 152 | 152 |
| 153 // Matcher for the Privacy Handoff button on the privacy UI. | 153 // Matcher for the Privacy Handoff button on the privacy UI. |
| 154 id<GREYMatcher> PrivacyHandoffButton() { | 154 id<GREYMatcher> PrivacyHandoffButton() { |
| 155 return buttonWithAccessibilityLabelId( | 155 return ButtonWithAccessibilityLabelId( |
| 156 IDS_IOS_OPTIONS_ENABLE_HANDOFF_TO_OTHER_DEVICES); | 156 IDS_IOS_OPTIONS_ENABLE_HANDOFF_TO_OTHER_DEVICES); |
| 157 } | 157 } |
| 158 | 158 |
| 159 // Matcher for the Privacy Block Popups button on the privacy UI. | 159 // Matcher for the Privacy Block Popups button on the privacy UI. |
| 160 id<GREYMatcher> BlockPopupsButton() { | 160 id<GREYMatcher> BlockPopupsButton() { |
| 161 return buttonWithAccessibilityLabelId(IDS_IOS_BLOCK_POPUPS); | 161 return ButtonWithAccessibilityLabelId(IDS_IOS_BLOCK_POPUPS); |
| 162 } | 162 } |
| 163 | 163 |
| 164 // Matcher for the Privacy Translate Settings button on the privacy UI. | 164 // Matcher for the Privacy Translate Settings button on the privacy UI. |
| 165 id<GREYMatcher> TranslateSettingsButton() { | 165 id<GREYMatcher> TranslateSettingsButton() { |
| 166 return buttonWithAccessibilityLabelId(IDS_IOS_TRANSLATE_SETTING); | 166 return ButtonWithAccessibilityLabelId(IDS_IOS_TRANSLATE_SETTING); |
| 167 } | 167 } |
| 168 | 168 |
| 169 // Asserts that there is no cookie in current web state. | 169 // Asserts that there is no cookie in current web state. |
| 170 void AssertNoCookieExists() { | 170 void AssertNoCookieExists() { |
| 171 NSError* error = nil; | 171 NSError* error = nil; |
| 172 chrome_test_util::ExecuteJavaScript( | 172 chrome_test_util::ExecuteJavaScript( |
| 173 base::SysUTF8ToNSString(kJavaScriptGetCookies), &error); | 173 base::SysUTF8ToNSString(kJavaScriptGetCookies), &error); |
| 174 [[EarlGrey selectElementWithMatcher:chrome_test_util::webViewContainingText( | 174 [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewContainingText( |
| 175 kNoCookieText)] | 175 kNoCookieText)] |
| 176 assertWithMatcher:grey_notNil()]; | 176 assertWithMatcher:grey_notNil()]; |
| 177 } | 177 } |
| 178 | 178 |
| 179 // Asserts |cookie| exists in current web state. | 179 // Asserts |cookie| exists in current web state. |
| 180 void AssertCookieExists(const char cookie[]) { | 180 void AssertCookieExists(const char cookie[]) { |
| 181 NSError* error = nil; | 181 NSError* error = nil; |
| 182 chrome_test_util::ExecuteJavaScript( | 182 chrome_test_util::ExecuteJavaScript( |
| 183 base::SysUTF8ToNSString(kJavaScriptGetCookies), &error); | 183 base::SysUTF8ToNSString(kJavaScriptGetCookies), &error); |
| 184 NSString* const expectedCookieText = | 184 NSString* const expectedCookieText = |
| 185 [NSString stringWithFormat:@"OK: %@", base::SysUTF8ToNSString(cookie)]; | 185 [NSString stringWithFormat:@"OK: %@", base::SysUTF8ToNSString(cookie)]; |
| 186 [[EarlGrey | 186 [[EarlGrey |
| 187 selectElementWithMatcher:chrome_test_util::webViewContainingText( | 187 selectElementWithMatcher:chrome_test_util::WebViewContainingText( |
| 188 base::SysNSStringToUTF8(expectedCookieText))] | 188 base::SysNSStringToUTF8(expectedCookieText))] |
| 189 assertWithMatcher:grey_notNil()]; | 189 assertWithMatcher:grey_notNil()]; |
| 190 } | 190 } |
| 191 | 191 |
| 192 // Run as a task to check if a certificate has been added to the ChannelIDStore. | 192 // Run as a task to check if a certificate has been added to the ChannelIDStore. |
| 193 // Signals the given |semaphore| if the cert was added, or reposts itself | 193 // Signals the given |semaphore| if the cert was added, or reposts itself |
| 194 // otherwise. | 194 // otherwise. |
| 195 void CheckCertificate(scoped_refptr<net::URLRequestContextGetter> getter, | 195 void CheckCertificate(scoped_refptr<net::URLRequestContextGetter> getter, |
| 196 dispatch_semaphore_t semaphore) { | 196 dispatch_semaphore_t semaphore) { |
| 197 net::ChannelIDService* channel_id_service = | 197 net::ChannelIDService* channel_id_service = |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 298 |
| 299 // Closes a sub-settings menu, and then the general Settings menu. | 299 // Closes a sub-settings menu, and then the general Settings menu. |
| 300 - (void)closeSubSettingsMenu { | 300 - (void)closeSubSettingsMenu { |
| 301 [[EarlGrey | 301 [[EarlGrey |
| 302 selectElementWithMatcher:grey_allOf( | 302 selectElementWithMatcher:grey_allOf( |
| 303 grey_accessibilityID(@"ic_arrow_back"), | 303 grey_accessibilityID(@"ic_arrow_back"), |
| 304 grey_accessibilityTrait( | 304 grey_accessibilityTrait( |
| 305 UIAccessibilityTraitButton), | 305 UIAccessibilityTraitButton), |
| 306 nil)] performAction:grey_tap()]; | 306 nil)] performAction:grey_tap()]; |
| 307 [[EarlGrey | 307 [[EarlGrey |
| 308 selectElementWithMatcher:chrome_test_util::buttonWithAccessibilityLabelId( | 308 selectElementWithMatcher:chrome_test_util::ButtonWithAccessibilityLabelId( |
| 309 IDS_IOS_NAVIGATION_BAR_DONE_BUTTON)] | 309 IDS_IOS_NAVIGATION_BAR_DONE_BUTTON)] |
| 310 performAction:grey_tap()]; | 310 performAction:grey_tap()]; |
| 311 } | 311 } |
| 312 | 312 |
| 313 // Performs the steps to clear browsing data. Must be called on the | 313 // Performs the steps to clear browsing data. Must be called on the |
| 314 // Clear Browsing Data settings screen, after having selected the data types | 314 // Clear Browsing Data settings screen, after having selected the data types |
| 315 // scheduled for removal. | 315 // scheduled for removal. |
| 316 - (void)clearBrowsingData { | 316 - (void)clearBrowsingData { |
| 317 [[EarlGrey selectElementWithMatcher:clearBrowsingDataButton()] | 317 [[EarlGrey selectElementWithMatcher:ClearBrowsingDataButton()] |
| 318 performAction:grey_tap()]; | 318 performAction:grey_tap()]; |
| 319 | 319 |
| 320 // There is not currently a matcher for accessibilityElementIsFocused or | 320 // There is not currently a matcher for accessibilityElementIsFocused or |
| 321 // userInteractionEnabled which could be used here instead of checking that | 321 // userInteractionEnabled which could be used here instead of checking that |
| 322 // the button is not a MDCCollectionViewTextCell. Use when available. | 322 // the button is not a MDCCollectionViewTextCell. Use when available. |
| 323 // TODO(crbug.com/638674): Evaluate if this can move to shared code. | 323 // TODO(crbug.com/638674): Evaluate if this can move to shared code. |
| 324 id<GREYMatcher> confirmClear = grey_allOf( | 324 id<GREYMatcher> confirmClear = grey_allOf( |
| 325 clearBrowsingDataButton(), | 325 ClearBrowsingDataButton(), |
| 326 grey_not(grey_kindOfClass([MDCCollectionViewTextCell class])), nil); | 326 grey_not(grey_kindOfClass([MDCCollectionViewTextCell class])), nil); |
| 327 [[EarlGrey selectElementWithMatcher:confirmClear] performAction:grey_tap()]; | 327 [[EarlGrey selectElementWithMatcher:confirmClear] performAction:grey_tap()]; |
| 328 } | 328 } |
| 329 | 329 |
| 330 // Exits Settings by clicking on the Done button. | 330 // Exits Settings by clicking on the Done button. |
| 331 - (void)dismissSettings { | 331 - (void)dismissSettings { |
| 332 // Dismiss the settings. | 332 // Dismiss the settings. |
| 333 [[EarlGrey selectElementWithMatcher:navigationDoneButton()] | 333 [[EarlGrey selectElementWithMatcher:NavigationDoneButton()] |
| 334 performAction:grey_tap()]; | 334 performAction:grey_tap()]; |
| 335 | 335 |
| 336 // Wait for UI components to finish loading. | 336 // Wait for UI components to finish loading. |
| 337 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; | 337 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; |
| 338 } | 338 } |
| 339 | 339 |
| 340 // From the NTP, clears the cookies and site data via the UI. | 340 // From the NTP, clears the cookies and site data via the UI. |
| 341 - (void)clearCookiesAndSiteData { | 341 - (void)clearCookiesAndSiteData { |
| 342 [ChromeEarlGreyUI openToolsMenu]; | 342 [ChromeEarlGreyUI openToolsMenu]; |
| 343 [[EarlGrey selectElementWithMatcher:settingsButton()] | 343 [[EarlGrey selectElementWithMatcher:SettingsButton()] |
| 344 performAction:grey_tap()]; | 344 performAction:grey_tap()]; |
| 345 [[EarlGrey selectElementWithMatcher:privacyButton()] | 345 [[EarlGrey selectElementWithMatcher:PrivacyButton()] |
| 346 performAction:grey_tap()]; | 346 performAction:grey_tap()]; |
| 347 [[EarlGrey selectElementWithMatcher:clearBrowsingDataCell()] | 347 [[EarlGrey selectElementWithMatcher:ClearBrowsingDataCell()] |
| 348 performAction:grey_tap()]; | 348 performAction:grey_tap()]; |
| 349 | 349 |
| 350 // "Browsing history", "Cookies, Site Data" and "Cached Images and Files" | 350 // "Browsing history", "Cookies, Site Data" and "Cached Images and Files" |
| 351 // are the default checked options when the prefs are registered. Uncheck | 351 // are the default checked options when the prefs are registered. Uncheck |
| 352 // "Browsing history" and "Cached Images and Files". | 352 // "Browsing history" and "Cached Images and Files". |
| 353 // Prefs are reset to default at the end of each test. | 353 // Prefs are reset to default at the end of each test. |
| 354 [[EarlGrey selectElementWithMatcher:clearBrowsingHistoryButton()] | 354 [[EarlGrey selectElementWithMatcher:ClearBrowsingHistoryButton()] |
| 355 performAction:grey_tap()]; | 355 performAction:grey_tap()]; |
| 356 [[EarlGrey selectElementWithMatcher:clearCacheButton()] | 356 [[EarlGrey selectElementWithMatcher:ClearCacheButton()] |
| 357 performAction:grey_tap()]; | 357 performAction:grey_tap()]; |
| 358 | 358 |
| 359 [self clearBrowsingData]; | 359 [self clearBrowsingData]; |
| 360 [self dismissSettings]; | 360 [self dismissSettings]; |
| 361 } | 361 } |
| 362 | 362 |
| 363 // From the NTP, clears the saved passwords via the UI. | 363 // From the NTP, clears the saved passwords via the UI. |
| 364 - (void)clearPasswords { | 364 - (void)clearPasswords { |
| 365 [ChromeEarlGreyUI openToolsMenu]; | 365 [ChromeEarlGreyUI openToolsMenu]; |
| 366 [[EarlGrey selectElementWithMatcher:settingsButton()] | 366 [[EarlGrey selectElementWithMatcher:SettingsButton()] |
| 367 performAction:grey_tap()]; | 367 performAction:grey_tap()]; |
| 368 [[EarlGrey selectElementWithMatcher:privacyButton()] | 368 [[EarlGrey selectElementWithMatcher:PrivacyButton()] |
| 369 performAction:grey_tap()]; | 369 performAction:grey_tap()]; |
| 370 [[EarlGrey selectElementWithMatcher:clearBrowsingDataCell()] | 370 [[EarlGrey selectElementWithMatcher:ClearBrowsingDataCell()] |
| 371 performAction:grey_tap()]; | 371 performAction:grey_tap()]; |
| 372 | 372 |
| 373 // "Browsing history", "Cookies, Site Data" and "Cached Images and Files" | 373 // "Browsing history", "Cookies, Site Data" and "Cached Images and Files" |
| 374 // are the default checked options when the prefs are registered. Unckeck all | 374 // are the default checked options when the prefs are registered. Unckeck all |
| 375 // of them and check "Passwords". | 375 // of them and check "Passwords". |
| 376 [[EarlGrey selectElementWithMatcher:clearBrowsingHistoryButton()] | 376 [[EarlGrey selectElementWithMatcher:ClearBrowsingHistoryButton()] |
| 377 performAction:grey_tap()]; | 377 performAction:grey_tap()]; |
| 378 [[EarlGrey selectElementWithMatcher:clearCookiesButton()] | 378 [[EarlGrey selectElementWithMatcher:ClearCookiesButton()] |
| 379 performAction:grey_tap()]; | 379 performAction:grey_tap()]; |
| 380 [[EarlGrey selectElementWithMatcher:clearCacheButton()] | 380 [[EarlGrey selectElementWithMatcher:ClearCacheButton()] |
| 381 performAction:grey_tap()]; | 381 performAction:grey_tap()]; |
| 382 [[EarlGrey selectElementWithMatcher:clearSavedPasswordsButton()] | 382 [[EarlGrey selectElementWithMatcher:ClearSavedPasswordsButton()] |
| 383 performAction:grey_tap()]; | 383 performAction:grey_tap()]; |
| 384 | 384 |
| 385 [self clearBrowsingData]; | 385 [self clearBrowsingData]; |
| 386 | 386 |
| 387 // Re-tap all the previously tapped cells, so that the default state of the | 387 // Re-tap all the previously tapped cells, so that the default state of the |
| 388 // checkmarks is preserved. | 388 // checkmarks is preserved. |
| 389 [[EarlGrey selectElementWithMatcher:clearBrowsingHistoryButton()] | 389 [[EarlGrey selectElementWithMatcher:ClearBrowsingHistoryButton()] |
| 390 performAction:grey_tap()]; | 390 performAction:grey_tap()]; |
| 391 [[EarlGrey selectElementWithMatcher:clearCookiesButton()] | 391 [[EarlGrey selectElementWithMatcher:ClearCookiesButton()] |
| 392 performAction:grey_tap()]; | 392 performAction:grey_tap()]; |
| 393 [[EarlGrey selectElementWithMatcher:clearCacheButton()] | 393 [[EarlGrey selectElementWithMatcher:ClearCacheButton()] |
| 394 performAction:grey_tap()]; | 394 performAction:grey_tap()]; |
| 395 [[EarlGrey selectElementWithMatcher:clearSavedPasswordsButton()] | 395 [[EarlGrey selectElementWithMatcher:ClearSavedPasswordsButton()] |
| 396 performAction:grey_tap()]; | 396 performAction:grey_tap()]; |
| 397 | 397 |
| 398 [self dismissSettings]; | 398 [self dismissSettings]; |
| 399 } | 399 } |
| 400 | 400 |
| 401 // Checks the presence (or absence) of saved passwords. | 401 // Checks the presence (or absence) of saved passwords. |
| 402 // If |saved| is YES, it checks that there is a Saved Passwords section. | 402 // If |saved| is YES, it checks that there is a Saved Passwords section. |
| 403 // If |saved| is NO, it checks that there is no Saved Passwords section. | 403 // If |saved| is NO, it checks that there is no Saved Passwords section. |
| 404 - (void)checkIfPasswordsSaved:(BOOL)saved { | 404 - (void)checkIfPasswordsSaved:(BOOL)saved { |
| 405 [ChromeEarlGreyUI openToolsMenu]; | 405 [ChromeEarlGreyUI openToolsMenu]; |
| 406 [[EarlGrey selectElementWithMatcher:settingsButton()] | 406 [[EarlGrey selectElementWithMatcher:SettingsButton()] |
| 407 performAction:grey_tap()]; | 407 performAction:grey_tap()]; |
| 408 [[EarlGrey selectElementWithMatcher:passwordsButton()] | 408 [[EarlGrey selectElementWithMatcher:PasswordsButton()] |
| 409 performAction:grey_tap()]; | 409 performAction:grey_tap()]; |
| 410 | 410 |
| 411 id<GREYMatcher> visibilityMatcher = | 411 id<GREYMatcher> visibilityMatcher = |
| 412 saved ? grey_sufficientlyVisible() : grey_notVisible(); | 412 saved ? grey_sufficientlyVisible() : grey_notVisible(); |
| 413 [[EarlGrey selectElementWithMatcher: | 413 [[EarlGrey selectElementWithMatcher: |
| 414 grey_text(l10n_util::GetNSString( | 414 grey_text(l10n_util::GetNSString( |
| 415 IDS_PASSWORD_MANAGER_SHOW_PASSWORDS_TAB_TITLE))] | 415 IDS_PASSWORD_MANAGER_SHOW_PASSWORDS_TAB_TITLE))] |
| 416 assertWithMatcher:visibilityMatcher]; | 416 assertWithMatcher:visibilityMatcher]; |
| 417 | 417 |
| 418 // Close the Settings. | 418 // Close the Settings. |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 | 604 |
| 605 response[web::test::HttpServer::MakeUrl(kUrlWithSetCookie)] = | 605 response[web::test::HttpServer::MakeUrl(kUrlWithSetCookie)] = |
| 606 std::pair<std::string, std::string>(kCookie, kResponseWithSetCookie); | 606 std::pair<std::string, std::string>(kCookie, kResponseWithSetCookie); |
| 607 response[web::test::HttpServer::MakeUrl(kUrl)] = | 607 response[web::test::HttpServer::MakeUrl(kUrl)] = |
| 608 std::pair<std::string, std::string>("", kResponse); | 608 std::pair<std::string, std::string>("", kResponse); |
| 609 | 609 |
| 610 web::test::SetUpSimpleHttpServerWithSetCookies(response); | 610 web::test::SetUpSimpleHttpServerWithSetCookies(response); |
| 611 | 611 |
| 612 // Load |kUrl| and check that cookie is not set. | 612 // Load |kUrl| and check that cookie is not set. |
| 613 [ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kUrl)]; | 613 [ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kUrl)]; |
| 614 [[EarlGrey selectElementWithMatcher:chrome_test_util::webViewContainingText( | 614 [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewContainingText( |
| 615 kResponse)] | 615 kResponse)] |
| 616 assertWithMatcher:grey_notNil()]; | 616 assertWithMatcher:grey_notNil()]; |
| 617 AssertNoCookieExists(); | 617 AssertNoCookieExists(); |
| 618 | 618 |
| 619 // Visit |kUrlWithSetCookie| to set a cookie and then load |kUrl| to check it | 619 // Visit |kUrlWithSetCookie| to set a cookie and then load |kUrl| to check it |
| 620 // is still set. | 620 // is still set. |
| 621 [ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kUrlWithSetCookie)]; | 621 [ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kUrlWithSetCookie)]; |
| 622 [[EarlGrey selectElementWithMatcher:chrome_test_util::webViewContainingText( | 622 [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewContainingText( |
| 623 kResponseWithSetCookie)] | 623 kResponseWithSetCookie)] |
| 624 assertWithMatcher:grey_notNil()]; | 624 assertWithMatcher:grey_notNil()]; |
| 625 [ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kUrl)]; | 625 [ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kUrl)]; |
| 626 [[EarlGrey selectElementWithMatcher:chrome_test_util::webViewContainingText( | 626 [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewContainingText( |
| 627 kResponse)] | 627 kResponse)] |
| 628 assertWithMatcher:grey_notNil()]; | 628 assertWithMatcher:grey_notNil()]; |
| 629 | 629 |
| 630 AssertCookieExists(kCookie); | 630 AssertCookieExists(kCookie); |
| 631 | 631 |
| 632 // Restore the Clear Browsing Data checkmarks prefs to their default state in | 632 // Restore the Clear Browsing Data checkmarks prefs to their default state in |
| 633 // Teardown. | 633 // Teardown. |
| 634 [self setTearDownHandler:^{ | 634 [self setTearDownHandler:^{ |
| 635 ios::ChromeBrowserState* browserState = | 635 ios::ChromeBrowserState* browserState = |
| 636 chrome_test_util::GetOriginalBrowserState(); | 636 chrome_test_util::GetOriginalBrowserState(); |
| 637 PrefService* preferences = browserState->GetPrefs(); | 637 PrefService* preferences = browserState->GetPrefs(); |
| 638 | 638 |
| 639 preferences->SetBoolean(browsing_data::prefs::kDeleteBrowsingHistory, true); | 639 preferences->SetBoolean(browsing_data::prefs::kDeleteBrowsingHistory, true); |
| 640 preferences->SetBoolean(browsing_data::prefs::kDeleteCache, true); | 640 preferences->SetBoolean(browsing_data::prefs::kDeleteCache, true); |
| 641 preferences->SetBoolean(browsing_data::prefs::kDeleteCookies, true); | 641 preferences->SetBoolean(browsing_data::prefs::kDeleteCookies, true); |
| 642 preferences->SetBoolean(browsing_data::prefs::kDeletePasswords, false); | 642 preferences->SetBoolean(browsing_data::prefs::kDeletePasswords, false); |
| 643 preferences->SetBoolean(browsing_data::prefs::kDeleteFormData, false); | 643 preferences->SetBoolean(browsing_data::prefs::kDeleteFormData, false); |
| 644 }]; | 644 }]; |
| 645 | 645 |
| 646 // Clear all cookies. | 646 // Clear all cookies. |
| 647 [self clearCookiesAndSiteData]; | 647 [self clearCookiesAndSiteData]; |
| 648 | 648 |
| 649 // Reload and test that there are no cookies left. | 649 // Reload and test that there are no cookies left. |
| 650 [ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kUrl)]; | 650 [ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kUrl)]; |
| 651 [[EarlGrey selectElementWithMatcher:chrome_test_util::webViewContainingText( | 651 [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewContainingText( |
| 652 kResponse)] | 652 kResponse)] |
| 653 assertWithMatcher:grey_notNil()]; | 653 assertWithMatcher:grey_notNil()]; |
| 654 AssertNoCookieExists(); | 654 AssertNoCookieExists(); |
| 655 chrome_test_util::CloseAllTabs(); | 655 chrome_test_util::CloseAllTabs(); |
| 656 } | 656 } |
| 657 | 657 |
| 658 // Verifies that logging into a form on a web page allows the user to save and | 658 // Verifies that logging into a form on a web page allows the user to save and |
| 659 // then clear a password. | 659 // then clear a password. |
| 660 - (void)testClearPasswords { | 660 - (void)testClearPasswords { |
| 661 std::map<GURL, std::string> responses; | 661 std::map<GURL, std::string> responses; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 preferences->SetBoolean(browsing_data::prefs::kDeleteFormData, false); | 699 preferences->SetBoolean(browsing_data::prefs::kDeleteFormData, false); |
| 700 }]; | 700 }]; |
| 701 | 701 |
| 702 // Clear passwords and check that none are saved. | 702 // Clear passwords and check that none are saved. |
| 703 [self clearPasswords]; | 703 [self clearPasswords]; |
| 704 [self checkIfPasswordsSaved:NO]; | 704 [self checkIfPasswordsSaved:NO]; |
| 705 | 705 |
| 706 // Login to page and click to save password and check that its saved. | 706 // Login to page and click to save password and check that its saved. |
| 707 [ChromeEarlGrey loadURL:URL]; | 707 [ChromeEarlGrey loadURL:URL]; |
| 708 chrome_test_util::TapWebViewElementWithId("Login"); | 708 chrome_test_util::TapWebViewElementWithId("Login"); |
| 709 [[EarlGrey selectElementWithMatcher:buttonWithAccessibilityLabelId( | 709 [[EarlGrey selectElementWithMatcher:ButtonWithAccessibilityLabelId( |
| 710 IDS_IOS_PASSWORD_MANAGER_SAVE_BUTTON)] | 710 IDS_IOS_PASSWORD_MANAGER_SAVE_BUTTON)] |
| 711 performAction:grey_tap()]; | 711 performAction:grey_tap()]; |
| 712 | 712 |
| 713 [self checkIfPasswordsSaved:YES]; | 713 [self checkIfPasswordsSaved:YES]; |
| 714 | 714 |
| 715 // Clear passwords and check that none are saved. | 715 // Clear passwords and check that none are saved. |
| 716 [self clearPasswords]; | 716 [self clearPasswords]; |
| 717 [self checkIfPasswordsSaved:NO]; | 717 [self checkIfPasswordsSaved:NO]; |
| 718 } | 718 } |
| 719 | 719 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 GREYAssertTrue(IsCertificateCleared(), | 775 GREYAssertTrue(IsCertificateCleared(), |
| 776 @"Certificate is expected to be deleted."); | 776 @"Certificate is expected to be deleted."); |
| 777 } | 777 } |
| 778 | 778 |
| 779 // Verifies that Settings opens when signed-out and in Incognito mode. | 779 // Verifies that Settings opens when signed-out and in Incognito mode. |
| 780 // This tests that crbug.com/607335 has not regressed. | 780 // This tests that crbug.com/607335 has not regressed. |
| 781 - (void)testSettingsSignedOutIncognito { | 781 - (void)testSettingsSignedOutIncognito { |
| 782 chrome_test_util::OpenNewIncognitoTab(); | 782 chrome_test_util::OpenNewIncognitoTab(); |
| 783 | 783 |
| 784 [ChromeEarlGreyUI openToolsMenu]; | 784 [ChromeEarlGreyUI openToolsMenu]; |
| 785 [[EarlGrey selectElementWithMatcher:settingsButton()] | 785 [[EarlGrey selectElementWithMatcher:SettingsButton()] |
| 786 performAction:grey_tap()]; | 786 performAction:grey_tap()]; |
| 787 [[EarlGrey | 787 [[EarlGrey |
| 788 selectElementWithMatcher:grey_accessibilityID(kSettingsCollectionViewId)] | 788 selectElementWithMatcher:grey_accessibilityID(kSettingsCollectionViewId)] |
| 789 assertWithMatcher:grey_notNil()]; | 789 assertWithMatcher:grey_notNil()]; |
| 790 | 790 |
| 791 [[EarlGrey selectElementWithMatcher:navigationDoneButton()] | 791 [[EarlGrey selectElementWithMatcher:NavigationDoneButton()] |
| 792 performAction:grey_tap()]; | 792 performAction:grey_tap()]; |
| 793 chrome_test_util::CloseAllIncognitoTabs(); | 793 chrome_test_util::CloseAllIncognitoTabs(); |
| 794 } | 794 } |
| 795 | 795 |
| 796 // Verifies the UI elements are accessible on the Settings page. | 796 // Verifies the UI elements are accessible on the Settings page. |
| 797 - (void)testAccessibilityOnSettingsPage { | 797 - (void)testAccessibilityOnSettingsPage { |
| 798 [ChromeEarlGreyUI openToolsMenu]; | 798 [ChromeEarlGreyUI openToolsMenu]; |
| 799 [[EarlGrey selectElementWithMatcher:settingsButton()] | 799 [[EarlGrey selectElementWithMatcher:SettingsButton()] |
| 800 performAction:grey_tap()]; | 800 performAction:grey_tap()]; |
| 801 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 801 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 802 [[EarlGrey | 802 [[EarlGrey |
| 803 selectElementWithMatcher:chrome_test_util::buttonWithAccessibilityLabelId( | 803 selectElementWithMatcher:chrome_test_util::ButtonWithAccessibilityLabelId( |
| 804 IDS_IOS_NAVIGATION_BAR_DONE_BUTTON)] | 804 IDS_IOS_NAVIGATION_BAR_DONE_BUTTON)] |
| 805 performAction:grey_tap()]; | 805 performAction:grey_tap()]; |
| 806 } | 806 } |
| 807 | 807 |
| 808 // Verifies the UI elements are accessible on the Content Settings page. | 808 // Verifies the UI elements are accessible on the Content Settings page. |
| 809 - (void)testAccessibilityOnContentSettingsPage { | 809 - (void)testAccessibilityOnContentSettingsPage { |
| 810 [self openSubSettingMenu:chrome_test_util::buttonWithAccessibilityLabelId( | 810 [self openSubSettingMenu:chrome_test_util::ButtonWithAccessibilityLabelId( |
| 811 IDS_IOS_CONTENT_SETTINGS_TITLE)]; | 811 IDS_IOS_CONTENT_SETTINGS_TITLE)]; |
| 812 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 812 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 813 [self closeSubSettingsMenu]; | 813 [self closeSubSettingsMenu]; |
| 814 } | 814 } |
| 815 | 815 |
| 816 // Verifies the UI elements are accessible on the Content Settings | 816 // Verifies the UI elements are accessible on the Content Settings |
| 817 // Block Popups page. | 817 // Block Popups page. |
| 818 - (void)testAccessibilityOnContentSettingsBlockPopupsPage { | 818 - (void)testAccessibilityOnContentSettingsBlockPopupsPage { |
| 819 [self openSubSettingMenu:chrome_test_util::buttonWithAccessibilityLabelId( | 819 [self openSubSettingMenu:chrome_test_util::ButtonWithAccessibilityLabelId( |
| 820 IDS_IOS_CONTENT_SETTINGS_TITLE)]; | 820 IDS_IOS_CONTENT_SETTINGS_TITLE)]; |
| 821 [[EarlGrey selectElementWithMatcher:BlockPopupsButton()] | 821 [[EarlGrey selectElementWithMatcher:BlockPopupsButton()] |
| 822 performAction:grey_tap()]; | 822 performAction:grey_tap()]; |
| 823 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 823 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 824 [self closeSubSettingsMenu]; | 824 [self closeSubSettingsMenu]; |
| 825 } | 825 } |
| 826 | 826 |
| 827 // Verifies the UI elements are accessible on the Content Translations Settings | 827 // Verifies the UI elements are accessible on the Content Translations Settings |
| 828 // page. | 828 // page. |
| 829 - (void)testAccessibilityOnContentSettingsTranslatePage { | 829 - (void)testAccessibilityOnContentSettingsTranslatePage { |
| 830 [self openSubSettingMenu:chrome_test_util::buttonWithAccessibilityLabelId( | 830 [self openSubSettingMenu:chrome_test_util::ButtonWithAccessibilityLabelId( |
| 831 IDS_IOS_CONTENT_SETTINGS_TITLE)]; | 831 IDS_IOS_CONTENT_SETTINGS_TITLE)]; |
| 832 [[EarlGrey selectElementWithMatcher:TranslateSettingsButton()] | 832 [[EarlGrey selectElementWithMatcher:TranslateSettingsButton()] |
| 833 performAction:grey_tap()]; | 833 performAction:grey_tap()]; |
| 834 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 834 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 835 [self closeSubSettingsMenu]; | 835 [self closeSubSettingsMenu]; |
| 836 } | 836 } |
| 837 | 837 |
| 838 // Verifies the UI elements are accessible on the Privacy Settings page. | 838 // Verifies the UI elements are accessible on the Privacy Settings page. |
| 839 - (void)testAccessibilityOnPrivacySettingsPage { | 839 - (void)testAccessibilityOnPrivacySettingsPage { |
| 840 [self openSubSettingMenu:chrome_test_util::buttonWithAccessibilityLabelId( | 840 [self openSubSettingMenu:chrome_test_util::ButtonWithAccessibilityLabelId( |
| 841 IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY)]; | 841 IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY)]; |
| 842 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 842 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 843 [self closeSubSettingsMenu]; | 843 [self closeSubSettingsMenu]; |
| 844 } | 844 } |
| 845 | 845 |
| 846 // Verifies the UI elements are accessible on the Privacy Handoff Settings | 846 // Verifies the UI elements are accessible on the Privacy Handoff Settings |
| 847 // page. | 847 // page. |
| 848 - (void)testAccessibilityOnPrivacyHandoffSettingsPage { | 848 - (void)testAccessibilityOnPrivacyHandoffSettingsPage { |
| 849 [self openSubSettingMenu:chrome_test_util::buttonWithAccessibilityLabelId( | 849 [self openSubSettingMenu:chrome_test_util::ButtonWithAccessibilityLabelId( |
| 850 IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY)]; | 850 IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY)]; |
| 851 [[EarlGrey selectElementWithMatcher:PrivacyHandoffButton()] | 851 [[EarlGrey selectElementWithMatcher:PrivacyHandoffButton()] |
| 852 performAction:grey_tap()]; | 852 performAction:grey_tap()]; |
| 853 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 853 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 854 [self closeSubSettingsMenu]; | 854 [self closeSubSettingsMenu]; |
| 855 } | 855 } |
| 856 | 856 |
| 857 // Verifies the UI elements are accessible on the Privacy Clear Browsing Data | 857 // Verifies the UI elements are accessible on the Privacy Clear Browsing Data |
| 858 // Settings page. | 858 // Settings page. |
| 859 - (void)testAccessibilityOnPrivacyClearBrowsingHistoryPage { | 859 - (void)testAccessibilityOnPrivacyClearBrowsingHistoryPage { |
| 860 [self openSubSettingMenu:chrome_test_util::buttonWithAccessibilityLabelId( | 860 [self openSubSettingMenu:chrome_test_util::ButtonWithAccessibilityLabelId( |
| 861 IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY)]; | 861 IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY)]; |
| 862 [[EarlGrey selectElementWithMatcher:clearBrowsingDataButton()] | 862 [[EarlGrey selectElementWithMatcher:ClearBrowsingDataButton()] |
| 863 performAction:grey_tap()]; | 863 performAction:grey_tap()]; |
| 864 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 864 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 865 [self closeSubSettingsMenu]; | 865 [self closeSubSettingsMenu]; |
| 866 } | 866 } |
| 867 | 867 |
| 868 // Verifies the UI elements are accessible on the Bandwidth Management Settings | 868 // Verifies the UI elements are accessible on the Bandwidth Management Settings |
| 869 // page. | 869 // page. |
| 870 - (void)testAccessibilityOnBandwidthManagementSettingsPage { | 870 - (void)testAccessibilityOnBandwidthManagementSettingsPage { |
| 871 [self openSubSettingMenu:chrome_test_util::buttonWithAccessibilityLabelId( | 871 [self openSubSettingMenu:chrome_test_util::ButtonWithAccessibilityLabelId( |
| 872 IDS_IOS_BANDWIDTH_MANAGEMENT_SETTINGS)]; | 872 IDS_IOS_BANDWIDTH_MANAGEMENT_SETTINGS)]; |
| 873 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 873 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 874 [self closeSubSettingsMenu]; | 874 [self closeSubSettingsMenu]; |
| 875 } | 875 } |
| 876 | 876 |
| 877 // Verifies the UI elements are accessible on the Bandwidth Preload Webpages | 877 // Verifies the UI elements are accessible on the Bandwidth Preload Webpages |
| 878 // Settings page. | 878 // Settings page. |
| 879 - (void)testAccessibilityOnBandwidthPreloadWebpagesSettingsPage { | 879 - (void)testAccessibilityOnBandwidthPreloadWebpagesSettingsPage { |
| 880 [self openSubSettingMenu:chrome_test_util::buttonWithAccessibilityLabelId( | 880 [self openSubSettingMenu:chrome_test_util::ButtonWithAccessibilityLabelId( |
| 881 IDS_IOS_BANDWIDTH_MANAGEMENT_SETTINGS)]; | 881 IDS_IOS_BANDWIDTH_MANAGEMENT_SETTINGS)]; |
| 882 [[EarlGrey selectElementWithMatcher:BandwidthPreloadWebpagesButton()] | 882 [[EarlGrey selectElementWithMatcher:BandwidthPreloadWebpagesButton()] |
| 883 performAction:grey_tap()]; | 883 performAction:grey_tap()]; |
| 884 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 884 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 885 [self closeSubSettingsMenu]; | 885 [self closeSubSettingsMenu]; |
| 886 } | 886 } |
| 887 | 887 |
| 888 // Verifies the UI elements are accessible on the Save Passwords page. | 888 // Verifies the UI elements are accessible on the Save Passwords page. |
| 889 - (void)testAccessibilityOnSavePasswords { | 889 - (void)testAccessibilityOnSavePasswords { |
| 890 [ChromeEarlGreyUI openToolsMenu]; | 890 [ChromeEarlGreyUI openToolsMenu]; |
| 891 [[EarlGrey selectElementWithMatcher:settingsButton()] | 891 [[EarlGrey selectElementWithMatcher:SettingsButton()] |
| 892 performAction:grey_tap()]; | 892 performAction:grey_tap()]; |
| 893 [[EarlGrey selectElementWithMatcher:passwordsButton()] | 893 [[EarlGrey selectElementWithMatcher:PasswordsButton()] |
| 894 performAction:grey_tap()]; | 894 performAction:grey_tap()]; |
| 895 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 895 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 896 [self closeSubSettingsMenu]; | 896 [self closeSubSettingsMenu]; |
| 897 } | 897 } |
| 898 | 898 |
| 899 // Verifies the UI elements are accessible on the Search engine page. | 899 // Verifies the UI elements are accessible on the Search engine page. |
| 900 - (void)testAccessibilityOnSearchEngine { | 900 - (void)testAccessibilityOnSearchEngine { |
| 901 [ChromeEarlGreyUI openToolsMenu]; | 901 [ChromeEarlGreyUI openToolsMenu]; |
| 902 [[EarlGrey selectElementWithMatcher:settingsButton()] | 902 [[EarlGrey selectElementWithMatcher:SettingsButton()] |
| 903 performAction:grey_tap()]; | 903 performAction:grey_tap()]; |
| 904 [[EarlGrey selectElementWithMatcher:searchEngineButton()] | 904 [[EarlGrey selectElementWithMatcher:SearchEngineButton()] |
| 905 performAction:grey_tap()]; | 905 performAction:grey_tap()]; |
| 906 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 906 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 907 [self closeSubSettingsMenu]; | 907 [self closeSubSettingsMenu]; |
| 908 } | 908 } |
| 909 | 909 |
| 910 // Verifies the UI elements are accessible on the Autofill Forms page. | 910 // Verifies the UI elements are accessible on the Autofill Forms page. |
| 911 - (void)testAccessibilityOnAutofillForms { | 911 - (void)testAccessibilityOnAutofillForms { |
| 912 [ChromeEarlGreyUI openToolsMenu]; | 912 [ChromeEarlGreyUI openToolsMenu]; |
| 913 [[EarlGrey selectElementWithMatcher:settingsButton()] | 913 [[EarlGrey selectElementWithMatcher:SettingsButton()] |
| 914 performAction:grey_tap()]; | 914 performAction:grey_tap()]; |
| 915 [[EarlGrey selectElementWithMatcher:autofillButton()] | 915 [[EarlGrey selectElementWithMatcher:AutofillButton()] |
| 916 performAction:grey_tap()]; | 916 performAction:grey_tap()]; |
| 917 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 917 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 918 [self closeSubSettingsMenu]; | 918 [self closeSubSettingsMenu]; |
| 919 } | 919 } |
| 920 | 920 |
| 921 // Verifies the UI elements are accessible on the Google Apps page. | 921 // Verifies the UI elements are accessible on the Google Apps page. |
| 922 - (void)testAccessibilityOnGoogleApps { | 922 - (void)testAccessibilityOnGoogleApps { |
| 923 [ChromeEarlGreyUI openToolsMenu]; | 923 [ChromeEarlGreyUI openToolsMenu]; |
| 924 [[EarlGrey selectElementWithMatcher:settingsButton()] | 924 [[EarlGrey selectElementWithMatcher:SettingsButton()] |
| 925 performAction:grey_tap()]; | 925 performAction:grey_tap()]; |
| 926 [[EarlGrey selectElementWithMatcher:googleAppsButton()] | 926 [[EarlGrey selectElementWithMatcher:GoogleAppsButton()] |
| 927 performAction:grey_tap()]; | 927 performAction:grey_tap()]; |
| 928 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 928 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 929 [self closeSubSettingsMenu]; | 929 [self closeSubSettingsMenu]; |
| 930 } | 930 } |
| 931 | 931 |
| 932 // Verifies the UI elements are accessible on the About Chrome page. | 932 // Verifies the UI elements are accessible on the About Chrome page. |
| 933 - (void)testAccessibilityOnGoogleChrome { | 933 - (void)testAccessibilityOnGoogleChrome { |
| 934 [self openSubSettingMenu:googleChromeButton()]; | 934 [self openSubSettingMenu:GoogleChromeButton()]; |
| 935 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 935 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 936 [self closeSubSettingsMenu]; | 936 [self closeSubSettingsMenu]; |
| 937 } | 937 } |
| 938 | 938 |
| 939 // Verifies the UI elements are accessible on the Voice Search page. | 939 // Verifies the UI elements are accessible on the Voice Search page. |
| 940 - (void)testAccessibilityOnVoiceSearch { | 940 - (void)testAccessibilityOnVoiceSearch { |
| 941 [self openSubSettingMenu:voiceSearchButton()]; | 941 [self openSubSettingMenu:VoiceSearchButton()]; |
| 942 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 942 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 943 [self closeSubSettingsMenu]; | 943 [self closeSubSettingsMenu]; |
| 944 } | 944 } |
| 945 | 945 |
| 946 // Verifies the UI elements are accessible on the Passwords page. | 946 // Verifies the UI elements are accessible on the Passwords page. |
| 947 - (void)testAccessibilityOnPasswords { | 947 - (void)testAccessibilityOnPasswords { |
| 948 [ChromeEarlGreyUI openToolsMenu]; | 948 [ChromeEarlGreyUI openToolsMenu]; |
| 949 [[EarlGrey selectElementWithMatcher:settingsButton()] | 949 [[EarlGrey selectElementWithMatcher:SettingsButton()] |
| 950 performAction:grey_tap()]; | 950 performAction:grey_tap()]; |
| 951 [[EarlGrey selectElementWithMatcher:passwordsButton()] | 951 [[EarlGrey selectElementWithMatcher:PasswordsButton()] |
| 952 performAction:grey_tap()]; | 952 performAction:grey_tap()]; |
| 953 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 953 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 954 [self closeSubSettingsMenu]; | 954 [self closeSubSettingsMenu]; |
| 955 } | 955 } |
| 956 | 956 |
| 957 @end | 957 @end |
| OLD | NEW |