| 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 CGSize containerViewSize = [UIScreen mainScreen].bounds.size; | 313 CGSize containerViewSize = [UIScreen mainScreen].bounds.size; |
| 314 containerViewSize.height -= | 314 containerViewSize.height -= |
| 315 CGRectGetHeight([UIApplication sharedApplication].statusBarFrame); | 315 CGRectGetHeight([UIApplication sharedApplication].statusBarFrame); |
| 316 return {CGPointZero, containerViewSize}; | 316 return {CGPointZero, containerViewSize}; |
| 317 } | 317 } |
| 318 | 318 |
| 319 // Creates WebView mock. | 319 // Creates WebView mock. |
| 320 UIView* CreateMockWebView() { | 320 UIView* CreateMockWebView() { |
| 321 id result = [[OCMockObject mockForClass:[WKWebView class]] retain]; | 321 id result = [[OCMockObject mockForClass:[WKWebView class]] retain]; |
| 322 | 322 |
| 323 // Called by resetInjectedWebView | 323 if (base::ios::IsRunningOnIOS10OrLater()) { |
| 324 [[result stub] certificateChain]; | 324 [[result stub] serverTrust]; |
| 325 } else { |
| 326 [[result stub] certificateChain]; |
| 327 } |
| 328 |
| 325 [[result stub] backForwardList]; | 329 [[result stub] backForwardList]; |
| 326 [[[result stub] andReturn:[NSURL URLWithString:kTestURLString]] URL]; | 330 [[[result stub] andReturn:[NSURL URLWithString:kTestURLString]] URL]; |
| 327 [[result stub] setNavigationDelegate:OCMOCK_ANY]; | 331 [[result stub] setNavigationDelegate:OCMOCK_ANY]; |
| 328 [[result stub] setUIDelegate:OCMOCK_ANY]; | 332 [[result stub] setUIDelegate:OCMOCK_ANY]; |
| 329 [[result stub] setFrame:ExpectedWebViewFrame()]; | 333 [[result stub] setFrame:ExpectedWebViewFrame()]; |
| 330 [[result stub] addObserver:web_controller() | 334 [[result stub] addObserver:web_controller() |
| 331 forKeyPath:OCMOCK_ANY | 335 forKeyPath:OCMOCK_ANY |
| 332 options:0 | 336 options:0 |
| 333 context:nullptr]; | 337 context:nullptr]; |
| 334 [[result stub] addObserver:OCMOCK_ANY | 338 [[result stub] addObserver:OCMOCK_ANY |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 | 1006 |
| 1003 [web_controller() setDelegate:delegate]; | 1007 [web_controller() setDelegate:delegate]; |
| 1004 web::SimulateWKWebViewCrash(webView_); | 1008 web::SimulateWKWebViewCrash(webView_); |
| 1005 | 1009 |
| 1006 EXPECT_OCMOCK_VERIFY(delegate); | 1010 EXPECT_OCMOCK_VERIFY(delegate); |
| 1007 EXPECT_FALSE([web_controller() isViewAlive]); | 1011 EXPECT_FALSE([web_controller() isViewAlive]); |
| 1008 [web_controller() setDelegate:nil]; | 1012 [web_controller() setDelegate:nil]; |
| 1009 }; | 1013 }; |
| 1010 | 1014 |
| 1011 } // namespace | 1015 } // namespace |
| OLD | NEW |