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

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

Issue 2005023003: Change iOS web matcher argument types to std::string. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: const & Created 4 years, 7 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/earl_grey/shell_matchers.h » ('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 d78daa208a2f36d7fdde2931315f1ea3b538b89c..f020141347772863f552ab479dd1c5f469de776e 100644
--- a/ios/web/public/test/earl_grey/web_view_matchers.mm
+++ b/ios/web/public/test/earl_grey/web_view_matchers.mm
@@ -23,6 +23,13 @@ char kGetDocumentBodyJavaScript[] =
namespace web {
id<GREYMatcher> webViewContainingText(NSString* text, web::WebState* webState) {
+ return [GREYMatchers
+ matcherForWebViewContainingText:base::SysNSStringToUTF8(text)
+ inWebState:webState];
+}
+
+id<GREYMatcher> webViewContainingText(const std::string& text,
+ web::WebState* webState) {
return
[GREYMatchers matcherForWebViewContainingText:text inWebState:webState];
}
@@ -31,7 +38,7 @@ id<GREYMatcher> webViewContainingText(NSString* text, web::WebState* webState) {
@implementation GREYMatchers (WebViewAdditions)
-+ (id<GREYMatcher>)matcherForWebViewContainingText:(NSString*)text
++ (id<GREYMatcher>)matcherForWebViewContainingText:(const std::string&)text
inWebState:(web::WebState*)webState {
MatchesBlock matches = ^BOOL(UIView* view) {
if (![view isKindOfClass:[WKWebView class]]) {
@@ -52,8 +59,7 @@ id<GREYMatcher> webViewContainingText(NSString* text, web::WebState* webState) {
std::string response;
if (value && value->IsType(base::Value::TYPE_STRING) &&
value->GetAsString(&response)) {
- didSucceed = response.find(base::SysNSStringToUTF8(text)) !=
- std::string::npos;
+ didSucceed = response.find(text) != std::string::npos;
}
}));
base::test::ios::SpinRunLoopWithMaxDelay(
@@ -63,8 +69,8 @@ id<GREYMatcher> webViewContainingText(NSString* text, web::WebState* webState) {
};
DescribeToBlock describe = ^(id<GREYDescription> description) {
- [description
- appendText:[NSString stringWithFormat:@"web view containing %@", text]];
+ [description appendText:@"web view containing "];
+ [description appendText:base::SysUTF8ToNSString(text)];
};
return [[[GREYElementMatcherBlock alloc] initWithMatchesBlock:matches
« 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