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]; |
781 | 782 |
782 // Stub out the injection process. | 783 // Stub out the injection process. |
783 [[mockWebView_ stub] evaluateJavaScript:OCMOCK_ANY | 784 [[mockWebView_ stub] evaluateJavaScript:OCMOCK_ANY |
784 completionHandler:OCMOCK_ANY]; | 785 completionHandler:OCMOCK_ANY]; |
785 | 786 |
786 // Simulate registering load request to avoid failing page load simulation. | 787 // Simulate registering load request to avoid failing page load simulation. |
787 [web_controller() simulateLoadRequestWithURL:GURL(kTestURLString)]; | 788 [web_controller() simulateLoadRequestWithURL:GURL(kTestURLString)]; |
788 // Simulate a page load to trigger a URL update. | 789 // Simulate a page load to trigger a URL update. |
789 [static_cast<id<WKNavigationDelegate>>(web_controller()) webView:mockWebView_ | 790 [static_cast<id<WKNavigationDelegate>>(web_controller()) webView:mockWebView_ |
790 didCommitNavigation:nil]; | 791 didCommitNavigation:nil]; |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 }; | 1055 }; |
1055 | 1056 |
1056 RenderProcessGoneObserver observer(web_state()); | 1057 RenderProcessGoneObserver observer(web_state()); |
1057 web::SimulateWKWebViewCrash(webView_); | 1058 web::SimulateWKWebViewCrash(webView_); |
1058 observer.WaitForRenderProcessGone(); | 1059 observer.WaitForRenderProcessGone(); |
1059 | 1060 |
1060 EXPECT_FALSE([web_controller() isViewAlive]); | 1061 EXPECT_FALSE([web_controller() isViewAlive]); |
1061 }; | 1062 }; |
1062 | 1063 |
1063 } // namespace | 1064 } // namespace |
OLD | NEW |