| 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;
|
|
|