Commit 6cdec207 authored by edchin's avatar edchin Committed by Commit Bot

[ios] Add bookmark context menu constant

This CL simply replaces about a dozen uses of @"bookmark_context_menu"
with a constant accessibility identifier in
bookmark_ui_constants.h.

Change-Id: Ibbfb86930cb09035ff271f83e5971dbc35f1c717
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2146288Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Commit-Queue: edchin <edchin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#759279}
parent ae857b2f
...@@ -229,8 +229,8 @@ id<GREYMatcher> SearchIconButton() { ...@@ -229,8 +229,8 @@ id<GREYMatcher> SearchIconButton() {
- (void)verifyContextMenuForSingleURL { - (void)verifyContextMenuForSingleURL {
// Verify it shows the context menu. // Verify it shows the context menu.
[[EarlGrey [[EarlGrey selectElementWithMatcher:grey_accessibilityID(
selectElementWithMatcher:grey_accessibilityID(@"bookmark_context_menu")] kBookmarkHomeContextMenuIdentifier)]
assertWithMatcher:grey_sufficientlyVisible()]; assertWithMatcher:grey_sufficientlyVisible()];
// Verify options on context menu. // Verify options on context menu.
......
...@@ -1595,7 +1595,7 @@ std::vector<GURL> GetUrlsToOpen(const std::vector<const BookmarkNode*>& nodes) { ...@@ -1595,7 +1595,7 @@ std::vector<GURL> GetUrlsToOpen(const std::vector<const BookmarkNode*>& nodes) {
forMultipleBookmarkURLs:(const std::set<const BookmarkNode*>)nodes { forMultipleBookmarkURLs:(const std::set<const BookmarkNode*>)nodes {
__weak BookmarkHomeViewController* weakSelf = self; __weak BookmarkHomeViewController* weakSelf = self;
coordinator.alertController.view.accessibilityIdentifier = coordinator.alertController.view.accessibilityIdentifier =
@"bookmark_context_menu"; kBookmarkHomeContextMenuIdentifier;
[coordinator [coordinator
addItemWithTitle:l10n_util::GetNSString( addItemWithTitle:l10n_util::GetNSString(
...@@ -1634,7 +1634,7 @@ std::vector<GURL> GetUrlsToOpen(const std::vector<const BookmarkNode*>& nodes) { ...@@ -1634,7 +1634,7 @@ std::vector<GURL> GetUrlsToOpen(const std::vector<const BookmarkNode*>& nodes) {
__weak BookmarkHomeViewController* weakSelf = self; __weak BookmarkHomeViewController* weakSelf = self;
std::string urlString = node->url().possibly_invalid_spec(); std::string urlString = node->url().possibly_invalid_spec();
coordinator.alertController.view.accessibilityIdentifier = coordinator.alertController.view.accessibilityIdentifier =
@"bookmark_context_menu"; kBookmarkHomeContextMenuIdentifier;
[coordinator addItemWithTitle:l10n_util::GetNSString( [coordinator addItemWithTitle:l10n_util::GetNSString(
IDS_IOS_BOOKMARK_CONTEXT_MENU_EDIT) IDS_IOS_BOOKMARK_CONTEXT_MENU_EDIT)
...@@ -1679,7 +1679,7 @@ std::vector<GURL> GetUrlsToOpen(const std::vector<const BookmarkNode*>& nodes) { ...@@ -1679,7 +1679,7 @@ std::vector<GURL> GetUrlsToOpen(const std::vector<const BookmarkNode*>& nodes) {
forSingleBookmarkFolder:(const BookmarkNode*)node { forSingleBookmarkFolder:(const BookmarkNode*)node {
__weak BookmarkHomeViewController* weakSelf = self; __weak BookmarkHomeViewController* weakSelf = self;
coordinator.alertController.view.accessibilityIdentifier = coordinator.alertController.view.accessibilityIdentifier =
@"bookmark_context_menu"; kBookmarkHomeContextMenuIdentifier;
[coordinator addItemWithTitle:l10n_util::GetNSString( [coordinator addItemWithTitle:l10n_util::GetNSString(
IDS_IOS_BOOKMARK_CONTEXT_MENU_EDIT_FOLDER) IDS_IOS_BOOKMARK_CONTEXT_MENU_EDIT_FOLDER)
...@@ -1707,7 +1707,7 @@ std::vector<GURL> GetUrlsToOpen(const std::vector<const BookmarkNode*>& nodes) { ...@@ -1707,7 +1707,7 @@ std::vector<GURL> GetUrlsToOpen(const std::vector<const BookmarkNode*>& nodes) {
(const std::set<const bookmarks::BookmarkNode*>)nodes { (const std::set<const bookmarks::BookmarkNode*>)nodes {
__weak BookmarkHomeViewController* weakSelf = self; __weak BookmarkHomeViewController* weakSelf = self;
coordinator.alertController.view.accessibilityIdentifier = coordinator.alertController.view.accessibilityIdentifier =
@"bookmark_context_menu"; kBookmarkHomeContextMenuIdentifier;
[coordinator addItemWithTitle:l10n_util::GetNSString( [coordinator addItemWithTitle:l10n_util::GetNSString(
IDS_IOS_BOOKMARK_CONTEXT_MENU_MOVE) IDS_IOS_BOOKMARK_CONTEXT_MENU_MOVE)
......
...@@ -21,6 +21,8 @@ extern NSString* const kBookmarkFolderCreateViewContainerIdentifier; ...@@ -21,6 +21,8 @@ extern NSString* const kBookmarkFolderCreateViewContainerIdentifier;
extern NSString* const kBookmarkFolderPickerViewContainerIdentifier; extern NSString* const kBookmarkFolderPickerViewContainerIdentifier;
// Accessibility identifier of the Bookmark Home TableView. // Accessibility identifier of the Bookmark Home TableView.
extern NSString* const kBookmarkHomeTableViewIdentifier; extern NSString* const kBookmarkHomeTableViewIdentifier;
// Accessibility identifier of the Bookmark Home context menu.
extern NSString* const kBookmarkHomeContextMenuIdentifier;
// UINavigationBar accessibility constants: // UINavigationBar accessibility constants:
// Accessibility identifier of the Bookmark navigation bar. // Accessibility identifier of the Bookmark navigation bar.
......
...@@ -21,6 +21,8 @@ NSString* const kBookmarkFolderPickerViewContainerIdentifier = ...@@ -21,6 +21,8 @@ NSString* const kBookmarkFolderPickerViewContainerIdentifier =
NSString* const kBookmarkHomeTableViewIdentifier = NSString* const kBookmarkHomeTableViewIdentifier =
@"kBookmarkHomeTableViewIdentifier"; @"kBookmarkHomeTableViewIdentifier";
NSString* const kBookmarkHomeContextMenuIdentifier =
@"kBookmarkHomeContextMenuIdentifier";
NSString* const kBookmarkNavigationBarIdentifier = NSString* const kBookmarkNavigationBarIdentifier =
@"kBookmarkNavigationBarIdentifier"; @"kBookmarkNavigationBarIdentifier";
......
...@@ -434,8 +434,8 @@ using chrome_test_util::TappableBookmarkNodeWithLabel; ...@@ -434,8 +434,8 @@ using chrome_test_util::TappableBookmarkNodeWithLabel;
performAction:grey_tap()]; performAction:grey_tap()];
// Verify it shows the context menu. // Verify it shows the context menu.
[[EarlGrey [[EarlGrey selectElementWithMatcher:grey_accessibilityID(
selectElementWithMatcher:grey_accessibilityID(@"bookmark_context_menu")] kBookmarkHomeContextMenuIdentifier)]
assertWithMatcher:grey_sufficientlyVisible()]; assertWithMatcher:grey_sufficientlyVisible()];
// Verify options on context menu. // Verify options on context menu.
...@@ -695,8 +695,8 @@ using chrome_test_util::TappableBookmarkNodeWithLabel; ...@@ -695,8 +695,8 @@ using chrome_test_util::TappableBookmarkNodeWithLabel;
performAction:grey_tap()]; performAction:grey_tap()];
// Verify it shows the context menu. // Verify it shows the context menu.
[[EarlGrey [[EarlGrey selectElementWithMatcher:grey_accessibilityID(
selectElementWithMatcher:grey_accessibilityID(@"bookmark_context_menu")] kBookmarkHomeContextMenuIdentifier)]
assertWithMatcher:grey_sufficientlyVisible()]; assertWithMatcher:grey_sufficientlyVisible()];
// Verify options on context menu. // Verify options on context menu.
......
...@@ -371,8 +371,8 @@ using chrome_test_util::TappableBookmarkNodeWithLabel; ...@@ -371,8 +371,8 @@ using chrome_test_util::TappableBookmarkNodeWithLabel;
performAction:grey_longPress()]; performAction:grey_longPress()];
// Verify it shows the context menu. // Verify it shows the context menu.
[[EarlGrey [[EarlGrey selectElementWithMatcher:grey_accessibilityID(
selectElementWithMatcher:grey_accessibilityID(@"bookmark_context_menu")] kBookmarkHomeContextMenuIdentifier)]
assertWithMatcher:grey_sufficientlyVisible()]; assertWithMatcher:grey_sufficientlyVisible()];
// Verify options on context menu. // Verify options on context menu.
...@@ -408,8 +408,8 @@ using chrome_test_util::TappableBookmarkNodeWithLabel; ...@@ -408,8 +408,8 @@ using chrome_test_util::TappableBookmarkNodeWithLabel;
// Verify it doesn't show the context menu. (long press is disabled on // Verify it doesn't show the context menu. (long press is disabled on
// permanent node.) // permanent node.)
[[EarlGrey [[EarlGrey selectElementWithMatcher:grey_accessibilityID(
selectElementWithMatcher:grey_accessibilityID(@"bookmark_context_menu")] kBookmarkHomeContextMenuIdentifier)]
assertWithMatcher:grey_nil()]; assertWithMatcher:grey_nil()];
} }
...@@ -803,8 +803,8 @@ using chrome_test_util::TappableBookmarkNodeWithLabel; ...@@ -803,8 +803,8 @@ using chrome_test_util::TappableBookmarkNodeWithLabel;
performAction:grey_tap()]; performAction:grey_tap()];
// Verify it shows the context menu. // Verify it shows the context menu.
[[EarlGrey [[EarlGrey selectElementWithMatcher:grey_accessibilityID(
selectElementWithMatcher:grey_accessibilityID(@"bookmark_context_menu")] kBookmarkHomeContextMenuIdentifier)]
assertWithMatcher:grey_sufficientlyVisible()]; assertWithMatcher:grey_sufficientlyVisible()];
// Verify options on context menu. // Verify options on context menu.
......
...@@ -78,8 +78,8 @@ void LongPressBookmarkNodeWithLabel(NSString* bookmark_node_label) { ...@@ -78,8 +78,8 @@ void LongPressBookmarkNodeWithLabel(NSString* bookmark_node_label) {
} }
void VerifyBookmarkContextMenuNil() { void VerifyBookmarkContextMenuNil() {
[[EarlGrey [[EarlGrey selectElementWithMatcher:grey_accessibilityID(
selectElementWithMatcher:grey_accessibilityID(@"bookmark_context_menu")] kBookmarkHomeContextMenuIdentifier)]
assertWithMatcher:grey_nil()]; assertWithMatcher:grey_nil()];
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment