| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 mockDelegate_.reset([[MockInteractionLoader alloc] | 186 mockDelegate_.reset([[MockInteractionLoader alloc] |
| 187 initWithRepresentedObject:originalMockDelegate]); | 187 initWithRepresentedObject:originalMockDelegate]); |
| 188 [web_controller() setDelegate:mockDelegate_]; | 188 [web_controller() setDelegate:mockDelegate_]; |
| 189 base::scoped_nsobject<TestWebViewContentView> webViewContentView( | 189 base::scoped_nsobject<TestWebViewContentView> webViewContentView( |
| 190 [[TestWebViewContentView alloc] initWithMockWebView:mockWebView_ | 190 [[TestWebViewContentView alloc] initWithMockWebView:mockWebView_ |
| 191 scrollView:mockScrollView_]); | 191 scrollView:mockScrollView_]); |
| 192 [web_controller() injectWebViewContentView:webViewContentView]; | 192 [web_controller() injectWebViewContentView:webViewContentView]; |
| 193 | 193 |
| 194 NavigationManagerImpl& navigationManager = | 194 NavigationManagerImpl& navigationManager = |
| 195 [web_controller() webStateImpl]->GetNavigationManagerImpl(); | 195 [web_controller() webStateImpl]->GetNavigationManagerImpl(); |
| 196 navigationManager.InitializeSession(@"name", NO); | 196 navigationManager.InitializeSession(NO); |
| 197 navigationManager.AddPendingItem( | 197 navigationManager.AddPendingItem( |
| 198 GURL("http://www.google.com/?q=foo#bar"), web::Referrer(), | 198 GURL("http://www.google.com/?q=foo#bar"), web::Referrer(), |
| 199 ui::PAGE_TRANSITION_TYPED, | 199 ui::PAGE_TRANSITION_TYPED, |
| 200 web::NavigationInitiationType::USER_INITIATED); | 200 web::NavigationInitiationType::USER_INITIATED); |
| 201 } | 201 } |
| 202 | 202 |
| 203 void TearDown() override { | 203 void TearDown() override { |
| 204 EXPECT_OCMOCK_VERIFY(mockDelegate_); | 204 EXPECT_OCMOCK_VERIFY(mockDelegate_); |
| 205 EXPECT_OCMOCK_VERIFY(mockChildWebController_); | 205 EXPECT_OCMOCK_VERIFY(mockChildWebController_); |
| 206 EXPECT_OCMOCK_VERIFY(mockWebView_); | 206 EXPECT_OCMOCK_VERIFY(mockWebView_); |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 protected: | 799 protected: |
| 800 void SetUp() override { | 800 void SetUp() override { |
| 801 web::WebTestWithWebController::SetUp(); | 801 web::WebTestWithWebController::SetUp(); |
| 802 mock_native_provider_.reset([[TestNativeContentProvider alloc] init]); | 802 mock_native_provider_.reset([[TestNativeContentProvider alloc] init]); |
| 803 [web_controller() setNativeProvider:mock_native_provider_]; | 803 [web_controller() setNativeProvider:mock_native_provider_]; |
| 804 } | 804 } |
| 805 | 805 |
| 806 void Load(const GURL& URL) { | 806 void Load(const GURL& URL) { |
| 807 NavigationManagerImpl& navigation_manager = | 807 NavigationManagerImpl& navigation_manager = |
| 808 [web_controller() webStateImpl]->GetNavigationManagerImpl(); | 808 [web_controller() webStateImpl]->GetNavigationManagerImpl(); |
| 809 navigation_manager.InitializeSession(@"name", NO); | 809 navigation_manager.InitializeSession(NO); |
| 810 navigation_manager.AddPendingItem( | 810 navigation_manager.AddPendingItem( |
| 811 URL, web::Referrer(), ui::PAGE_TRANSITION_TYPED, | 811 URL, web::Referrer(), ui::PAGE_TRANSITION_TYPED, |
| 812 web::NavigationInitiationType::USER_INITIATED); | 812 web::NavigationInitiationType::USER_INITIATED); |
| 813 [web_controller() loadCurrentURL]; | 813 [web_controller() loadCurrentURL]; |
| 814 } | 814 } |
| 815 | 815 |
| 816 base::scoped_nsobject<TestNativeContentProvider> mock_native_provider_; | 816 base::scoped_nsobject<TestNativeContentProvider> mock_native_provider_; |
| 817 }; | 817 }; |
| 818 | 818 |
| 819 // Tests WebState and NavigationManager correctly return native content URL. | 819 // Tests WebState and NavigationManager correctly return native content URL. |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 }; | 1031 }; |
| 1032 | 1032 |
| 1033 RenderProcessGoneObserver observer(web_state()); | 1033 RenderProcessGoneObserver observer(web_state()); |
| 1034 web::SimulateWKWebViewCrash(webView_); | 1034 web::SimulateWKWebViewCrash(webView_); |
| 1035 observer.WaitForRenderProcessGone(); | 1035 observer.WaitForRenderProcessGone(); |
| 1036 | 1036 |
| 1037 EXPECT_FALSE([web_controller() isViewAlive]); | 1037 EXPECT_FALSE([web_controller() isViewAlive]); |
| 1038 }; | 1038 }; |
| 1039 | 1039 |
| 1040 } // namespace | 1040 } // namespace |
| OLD | NEW |