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

Side by Side Diff: ios/testing/earl_grey/matchers.mm

Issue 2275303004: Context menu egtests, plus related utilities. (Closed)
Patch Set: Fewer References. Created 4 years, 3 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 | « ios/testing/earl_grey/matchers.h ('k') | ios/web/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #import "ios/testing/earl_grey/matchers.h"
6
7 namespace testing {
8
9 id<GREYMatcher> contextMenuItemWithText(NSString* text) {
10 // Both tablet and phone house context menu views inside an alert controller
11 // view (on tablet that view is itself inside a popover view).
12 id<GREYMatcher> context_menu_container =
13 grey_kindOfClass(NSClassFromString(@"_UIAlertControllerView"));
14
15 return grey_allOf(grey_ancestor(context_menu_container), grey_interactable(),
16 grey_text(text), nil);
17 }
18
19 id<GREYMatcher> elementToDismissContextMenu(NSString* cancel_text) {
20 UIUserInterfaceIdiom idiom = [[UIDevice currentDevice] userInterfaceIdiom];
21 if (idiom == UIUserInterfaceIdiomPad) {
22 // On iPad the context menu is dismissed by tapping on something
23 // that isn't the popover. UIKit conveniently labels this element.
24 return grey_accessibilityID(@"PopoverDismissRegion");
25 } else {
26 // On iPhone the context menu is dismissed by tapping on the "Cancel" item.
27 return contextMenuItemWithText(cancel_text);
28 }
29 }
30
31 } // namespace testing
OLDNEW
« no previous file with comments | « ios/testing/earl_grey/matchers.h ('k') | ios/web/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698