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

Side by Side Diff: ios/web/public/test/earl_grey/web_view_matchers.mm

Issue 2008183004: Remove Earl Grey matcher APIs taking NSString. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
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/public/test/earl_grey/web_view_matchers.h" 5 #import "ios/web/public/test/earl_grey/web_view_matchers.h"
6 6
7 #import <WebKit/WebKit.h> 7 #import <WebKit/WebKit.h>
8 8
9 #include "base/mac/bind_objc_block.h" 9 #include "base/mac/bind_objc_block.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "base/test/ios/wait_util.h" 12 #include "base/test/ios/wait_util.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "ios/testing/earl_grey/wait_util.h" 14 #include "ios/testing/earl_grey/wait_util.h"
15 15
16 namespace { 16 namespace {
17 17
18 // Script that returns document.body as a string. 18 // Script that returns document.body as a string.
19 char kGetDocumentBodyJavaScript[] = 19 char kGetDocumentBodyJavaScript[] =
20 "document.body ? document.body.textContent : null"; 20 "document.body ? document.body.textContent : null";
21 } 21 }
22 22
23 namespace web { 23 namespace web {
24 24
25 id<GREYMatcher> webViewContainingText(NSString* text, web::WebState* webState) {
26 return [GREYMatchers
27 matcherForWebViewContainingText:base::SysNSStringToUTF8(text)
28 inWebState:webState];
29 }
30
31 id<GREYMatcher> webViewContainingText(const std::string& text, 25 id<GREYMatcher> webViewContainingText(const std::string& text,
32 web::WebState* webState) { 26 web::WebState* webState) {
33 return 27 return
34 [GREYMatchers matcherForWebViewContainingText:text inWebState:webState]; 28 [GREYMatchers matcherForWebViewContainingText:text inWebState:webState];
35 } 29 }
36 30
37 } // namespace web 31 } // namespace web
38 32
39 @implementation GREYMatchers (WebViewAdditions) 33 @implementation GREYMatchers (WebViewAdditions)
40 34
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 [description appendText:@"web view containing "]; 66 [description appendText:@"web view containing "];
73 [description appendText:base::SysUTF8ToNSString(text)]; 67 [description appendText:base::SysUTF8ToNSString(text)];
74 }; 68 };
75 69
76 return [[[GREYElementMatcherBlock alloc] initWithMatchesBlock:matches 70 return [[[GREYElementMatcherBlock alloc] initWithMatchesBlock:matches
77 descriptionBlock:describe] 71 descriptionBlock:describe]
78 autorelease]; 72 autorelease];
79 } 73 }
80 74
81 @end 75 @end
OLDNEW
« no previous file with comments | « ios/web/public/test/earl_grey/web_view_matchers.h ('k') | ios/web/shell/test/earl_grey/shell_matchers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698