Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Side by Side Diff: ios/chrome/browser/ui/bookmarks/bookmarks_egtest.mm

Issue 2714933002: Add tests against pressing tab when a view controller is presented
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ios/chrome/browser/ui/history/history_ui_egtest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <vector> 5 #include <vector>
6 6
7 #import <EarlGrey/EarlGrey.h> 7 #import <EarlGrey/EarlGrey.h>
8 #import <UIKit/UIKit.h> 8 #import <UIKit/UIKit.h>
9 #import <XCTest/XCTest.h> 9 #import <XCTest/XCTest.h>
10 10
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 122 }
123 123
124 return grey_allOf(grey_accessibilityLabel( 124 return grey_allOf(grey_accessibilityLabel(
125 l10n_util::GetNSString(accessibilityLabelMessageID)), 125 l10n_util::GetNSString(accessibilityLabelMessageID)),
126 grey_accessibilityTrait(UIAccessibilityTraitButton), 126 grey_accessibilityTrait(UIAccessibilityTraitButton),
127 grey_not(grey_accessibilityID(@"Edit_editing_bar")), nil); 127 grey_not(grey_accessibilityID(@"Edit_editing_bar")), nil);
128 } 128 }
129 129
130 } // namespace 130 } // namespace
131 131
132 // Expose the first responder.
133 @interface UIWindow (FirstResponder)
134 - (UIResponder*)firstResponder;
135 @end
136
132 // Bookmark integration tests for Chrome. 137 // Bookmark integration tests for Chrome.
133 @interface BookmarksTestCase : ChromeTestCase 138 @interface BookmarksTestCase : ChromeTestCase
134 @end 139 @end
135 140
136 @implementation BookmarksTestCase 141 @implementation BookmarksTestCase
137 142
138 - (void)setUp { 143 - (void)setUp {
139 [super setUp]; 144 [super setUp];
140 // Wait for bookmark model to be loaded. 145 // Wait for bookmark model to be loaded.
141 GREYAssert(testing::WaitUntilConditionOrTimeout( 146 GREYAssert(testing::WaitUntilConditionOrTimeout(
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 1263
1259 // Tap the Select action. 1264 // Tap the Select action.
1260 [[EarlGrey selectElementWithMatcher:ActionSheet(ActionSelect)] 1265 [[EarlGrey selectElementWithMatcher:ActionSheet(ActionSelect)]
1261 performAction:grey_tap()]; 1266 performAction:grey_tap()];
1262 chrome_test_util::VerifyAccessibilityForCurrentScreen(); 1267 chrome_test_util::VerifyAccessibilityForCurrentScreen();
1263 // Dismiss selector with Cancel button. 1268 // Dismiss selector with Cancel button.
1264 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Exit Edit Mode")] 1269 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Exit Edit Mode")]
1265 performAction:grey_tap()]; 1270 performAction:grey_tap()];
1266 } 1271 }
1267 1272
1273 // Tests that hitting the tab key doesn't trigger the omnibox in the background.
1274 // Testing against regressions of the fix for crbug.com/676993.
1275 - (void)testTabKeyIsANoOpWhenEditing {
1276 const GURL bookmarkURL = web::test::HttpServer::MakeUrl(
1277 "http://ios/testing/data/http_server_files/destination.html");
1278 NSString* bookmarkTitle = @"Some Bookmark";
1279
1280 // Load a bookmark into the bookmark model.
1281 [BookmarksTestCase addBookmark:bookmarkURL withTitle:bookmarkTitle];
1282
1283 // Open the bookmark editor.
1284 NSString* const kStarLitLabel =
1285 !IsCompact() ? l10n_util::GetNSString(IDS_TOOLTIP_STAR)
1286 : l10n_util::GetNSString(IDS_IOS_BOOKMARK_EDIT_SCREEN_TITLE);
1287 if (IsCompact()) {
1288 [ChromeEarlGreyUI openToolsMenu];
1289 }
1290 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(kStarLitLabel)]
1291 performAction:grey_tap()];
1292
1293 // Hit the tab key.
1294 // TODO(crbug.com/695876): Simulate a tab key press with EalrGrey.
1295
1296 // Verify that the omnibox is not focused.
1297 GREYAssertFalse([[[[UIApplication sharedApplication] keyWindow]
1298 firstResponder] isKindOfClass:[UITextField class]]);
1299 }
1300
1301 // Tests that hitting the tab key doesn't trigger the omnibox in the background.
1302 // Testing against regressions of the fix for crbug.com/676993.
1303 - (void)testTabKeyIsANoOpWhenSignInPromoIsOpen {
1304 TODO
1305 }
1306
1268 #pragma mark Helper Methods 1307 #pragma mark Helper Methods
1269 1308
1270 // Navigates to the bookmark manager UI. 1309 // Navigates to the bookmark manager UI.
1271 + (void)openBookmarks { 1310 + (void)openBookmarks {
1272 [ChromeEarlGreyUI openToolsMenu]; 1311 [ChromeEarlGreyUI openToolsMenu];
1273 1312
1274 // Opens the bookmark manager. 1313 // Opens the bookmark manager.
1275 [[EarlGrey 1314 [[EarlGrey
1276 selectElementWithMatcher:grey_accessibilityID(kToolsMenuBookmarksId)] 1315 selectElementWithMatcher:grey_accessibilityID(kToolsMenuBookmarksId)]
1277 performAction:grey_tap()]; 1316 performAction:grey_tap()];
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1689 if (!IsCompact()) { 1728 if (!IsCompact()) {
1690 [[EarlGrey selectElementWithMatcher:StarButton()] performAction:grey_tap()]; 1729 [[EarlGrey selectElementWithMatcher:StarButton()] performAction:grey_tap()];
1691 } else { 1730 } else {
1692 [ChromeEarlGreyUI openToolsMenu]; 1731 [ChromeEarlGreyUI openToolsMenu];
1693 [[EarlGrey selectElementWithMatcher:AddBookmarkButton()] 1732 [[EarlGrey selectElementWithMatcher:AddBookmarkButton()]
1694 performAction:grey_tap()]; 1733 performAction:grey_tap()];
1695 } 1734 }
1696 } 1735 }
1697 1736
1698 @end 1737 @end
OLDNEW
« no previous file with comments | « no previous file | ios/chrome/browser/ui/history/history_ui_egtest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698