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

Side by Side Diff: ios/web/shell/test/earl_grey/shell_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/web/shell/test/earl_grey/shell_matchers.h ('k') | ios/web/shell/test/meta_tags_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 #import "ios/web/shell/test/earl_grey/shell_matchers.h" 5 #import "ios/web/shell/test/earl_grey/shell_matchers.h"
6 6
7 #import "base/mac/foundation_util.h" 7 #import "base/mac/foundation_util.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #import "ios/testing/earl_grey/matchers.h" 9 #import "ios/testing/earl_grey/matchers.h"
10 #import "ios/testing/wait_util.h" 10 #import "ios/testing/wait_util.h"
11 #import "ios/web/public/web_state/web_state.h" 11 #import "ios/web/public/web_state/web_state.h"
12 #import "ios/web/public/test/earl_grey/web_view_matchers.h" 12 #import "ios/web/public/test/earl_grey/web_view_matchers.h"
13 #import "ios/web/shell/test/app/web_shell_test_util.h" 13 #import "ios/web/shell/test/app/web_shell_test_util.h"
14 #import "ios/web/shell/view_controller.h" 14 #import "ios/web/shell/view_controller.h"
15 15
16 #if !defined(__has_feature) || !__has_feature(objc_arc) 16 #if !defined(__has_feature) || !__has_feature(objc_arc)
17 #error "This file requires ARC support." 17 #error "This file requires ARC support."
18 #endif 18 #endif
19 19
20 namespace web { 20 namespace web {
21 21
22 id<GREYMatcher> webViewContainingText(const std::string& text) { 22 id<GREYMatcher> WebViewContainingText(const std::string& text) {
23 WebState* web_state = shell_test_util::GetCurrentWebState(); 23 WebState* web_state = shell_test_util::GetCurrentWebState();
24 return webViewContainingText(std::move(text), web_state); 24 return WebViewContainingText(std::move(text), web_state);
25 } 25 }
26 26
27 id<GREYMatcher> webViewCssSelector(const std::string& selector) { 27 id<GREYMatcher> WebViewCssSelector(const std::string& selector) {
28 WebState* web_state = shell_test_util::GetCurrentWebState(); 28 WebState* web_state = shell_test_util::GetCurrentWebState();
29 return webViewCssSelector(std::move(selector), web_state); 29 return WebViewCssSelector(std::move(selector), web_state);
30 } 30 }
31 31
32 id<GREYMatcher> webView() { 32 id<GREYMatcher> WebView() {
33 return webViewInWebState(shell_test_util::GetCurrentWebState()); 33 return WebViewInWebState(shell_test_util::GetCurrentWebState());
34 } 34 }
35 35
36 id<GREYMatcher> webViewScrollView() { 36 id<GREYMatcher> WebViewScrollView() {
37 return webViewScrollView(shell_test_util::GetCurrentWebState()); 37 return WebViewScrollView(shell_test_util::GetCurrentWebState());
38 } 38 }
39 39
40 id<GREYMatcher> addressFieldText(std::string text) { 40 id<GREYMatcher> AddressFieldText(std::string text) {
41 MatchesBlock matches = ^BOOL(UIView* view) { 41 MatchesBlock matches = ^BOOL(UIView* view) {
42 if (![view isKindOfClass:[UITextField class]]) { 42 if (![view isKindOfClass:[UITextField class]]) {
43 return NO; 43 return NO;
44 } 44 }
45 if (![[view accessibilityLabel] 45 if (![[view accessibilityLabel]
46 isEqualToString:kWebShellAddressFieldAccessibilityLabel]) { 46 isEqualToString:kWebShellAddressFieldAccessibilityLabel]) {
47 return NO; 47 return NO;
48 } 48 }
49 UITextField* text_field = base::mac::ObjCCastStrict<UITextField>(view); 49 UITextField* text_field = base::mac::ObjCCastStrict<UITextField>(view);
50 NSString* error_message = [NSString 50 NSString* error_message = [NSString
(...skipping 11 matching lines...) Expand all
62 62
63 DescribeToBlock describe = ^(id<GREYDescription> description) { 63 DescribeToBlock describe = ^(id<GREYDescription> description) {
64 [description appendText:@"address field containing "]; 64 [description appendText:@"address field containing "];
65 [description appendText:base::SysUTF8ToNSString(text)]; 65 [description appendText:base::SysUTF8ToNSString(text)];
66 }; 66 };
67 67
68 return [[GREYElementMatcherBlock alloc] initWithMatchesBlock:matches 68 return [[GREYElementMatcherBlock alloc] initWithMatchesBlock:matches
69 descriptionBlock:describe]; 69 descriptionBlock:describe];
70 } 70 }
71 71
72 id<GREYMatcher> backButton() { 72 id<GREYMatcher> BackButton() {
73 return grey_accessibilityLabel(kWebShellBackButtonAccessibilityLabel); 73 return grey_accessibilityLabel(kWebShellBackButtonAccessibilityLabel);
74 } 74 }
75 75
76 id<GREYMatcher> forwardButton() { 76 id<GREYMatcher> ForwardButton() {
77 return grey_accessibilityLabel(kWebShellForwardButtonAccessibilityLabel); 77 return grey_accessibilityLabel(kWebShellForwardButtonAccessibilityLabel);
78 } 78 }
79 79
80 id<GREYMatcher> addressField() { 80 id<GREYMatcher> AddressField() {
81 return grey_accessibilityLabel(kWebShellAddressFieldAccessibilityLabel); 81 return grey_accessibilityLabel(kWebShellAddressFieldAccessibilityLabel);
82 } 82 }
83 83
84 } // namespace web 84 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/shell/test/earl_grey/shell_matchers.h ('k') | ios/web/shell/test/meta_tags_egtest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698