OLD | NEW |
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/chrome/test/earl_grey/chrome_matchers.h" | 5 #import "ios/chrome/test/earl_grey/chrome_matchers.h" |
6 | 6 |
7 #import <OCHamcrest/OCHamcrest.h> | 7 #import <OCHamcrest/OCHamcrest.h> |
8 | 8 |
9 #import <WebKit/WebKit.h> | 9 #import <WebKit/WebKit.h> |
10 | 10 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 215 |
216 id<GREYMatcher> ContentSettingsButton() { | 216 id<GREYMatcher> ContentSettingsButton() { |
217 return ButtonWithAccessibilityLabelId(IDS_IOS_CONTENT_SETTINGS_TITLE); | 217 return ButtonWithAccessibilityLabelId(IDS_IOS_CONTENT_SETTINGS_TITLE); |
218 } | 218 } |
219 | 219 |
220 id<GREYMatcher> SettingsMenuBackButton() { | 220 id<GREYMatcher> SettingsMenuBackButton() { |
221 return grey_allOf(grey_accessibilityID(@"ic_arrow_back"), | 221 return grey_allOf(grey_accessibilityID(@"ic_arrow_back"), |
222 grey_accessibilityTrait(UIAccessibilityTraitButton), nil); | 222 grey_accessibilityTrait(UIAccessibilityTraitButton), nil); |
223 } | 223 } |
224 | 224 |
| 225 id<GREYMatcher> ContainsText(NSString* text) { |
| 226 MatchesBlock matches = ^BOOL(id element) { |
| 227 return [[element text] containsString:text]; |
| 228 }; |
| 229 DescribeToBlock describe = ^void(id<GREYDescription> description) { |
| 230 [description appendText:[NSString stringWithFormat:@"hasText('%@')", text]]; |
| 231 }; |
| 232 id<GREYMatcher> matcher = |
| 233 [[GREYElementMatcherBlock alloc] initWithMatchesBlock:matches |
| 234 descriptionBlock:describe]; |
| 235 return grey_allOf(grey_anyOf(grey_kindOfClass([UILabel class]), |
| 236 grey_kindOfClass([UITextField class]), |
| 237 grey_kindOfClass([UITextView class]), nil), |
| 238 matcher, nil); |
| 239 } |
| 240 |
225 } // namespace chrome_test_util | 241 } // namespace chrome_test_util |
OLD | NEW |