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

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

Issue 2642193012: Make EarlGrey matchers compliant with Chromium style. (Closed)
Patch Set: build.gn and rebase Created 3 years, 11 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/public/test/earl_grey/web_view_actions.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 #import "ios/testing/earl_grey/matchers.h" 5 #import "ios/testing/earl_grey/matchers.h"
6 6
7 #if !defined(__has_feature) || !__has_feature(objc_arc) 7 #if !defined(__has_feature) || !__has_feature(objc_arc)
8 #error "This file requires ARC support." 8 #error "This file requires ARC support."
9 #endif 9 #endif
10 10
11 namespace testing { 11 namespace testing {
12 12
13 id<GREYMatcher> contextMenuItemWithText(NSString* text) { 13 id<GREYMatcher> ContextMenuItemWithText(NSString* text) {
14 // Both tablet and phone house context menu views inside an alert controller 14 // Both tablet and phone house context menu views inside an alert controller
15 // view (on tablet that view is itself inside a popover view). 15 // view (on tablet that view is itself inside a popover view).
16 id<GREYMatcher> context_menu_container = 16 id<GREYMatcher> context_menu_container =
17 grey_kindOfClass(NSClassFromString(@"_UIAlertControllerView")); 17 grey_kindOfClass(NSClassFromString(@"_UIAlertControllerView"));
18 18
19 return grey_allOf(grey_ancestor(context_menu_container), grey_interactable(), 19 return grey_allOf(grey_ancestor(context_menu_container), grey_interactable(),
20 grey_text(text), nil); 20 grey_text(text), nil);
21 } 21 }
22 22
23 id<GREYMatcher> elementToDismissContextMenu(NSString* cancel_text) { 23 id<GREYMatcher> ElementToDismissContextMenu(NSString* cancel_text) {
24 UIUserInterfaceIdiom idiom = [[UIDevice currentDevice] userInterfaceIdiom]; 24 UIUserInterfaceIdiom idiom = [[UIDevice currentDevice] userInterfaceIdiom];
25 if (idiom == UIUserInterfaceIdiomPad) { 25 if (idiom == UIUserInterfaceIdiomPad) {
26 // On iPad the context menu is dismissed by tapping on something 26 // On iPad the context menu is dismissed by tapping on something
27 // that isn't the popover. UIKit conveniently labels this element. 27 // that isn't the popover. UIKit conveniently labels this element.
28 return grey_accessibilityID(@"PopoverDismissRegion"); 28 return grey_accessibilityID(@"PopoverDismissRegion");
29 } else { 29 } else {
30 // On iPhone the context menu is dismissed by tapping on the "Cancel" item. 30 // On iPhone the context menu is dismissed by tapping on the "Cancel" item.
31 return contextMenuItemWithText(cancel_text); 31 return ContextMenuItemWithText(cancel_text);
32 } 32 }
33 } 33 }
34 34
35 } // namespace testing 35 } // namespace testing
OLDNEW
« no previous file with comments | « ios/testing/earl_grey/matchers.h ('k') | ios/web/public/test/earl_grey/web_view_actions.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698