| 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 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 ExecuteJavaScript(@"__gCrWeb['windowId'] = '';"); | 771 ExecuteJavaScript(@"__gCrWeb['windowId'] = '';"); |
| 772 | 772 |
| 773 // Script is not evaluated because of windowID mismatch. | 773 // Script is not evaluated because of windowID mismatch. |
| 774 ExecuteJavaScript(@"window.test2 = '2';"); | 774 ExecuteJavaScript(@"window.test2 = '2';"); |
| 775 EXPECT_FALSE(ExecuteJavaScript(@"window.test2")); | 775 EXPECT_FALSE(ExecuteJavaScript(@"window.test2")); |
| 776 } | 776 } |
| 777 | 777 |
| 778 TEST_F(CRWWebControllerTest, WebUrlWithTrustLevel) { | 778 TEST_F(CRWWebControllerTest, WebUrlWithTrustLevel) { |
| 779 [[[mockWebView_ stub] andReturn:[NSURL URLWithString:@(kTestURLString)]] URL]; | 779 [[[mockWebView_ stub] andReturn:[NSURL URLWithString:@(kTestURLString)]] URL]; |
| 780 [[[mockWebView_ stub] andReturnBool:NO] hasOnlySecureContent]; | 780 [[[mockWebView_ stub] andReturnBool:NO] hasOnlySecureContent]; |
| 781 [[[mockWebView_ stub] andReturn:@""] title]; | |
| 782 | 781 |
| 783 // Stub out the injection process. | 782 // Stub out the injection process. |
| 784 [[mockWebView_ stub] evaluateJavaScript:OCMOCK_ANY | 783 [[mockWebView_ stub] evaluateJavaScript:OCMOCK_ANY |
| 785 completionHandler:OCMOCK_ANY]; | 784 completionHandler:OCMOCK_ANY]; |
| 786 | 785 |
| 787 // Simulate registering load request to avoid failing page load simulation. | 786 // Simulate registering load request to avoid failing page load simulation. |
| 788 [web_controller() simulateLoadRequestWithURL:GURL(kTestURLString)]; | 787 [web_controller() simulateLoadRequestWithURL:GURL(kTestURLString)]; |
| 789 // Simulate a page load to trigger a URL update. | 788 // Simulate a page load to trigger a URL update. |
| 790 [static_cast<id<WKNavigationDelegate>>(web_controller()) webView:mockWebView_ | 789 [static_cast<id<WKNavigationDelegate>>(web_controller()) webView:mockWebView_ |
| 791 didCommitNavigation:nil]; | 790 didCommitNavigation:nil]; |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 }; | 1054 }; |
| 1056 | 1055 |
| 1057 RenderProcessGoneObserver observer(web_state()); | 1056 RenderProcessGoneObserver observer(web_state()); |
| 1058 web::SimulateWKWebViewCrash(webView_); | 1057 web::SimulateWKWebViewCrash(webView_); |
| 1059 observer.WaitForRenderProcessGone(); | 1058 observer.WaitForRenderProcessGone(); |
| 1060 | 1059 |
| 1061 EXPECT_FALSE([web_controller() isViewAlive]); | 1060 EXPECT_FALSE([web_controller() isViewAlive]); |
| 1062 }; | 1061 }; |
| 1063 | 1062 |
| 1064 } // namespace | 1063 } // namespace |
| OLD | NEW |