OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/web_state/ui/crw_web_controller.h" | 5 #import "ios/web/web_state/ui/crw_web_controller.h" |
6 | 6 |
7 #import <WebKit/WebKit.h> | 7 #import <WebKit/WebKit.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 309 |
310 // The value for web view OCMock objects to expect for |-setFrame:|. | 310 // The value for web view OCMock objects to expect for |-setFrame:|. |
311 CGRect ExpectedWebViewFrame() const { | 311 CGRect ExpectedWebViewFrame() const { |
312 CGSize containerViewSize = [UIScreen mainScreen].bounds.size; | 312 CGSize containerViewSize = [UIScreen mainScreen].bounds.size; |
313 containerViewSize.height -= | 313 containerViewSize.height -= |
314 CGRectGetHeight([UIApplication sharedApplication].statusBarFrame); | 314 CGRectGetHeight([UIApplication sharedApplication].statusBarFrame); |
315 return {CGPointZero, containerViewSize}; | 315 return {CGPointZero, containerViewSize}; |
316 } | 316 } |
317 | 317 |
318 // Creates WebView mock. | 318 // Creates WebView mock. |
319 UIView* CreateMockWebView() { | 319 UIView* CreateMockWebView() NS_RETURNS_RETAINED { |
320 id result = [[OCMockObject mockForClass:[WKWebView class]] retain]; | 320 id result = [[OCMockObject mockForClass:[WKWebView class]] retain]; |
321 | 321 |
322 if (base::ios::IsRunningOnIOS10OrLater()) { | 322 if (base::ios::IsRunningOnIOS10OrLater()) { |
323 [[result stub] serverTrust]; | 323 [[result stub] serverTrust]; |
324 } else { | 324 } else { |
325 [[result stub] certificateChain]; | 325 [[result stub] certificateChain]; |
326 } | 326 } |
327 | 327 |
328 [[result stub] backForwardList]; | 328 [[result stub] backForwardList]; |
329 [[[result stub] andReturn:[NSURL URLWithString:kTestURLString]] URL]; | 329 [[[result stub] andReturn:[NSURL URLWithString:kTestURLString]] URL]; |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 | 1005 |
1006 [web_controller() setDelegate:delegate]; | 1006 [web_controller() setDelegate:delegate]; |
1007 web::SimulateWKWebViewCrash(webView_); | 1007 web::SimulateWKWebViewCrash(webView_); |
1008 | 1008 |
1009 EXPECT_OCMOCK_VERIFY(delegate); | 1009 EXPECT_OCMOCK_VERIFY(delegate); |
1010 EXPECT_FALSE([web_controller() isViewAlive]); | 1010 EXPECT_FALSE([web_controller() isViewAlive]); |
1011 [web_controller() setDelegate:nil]; | 1011 [web_controller() setDelegate:nil]; |
1012 }; | 1012 }; |
1013 | 1013 |
1014 } // namespace | 1014 } // namespace |
OLD | NEW |