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

Unified Diff: ios/web/public/test/earl_grey/web_view_matchers.mm

Issue 2183583002: [ios] EarlGrey test for PDF Mime type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@css_selector_matcher
Patch Set: Added missing GN dependency 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/public/test/earl_grey/web_view_matchers.h ('k') | ios/web/shell/test/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/public/test/earl_grey/web_view_matchers.mm
diff --git a/ios/web/public/test/earl_grey/web_view_matchers.mm b/ios/web/public/test/earl_grey/web_view_matchers.mm
index 14d09003e885e53fa92adc3844824b2b810536da..a31a36f050a3eb02152486c466a37555db7762a9 100644
--- a/ios/web/public/test/earl_grey/web_view_matchers.mm
+++ b/ios/web/public/test/earl_grey/web_view_matchers.mm
@@ -24,22 +24,6 @@ char kGetDocumentBodyJavaScript[] =
// Script that tests presence of css selector.
char kTestCssSelectorJavaScriptTemplate[] = "!!document.querySelector(\"%s\");";
-// Matcher for WKWebView which belogs to the given |webState|.
-id<GREYMatcher> webViewInWebState(web::WebState* web_state) {
- MatchesBlock matches = ^BOOL(UIView* view) {
- return [view isKindOfClass:[WKWebView class]] &&
- [view isDescendantOfView:web_state->GetView()];
- };
-
- DescribeToBlock describe = ^(id<GREYDescription> description) {
- [description appendText:@"web view in web state"];
- };
-
- return [[[GREYElementMatcherBlock alloc] initWithMatchesBlock:matches
- descriptionBlock:describe]
- autorelease];
-}
-
// Synchronously returns the result of executed JavaScript.
std::unique_ptr<base::Value> ExecuteScript(web::WebState* web_state,
const std::string& script) {
@@ -72,6 +56,10 @@ std::unique_ptr<base::Value> ExecuteScript(web::WebState* web_state,
namespace web {
+id<GREYMatcher> webViewInWebState(web::WebState* webState) {
+ return [GREYMatchers matcherForWebViewInWebState:webState];
+}
+
id<GREYMatcher> webViewContainingText(const std::string& text,
web::WebState* webState) {
return
@@ -92,6 +80,21 @@ id<GREYMatcher> webViewScrollView(web::WebState* webState) {
@implementation GREYMatchers (WebViewAdditions)
++ (id<GREYMatcher>)matcherForWebViewInWebState:(web::WebState*)webState {
+ MatchesBlock matches = ^BOOL(UIView* view) {
+ return [view isKindOfClass:[WKWebView class]] &&
+ [view isDescendantOfView:webState->GetView()];
+ };
+
+ DescribeToBlock describe = ^(id<GREYDescription> description) {
+ [description appendText:@"web view in web state"];
+ };
+
+ return [[[GREYElementMatcherBlock alloc] initWithMatchesBlock:matches
+ descriptionBlock:describe]
+ autorelease];
+}
+
+ (id<GREYMatcher>)matcherForWebViewContainingText:(const std::string&)text
inWebState:(web::WebState*)webState {
std::string textCopyForBlock = text;
« no previous file with comments | « ios/web/public/test/earl_grey/web_view_matchers.h ('k') | ios/web/shell/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698