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

Unified Diff: ios/web/shell/test/earl_grey/shell_matchers.mm

Issue 2192593002: [ios] Cleaned up web EG matchers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pdf_eg_test
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web/shell/test/earl_grey/shell_matchers.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/shell/test/earl_grey/shell_matchers.mm
diff --git a/ios/web/shell/test/earl_grey/shell_matchers.mm b/ios/web/shell/test/earl_grey/shell_matchers.mm
index 055417cc4cfdd2b6e8c4d5e74c0fa1281aff7ebe..88e6e1222014c38f82c679367efa5746970ca771 100644
--- a/ios/web/shell/test/earl_grey/shell_matchers.mm
+++ b/ios/web/shell/test/earl_grey/shell_matchers.mm
@@ -6,7 +6,6 @@
#import "base/mac/foundation_util.h"
#include "base/strings/sys_string_conversions.h"
-#include "base/test/ios/wait_util.h"
#include "ios/testing/earl_grey/wait_util.h"
#import "ios/web/public/web_state/web_state.h"
#import "ios/web/public/test/earl_grey/web_view_matchers.h"
@@ -15,53 +14,21 @@
namespace web {
-id<GREYMatcher> webViewContainingText(const std::string& text) {
- return [GREYMatchers matcherForWebViewContainingText:text];
+id<GREYMatcher> webViewContainingText(std::string text) {
+ WebState* web_state = shell_test_util::GetCurrentWebState();
+ return webViewContainingText(std::move(text), web_state);
}
-id<GREYMatcher> webViewCssSelector(const std::string& selector) {
- return [GREYMatchers matcherForWebWithCSSSelector:selector];
+id<GREYMatcher> webViewCssSelector(std::string selector) {
+ WebState* web_state = shell_test_util::GetCurrentWebState();
+ return webViewCssSelector(std::move(selector), web_state);
}
id<GREYMatcher> webViewScrollView() {
- return [GREYMatchers matcherForWebViewScrollView];
+ return webViewScrollView(shell_test_util::GetCurrentWebState());
}
-id<GREYMatcher> addressFieldText(const std::string& text) {
- return [GREYMatchers matcherForAddressFieldEqualToText:text];
-}
-
-id<GREYMatcher> backButton() {
- return [GREYMatchers matcherForWebShellBackButton];
-}
-
-id<GREYMatcher> forwardButton() {
- return [GREYMatchers matcherForWebShellForwardButton];
-}
-
-id<GREYMatcher> addressField() {
- return [GREYMatchers matcherForWebShellAddressField];
-}
-
-} // namespace web
-
-@implementation GREYMatchers (WebShellAdditions)
-
-+ (id<GREYMatcher>)matcherForWebViewContainingText:(const std::string&)text {
- web::WebState* webState = web::shell_test_util::GetCurrentWebState();
- return web::webViewContainingText(text, webState);
-}
-
-+ (id<GREYMatcher>)matcherForWebWithCSSSelector:(const std::string&)selector {
- web::WebState* webState = web::shell_test_util::GetCurrentWebState();
- return web::webViewCssSelector(selector, webState);
-}
-
-+ (id<GREYMatcher>)matcherForWebViewScrollView {
- return web::webViewScrollView(web::shell_test_util::GetCurrentWebState());
-}
-
-+ (id<GREYMatcher>)matcherForAddressFieldEqualToText:(const std::string&)text {
+id<GREYMatcher> addressFieldText(std::string text) {
MatchesBlock matches = ^BOOL(UIView* view) {
if (![view isKindOfClass:[UITextField class]]) {
return NO;
@@ -70,9 +37,9 @@ id<GREYMatcher> addressField() {
isEqualToString:kWebShellAddressFieldAccessibilityLabel]) {
return NO;
}
- UITextField* textField = base::mac::ObjCCastStrict<UITextField>(view);
+ UITextField* text_field = base::mac::ObjCCastStrict<UITextField>(view);
testing::WaitUntilCondition(testing::kWaitForUIElementTimeout, ^bool() {
- return [textField.text isEqualToString:base::SysUTF8ToNSString(text)];
+ return [text_field.text isEqualToString:base::SysUTF8ToNSString(text)];
});
return YES;
};
@@ -87,16 +54,16 @@ id<GREYMatcher> addressField() {
autorelease];
}
-+ (id<GREYMatcher>)matcherForWebShellBackButton {
+id<GREYMatcher> backButton() {
return grey_accessibilityLabel(kWebShellBackButtonAccessibilityLabel);
}
-+ (id<GREYMatcher>)matcherForWebShellForwardButton {
+id<GREYMatcher> forwardButton() {
return grey_accessibilityLabel(kWebShellForwardButtonAccessibilityLabel);
}
-+ (id<GREYMatcher>)matcherForWebShellAddressField {
+id<GREYMatcher> addressField() {
return grey_accessibilityLabel(kWebShellAddressFieldAccessibilityLabel);
}
-@end
+} // namespace web
« no previous file with comments | « ios/web/shell/test/earl_grey/shell_matchers.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698