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

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

Issue 2183863002: Use a copy of string in EG web_view_matchers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@alertCoordinator2
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 | « no previous file | no next file » | 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 4fd7d231145c1e203efbef3db359b67b9aa4885c..d60fc6b2c1bc8b4fd69e07adf7084d2d329b7251 100644
--- a/ios/web/public/test/earl_grey/web_view_matchers.mm
+++ b/ios/web/public/test/earl_grey/web_view_matchers.mm
@@ -38,6 +38,7 @@ id<GREYMatcher> webViewScrollView(web::WebState* webState) {
+ (id<GREYMatcher>)matcherForWebViewContainingText:(const std::string&)text
inWebState:(web::WebState*)webState {
+ std::string textCopyForBlock = text;
MatchesBlock matches = ^BOOL(UIView* view) {
if (![view isKindOfClass:[WKWebView class]]) {
return NO;
@@ -57,7 +58,7 @@ id<GREYMatcher> webViewScrollView(web::WebState* webState) {
std::string response;
if (value && value->IsType(base::Value::TYPE_STRING) &&
value->GetAsString(&response)) {
- didSucceed = response.find(text) != std::string::npos;
+ didSucceed = response.find(textCopyForBlock) != std::string::npos;
}
}));
base::test::ios::SpinRunLoopWithMaxDelay(
@@ -68,7 +69,7 @@ id<GREYMatcher> webViewScrollView(web::WebState* webState) {
DescribeToBlock describe = ^(id<GREYDescription> description) {
[description appendText:@"web view containing "];
- [description appendText:base::SysUTF8ToNSString(text)];
+ [description appendText:base::SysUTF8ToNSString(textCopyForBlock)];
};
return [[[GREYElementMatcherBlock alloc] initWithMatchesBlock:matches
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698