| 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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 ExecuteJavaScript(@"__gCrWeb['windowId'] = '';"); | 763 ExecuteJavaScript(@"__gCrWeb['windowId'] = '';"); |
| 764 | 764 |
| 765 // Script is not evaluated because of windowID mismatch. | 765 // Script is not evaluated because of windowID mismatch. |
| 766 ExecuteJavaScript(@"window.test2 = '2';"); | 766 ExecuteJavaScript(@"window.test2 = '2';"); |
| 767 EXPECT_FALSE(ExecuteJavaScript(@"window.test2")); | 767 EXPECT_FALSE(ExecuteJavaScript(@"window.test2")); |
| 768 } | 768 } |
| 769 | 769 |
| 770 TEST_F(CRWWebControllerTest, WebUrlWithTrustLevel) { | 770 TEST_F(CRWWebControllerTest, WebUrlWithTrustLevel) { |
| 771 [[[mockWebView_ stub] andReturn:[NSURL URLWithString:@(kTestURLString)]] URL]; | 771 [[[mockWebView_ stub] andReturn:[NSURL URLWithString:@(kTestURLString)]] URL]; |
| 772 [[[mockWebView_ stub] andReturnBool:NO] hasOnlySecureContent]; | 772 [[[mockWebView_ stub] andReturnBool:NO] hasOnlySecureContent]; |
| 773 [[[mockWebView_ stub] andReturn:@""] title]; |
| 773 | 774 |
| 774 // Stub out the injection process. | 775 // Stub out the injection process. |
| 775 [[mockWebView_ stub] evaluateJavaScript:OCMOCK_ANY | 776 [[mockWebView_ stub] evaluateJavaScript:OCMOCK_ANY |
| 776 completionHandler:OCMOCK_ANY]; | 777 completionHandler:OCMOCK_ANY]; |
| 777 | 778 |
| 778 // Simulate registering load request to avoid failing page load simulation. | 779 // Simulate registering load request to avoid failing page load simulation. |
| 779 [web_controller() simulateLoadRequestWithURL:GURL(kTestURLString)]; | 780 [web_controller() simulateLoadRequestWithURL:GURL(kTestURLString)]; |
| 780 // Simulate a page load to trigger a URL update. | 781 // Simulate a page load to trigger a URL update. |
| 781 [static_cast<id<WKNavigationDelegate>>(web_controller()) webView:mockWebView_ | 782 [static_cast<id<WKNavigationDelegate>>(web_controller()) webView:mockWebView_ |
| 782 didCommitNavigation:nil]; | 783 didCommitNavigation:nil]; |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 }; | 1044 }; |
| 1044 | 1045 |
| 1045 RenderProcessGoneObserver observer(web_state()); | 1046 RenderProcessGoneObserver observer(web_state()); |
| 1046 web::SimulateWKWebViewCrash(webView_); | 1047 web::SimulateWKWebViewCrash(webView_); |
| 1047 observer.WaitForRenderProcessGone(); | 1048 observer.WaitForRenderProcessGone(); |
| 1048 | 1049 |
| 1049 EXPECT_FALSE([web_controller() isViewAlive]); | 1050 EXPECT_FALSE([web_controller() isViewAlive]); |
| 1050 }; | 1051 }; |
| 1051 | 1052 |
| 1052 } // namespace | 1053 } // namespace |
| OLD | NEW |