| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 151 } |
| 152 // Matcher for the Privacy Block Popups button on the privacy UI. | 152 // Matcher for the Privacy Block Popups button on the privacy UI. |
| 153 id<GREYMatcher> BlockPopupsButton() { | 153 id<GREYMatcher> BlockPopupsButton() { |
| 154 return ButtonWithAccessibilityLabelId(IDS_IOS_BLOCK_POPUPS); | 154 return ButtonWithAccessibilityLabelId(IDS_IOS_BLOCK_POPUPS); |
| 155 } | 155 } |
| 156 // Matcher for the Privacy Translate Settings button on the privacy UI. | 156 // Matcher for the Privacy Translate Settings button on the privacy UI. |
| 157 id<GREYMatcher> TranslateSettingsButton() { | 157 id<GREYMatcher> TranslateSettingsButton() { |
| 158 return ButtonWithAccessibilityLabelId(IDS_IOS_TRANSLATE_SETTING); | 158 return ButtonWithAccessibilityLabelId(IDS_IOS_TRANSLATE_SETTING); |
| 159 } | 159 } |
| 160 // Matcher for the save button in the save password bar. | 160 // Matcher for the save button in the save password bar. |
| 161 id<GREYMatcher> savePasswordButton() { | 161 id<GREYMatcher> SavePasswordButton() { |
| 162 return ButtonWithAccessibilityLabelId(IDS_IOS_PASSWORD_MANAGER_SAVE_BUTTON); | 162 return ButtonWithAccessibilityLabelId(IDS_IOS_PASSWORD_MANAGER_SAVE_BUTTON); |
| 163 } | 163 } |
| 164 | 164 |
| 165 // Run as a task to check if a certificate has been added to the ChannelIDStore. | 165 // Run as a task to check if a certificate has been added to the ChannelIDStore. |
| 166 // Signals the given |semaphore| if the cert was added, or reposts itself | 166 // Signals the given |semaphore| if the cert was added, or reposts itself |
| 167 // otherwise. | 167 // otherwise. |
| 168 void CheckCertificate(scoped_refptr<net::URLRequestContextGetter> getter, | 168 void CheckCertificate(scoped_refptr<net::URLRequestContextGetter> getter, |
| 169 dispatch_semaphore_t semaphore) { | 169 dispatch_semaphore_t semaphore) { |
| 170 net::ChannelIDService* channel_id_service = | 170 net::ChannelIDService* channel_id_service = |
| 171 getter->GetURLRequestContext()->channel_id_service(); | 171 getter->GetURLRequestContext()->channel_id_service(); |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 "<input type=\"submit\" value=\"Login\" id=\"Login\"/>" | 438 "<input type=\"submit\" value=\"Login\" id=\"Login\"/>" |
| 439 "</form>"; | 439 "</form>"; |
| 440 const GURL destinationURL = | 440 const GURL destinationURL = |
| 441 web::test::HttpServer::MakeUrl("http://testClearPasswords/dest"); | 441 web::test::HttpServer::MakeUrl("http://testClearPasswords/dest"); |
| 442 responses[destinationURL] = "Logged in!"; | 442 responses[destinationURL] = "Logged in!"; |
| 443 web::test::SetUpSimpleHttpServer(responses); | 443 web::test::SetUpSimpleHttpServer(responses); |
| 444 | 444 |
| 445 // Login to page and click to save password and check that its saved. | 445 // Login to page and click to save password and check that its saved. |
| 446 [ChromeEarlGrey loadURL:URL]; | 446 [ChromeEarlGrey loadURL:URL]; |
| 447 chrome_test_util::TapWebViewElementWithId("Login"); | 447 chrome_test_util::TapWebViewElementWithId("Login"); |
| 448 [[EarlGrey selectElementWithMatcher:savePasswordButton()] | 448 [[EarlGrey selectElementWithMatcher:SavePasswordButton()] |
| 449 performAction:grey_tap()]; | 449 performAction:grey_tap()]; |
| 450 } | 450 } |
| 451 | 451 |
| 452 // Opens the passwords page from the NTP. It requires no menus to be open. | 452 // Opens the passwords page from the NTP. It requires no menus to be open. |
| 453 - (void)openPasswordSettings { | 453 - (void)openPasswordSettings { |
| 454 // Open settings and verify data in the view controller. | 454 // Open settings and verify data in the view controller. |
| 455 [ChromeEarlGreyUI openToolsMenu]; | 455 [ChromeEarlGreyUI openToolsMenu]; |
| 456 [[EarlGrey | 456 [[EarlGrey |
| 457 selectElementWithMatcher:grey_accessibilityID(kToolsMenuSettingsId)] | 457 selectElementWithMatcher:grey_accessibilityID(kToolsMenuSettingsId)] |
| 458 performAction:grey_tap()]; | 458 performAction:grey_tap()]; |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 performAction:grey_tap()]; | 1030 performAction:grey_tap()]; |
| 1031 [[EarlGrey selectElementWithMatcher:PrivacyButton()] | 1031 [[EarlGrey selectElementWithMatcher:PrivacyButton()] |
| 1032 performAction:grey_tap()]; | 1032 performAction:grey_tap()]; |
| 1033 [[EarlGrey selectElementWithMatcher:SendUsageDataButton()] | 1033 [[EarlGrey selectElementWithMatcher:SendUsageDataButton()] |
| 1034 performAction:grey_tap()]; | 1034 performAction:grey_tap()]; |
| 1035 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 1035 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 1036 [self closeSubSettingsMenu]; | 1036 [self closeSubSettingsMenu]; |
| 1037 } | 1037 } |
| 1038 | 1038 |
| 1039 @end | 1039 @end |
| OLD | NEW |