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

Unified Diff: ios/web/web_state/ui/crw_web_controller_unittest.mm

Issue 1682873002: Set CRWWebViewContentView's size before resetting scroll proxy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests Created 4 years, 10 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
Index: ios/web/web_state/ui/crw_web_controller_unittest.mm
diff --git a/ios/web/web_state/ui/crw_web_controller_unittest.mm b/ios/web/web_state/ui/crw_web_controller_unittest.mm
index ab1d48b7fc201fa8394b516c9a7df9ab36ca1e3f..1bacb81bfa8c43fc8b30ae5d73835ad8793f2323 100644
--- a/ios/web/web_state/ui/crw_web_controller_unittest.mm
+++ b/ios/web/web_state/ui/crw_web_controller_unittest.mm
@@ -335,6 +335,14 @@ class WebControllerTest : public WebTestT {
WebTestT::TearDown();
}
+ // The value for web view OCMock objects to expect for |-setFrame:|.
+ CGRect ExpectedWebViewFrame() const {
+ CGSize containerViewSize = [UIScreen mainScreen].bounds.size;
+ containerViewSize.height -=
+ CGRectGetHeight([UIApplication sharedApplication].statusBarFrame);
+ return {CGPointZero, containerViewSize};
+ }
+
// Creates WebView mock.
virtual UIView* CreateMockWebView() const = 0;
@@ -354,6 +362,7 @@ class CRWUIWebViewWebControllerTest
id result = [[OCMockObject mockForClass:[UIWebView class]] retain];
[[[result stub] andReturn:nil] request];
[[result stub] setDelegate:OCMOCK_ANY]; // Called by resetInjectedWebView
+ [[result stub] setFrame:ExpectedWebViewFrame()];
// Stub out the injection process.
[[[result stub] andReturn:@"object"]
stringByEvaluatingJavaScriptFromString:
@@ -388,6 +397,7 @@ class CRWWKWebViewWebControllerTest
[[[result stub] andReturn:[NSURL URLWithString:kTestURLString]] URL];
[[result stub] setNavigationDelegate:OCMOCK_ANY];
[[result stub] setUIDelegate:OCMOCK_ANY];
+ [[result stub] setFrame:ExpectedWebViewFrame()];
[[result stub] addObserver:webController_
forKeyPath:OCMOCK_ANY
options:0
« no previous file with comments | « ios/web/web_state/ui/crw_web_controller_container_view.mm ('k') | ios/web/web_state/ui/crw_web_view_content_view.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698