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

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

Issue 2666833003: Revert of Removing "All Bookmarks" (Closed)
Patch Set: Created 3 years, 10 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
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 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 [[self class] setupStandardBookmarks]; 998 [[self class] setupStandardBookmarks];
999 [[self class] openBookmarkFolder:@"Folder 1"]; 999 [[self class] openBookmarkFolder:@"Folder 1"];
1000 [[EarlGrey selectElementWithMatcher:grey_text(@"Folder 2")] 1000 [[EarlGrey selectElementWithMatcher:grey_text(@"Folder 2")]
1001 performAction:grey_tap()]; 1001 performAction:grey_tap()];
1002 [[EarlGrey selectElementWithMatcher:grey_text(@"Folder 3")] 1002 [[EarlGrey selectElementWithMatcher:grey_text(@"Folder 3")]
1003 performAction:grey_tap()]; 1003 performAction:grey_tap()];
1004 1004
1005 [[self class] removeBookmarkWithTitle:@"Folder 1"]; 1005 [[self class] removeBookmarkWithTitle:@"Folder 1"];
1006 1006
1007 NSString* rootFolderTitle = nil; 1007 NSString* rootFolderTitle = nil;
1008 rootFolderTitle = @"Mobile Bookmarks"; 1008 if (experimental_flags::IsAllBookmarksEnabled()) {
1009 rootFolderTitle = @"Bookmarks";
1010 } else {
1011 rootFolderTitle = @"Mobile Bookmarks";
1012 }
1009 1013
1010 // Folder 2 and 3 are now deleted, UI should have moved to top level folder. 1014 // Folder 2 and 3 are now deleted, UI should have moved to top level folder.
1011 [[EarlGrey 1015 [[EarlGrey
1012 selectElementWithMatcher:grey_allOf( 1016 selectElementWithMatcher:grey_allOf(
1013 grey_kindOfClass(NSClassFromString( 1017 grey_kindOfClass(NSClassFromString(
1014 @"BookmarkNavigationBar")), 1018 @"BookmarkNavigationBar")),
1015 grey_descendant(grey_text(rootFolderTitle)), 1019 grey_descendant(grey_text(rootFolderTitle)),
1016 nil)] assertWithMatcher:grey_notNil()]; 1020 nil)] assertWithMatcher:grey_notNil()];
1017 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"Folder 1")] 1021 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"Folder 1")]
1018 assertWithMatcher:grey_notVisible()]; 1022 assertWithMatcher:grey_notVisible()];
1019 1023
1020 if (IsCompact()) { 1024 if (IsCompact()) {
1021 // Opens the bookmark manager sidebar on handsets. 1025 // Opens the bookmark manager sidebar on handsets.
1022 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Menu")] 1026 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Menu")]
1023 performAction:grey_tap()]; 1027 performAction:grey_tap()];
1024 1028
1025 // Test that the root folder is selected in the menu. This is only the case 1029 // Test that the root folder is selected in the menu. This is only the case
1026 // on iPhone. 1030 // on iPhone.
1031 if (experimental_flags::IsAllBookmarksEnabled()) {
1032 rootFolderTitle = @"All Bookmarks";
1033 }
1034
1027 GREYElementMatcherBlock* selectedMatcher = 1035 GREYElementMatcherBlock* selectedMatcher =
1028 [GREYElementMatcherBlock matcherWithMatchesBlock:^BOOL(id element) { 1036 [GREYElementMatcherBlock matcherWithMatchesBlock:^BOOL(id element) {
1029 UITableViewCell* cell = (UITableViewCell*)element; 1037 UITableViewCell* cell = (UITableViewCell*)element;
1030 return [cell isSelected]; 1038 return [cell isSelected];
1031 } 1039 }
1032 descriptionBlock:^void(id<GREYDescription> description) { 1040 descriptionBlock:^void(id<GREYDescription> description) {
1033 [description appendText:@"Selected UI element."]; 1041 [description appendText:@"Selected UI element."];
1034 }]; 1042 }];
1035 [[EarlGrey 1043 [[EarlGrey
1036 selectElementWithMatcher:grey_allOf(grey_kindOfClass(NSClassFromString( 1044 selectElementWithMatcher:grey_allOf(grey_kindOfClass(NSClassFromString(
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 [[EarlGrey 1294 [[EarlGrey
1287 selectElementWithMatcher:grey_allOf( 1295 selectElementWithMatcher:grey_allOf(
1288 grey_kindOfClass( 1296 grey_kindOfClass(
1289 NSClassFromString(@"BookmarkMenuCell")), 1297 NSClassFromString(@"BookmarkMenuCell")),
1290 grey_descendant(grey_text(bookmarkFolder)), 1298 grey_descendant(grey_text(bookmarkFolder)),
1291 nil)] performAction:grey_tap()]; 1299 nil)] performAction:grey_tap()];
1292 } 1300 }
1293 1301
1294 // Navigates to the bookmark manager UI, and selects the top level folder. 1302 // Navigates to the bookmark manager UI, and selects the top level folder.
1295 + (void)openTopLevelBookmarksFolder { 1303 + (void)openTopLevelBookmarksFolder {
1296 [BookmarksTestCase openMobileBookmarks]; 1304 if (experimental_flags::IsAllBookmarksEnabled()) {
1305 [BookmarksTestCase openBookmarkFolder:@"All Bookmarks"];
1306 } else {
1307 [BookmarksTestCase openMobileBookmarks];
1308 }
1297 } 1309 }
1298 1310
1299 // Navigates to the bookmark manager UI, and selects MobileBookmarks. 1311 // Navigates to the bookmark manager UI, and selects MobileBookmarks.
1300 + (void)openMobileBookmarks { 1312 + (void)openMobileBookmarks {
1301 [BookmarksTestCase openBookmarkFolder:@"Mobile Bookmarks"]; 1313 [BookmarksTestCase openBookmarkFolder:@"Mobile Bookmarks"];
1302 } 1314 }
1303 1315
1304 // Adds a bookmark, then navigates to the bookmark manager UI, and 1316 // Adds a bookmark, then navigates to the bookmark manager UI, and
1305 // selects MobileBookmarks. 1317 // selects MobileBookmarks.
1306 + (void)openMobileBookmarksPrepopulatedWithOneBookmark { 1318 + (void)openMobileBookmarksPrepopulatedWithOneBookmark {
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1680 if (!IsCompact()) { 1692 if (!IsCompact()) {
1681 [[EarlGrey selectElementWithMatcher:StarButton()] performAction:grey_tap()]; 1693 [[EarlGrey selectElementWithMatcher:StarButton()] performAction:grey_tap()];
1682 } else { 1694 } else {
1683 [ChromeEarlGreyUI openToolsMenu]; 1695 [ChromeEarlGreyUI openToolsMenu];
1684 [[EarlGrey selectElementWithMatcher:AddBookmarkButton()] 1696 [[EarlGrey selectElementWithMatcher:AddBookmarkButton()]
1685 performAction:grey_tap()]; 1697 performAction:grey_tap()];
1686 } 1698 }
1687 } 1699 }
1688 1700
1689 @end 1701 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698