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

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

Issue 2586203004: [ios] Removed deprecated webViewContainingBlockedImage. (Closed)
Patch Set: Removed unnecessary changes Created 4 years 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
« no previous file with comments | « ios/web/public/test/earl_grey/web_view_matchers.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <UIKit/UIKit.h> 7 #import <UIKit/UIKit.h>
8 #import <WebKit/WebKit.h> 8 #import <WebKit/WebKit.h>
9 9
10 #include "base/mac/bind_objc_block.h" 10 #include "base/mac/bind_objc_block.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 std::unique_ptr<base::Value> url_as_value = 149 std::unique_ptr<base::Value> url_as_value =
150 test::ExecuteJavaScript(web_state, get_url_script); 150 test::ExecuteJavaScript(web_state, get_url_script);
151 std::string url_as_string; 151 std::string url_as_string;
152 if (!url_as_value->GetAsString(&url_as_string)) 152 if (!url_as_value->GetAsString(&url_as_string))
153 return grey_nil(); 153 return grey_nil();
154 154
155 UIImage* image = LoadImage(GURL(url_as_string)); 155 UIImage* image = LoadImage(GURL(url_as_string));
156 if (!image) 156 if (!image)
157 return grey_nil(); 157 return grey_nil();
158 158
159 return webViewContainingBlockedImage(image_id, image.size, web_state); 159 CGSize expected_size = image.size;
160 }
161 160
162 id<GREYMatcher> webViewContainingBlockedImage(std::string image_id,
163 CGSize expected_size,
164 WebState* web_state) {
165 MatchesBlock matches = ^BOOL(WKWebView*) { 161 MatchesBlock matches = ^BOOL(WKWebView*) {
166 return WaitUntilConditionOrTimeout(testing::kWaitForUIElementTimeout, ^{ 162 return WaitUntilConditionOrTimeout(testing::kWaitForUIElementTimeout, ^{
167 NSString* const kGetElementAttributesScript = [NSString 163 NSString* const kGetElementAttributesScript = [NSString
168 stringWithFormat:@"var image = document.getElementById('%@');" 164 stringWithFormat:@"var image = document.getElementById('%@');"
169 @"var imageHeight = image.height;" 165 @"var imageHeight = image.height;"
170 @"var imageWidth = image.width;" 166 @"var imageWidth = image.width;"
171 @"JSON.stringify({" 167 @"JSON.stringify({"
172 @" height:imageHeight," 168 @" height:imageHeight,"
173 @" width:imageWidth" 169 @" width:imageWidth"
174 @"});", 170 @"});",
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 }; 278 };
283 279
284 return grey_allOf(interstitial(web_state), 280 return grey_allOf(interstitial(web_state),
285 [[[GREYElementMatcherBlock alloc] 281 [[[GREYElementMatcherBlock alloc]
286 initWithMatchesBlock:matches 282 initWithMatchesBlock:matches
287 descriptionBlock:describe] autorelease], 283 descriptionBlock:describe] autorelease],
288 nil); 284 nil);
289 } 285 }
290 286
291 } // namespace web 287 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/public/test/earl_grey/web_view_matchers.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698