| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "content/browser/frame_host/render_frame_host_manager.h" | 5 #include "content/browser/frame_host/render_frame_host_manager.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <tuple> | 9 #include <tuple> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 EXPECT_FALSE(controller().GetPendingEntry()); | 877 EXPECT_FALSE(controller().GetPendingEntry()); |
| 878 | 878 |
| 879 // New message should be sent out to make sure to enter view-source mode. | 879 // New message should be sent out to make sure to enter view-source mode. |
| 880 EXPECT_TRUE(process()->sink().GetUniqueMessageMatching( | 880 EXPECT_TRUE(process()->sink().GetUniqueMessageMatching( |
| 881 FrameMsg_EnableViewSourceMode::ID)); | 881 FrameMsg_EnableViewSourceMode::ID)); |
| 882 } | 882 } |
| 883 | 883 |
| 884 // Tests the Init function by checking the initial RenderViewHost. | 884 // Tests the Init function by checking the initial RenderViewHost. |
| 885 TEST_F(RenderFrameHostManagerTest, Init) { | 885 TEST_F(RenderFrameHostManagerTest, Init) { |
| 886 // Using TestBrowserContext. | 886 // Using TestBrowserContext. |
| 887 constexpr int child_process_param_id = 0; |
| 887 scoped_refptr<SiteInstanceImpl> instance = | 888 scoped_refptr<SiteInstanceImpl> instance = |
| 888 SiteInstanceImpl::Create(browser_context()); | 889 SiteInstanceImpl::Create(browser_context(), child_process_param_id); |
| 889 EXPECT_FALSE(instance->HasSite()); | 890 EXPECT_FALSE(instance->HasSite()); |
| 890 | 891 |
| 891 std::unique_ptr<TestWebContents> web_contents( | 892 std::unique_ptr<TestWebContents> web_contents( |
| 892 TestWebContents::Create(browser_context(), instance)); | 893 TestWebContents::Create(browser_context(), instance)); |
| 893 | 894 |
| 894 RenderFrameHostManager* manager = web_contents->GetRenderManagerForTesting(); | 895 RenderFrameHostManager* manager = web_contents->GetRenderManagerForTesting(); |
| 895 RenderViewHostImpl* rvh = manager->current_host(); | 896 RenderViewHostImpl* rvh = manager->current_host(); |
| 896 RenderFrameHostImpl* rfh = manager->current_frame_host(); | 897 RenderFrameHostImpl* rfh = manager->current_frame_host(); |
| 897 ASSERT_TRUE(rvh); | 898 ASSERT_TRUE(rvh); |
| 898 ASSERT_TRUE(rfh); | 899 ASSERT_TRUE(rfh); |
| (...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2502 // page focus should propagate to the new subframe process. Check that | 2503 // page focus should propagate to the new subframe process. Check that |
| 2503 // process C received the proper focus message. | 2504 // process C received the proper focus message. |
| 2504 VerifyPageFocusMessage(hostC->GetProcess(), true, proxy->GetRoutingID()); | 2505 VerifyPageFocusMessage(hostC->GetProcess(), true, proxy->GetRoutingID()); |
| 2505 } | 2506 } |
| 2506 | 2507 |
| 2507 // Checks that a restore navigation to a WebUI works. | 2508 // Checks that a restore navigation to a WebUI works. |
| 2508 TEST_F(RenderFrameHostManagerTest, RestoreNavigationToWebUI) { | 2509 TEST_F(RenderFrameHostManagerTest, RestoreNavigationToWebUI) { |
| 2509 set_should_create_webui(true); | 2510 set_should_create_webui(true); |
| 2510 | 2511 |
| 2511 const GURL kInitUrl("chrome://foo/"); | 2512 const GURL kInitUrl("chrome://foo/"); |
| 2513 constexpr int child_process_param_id = 0; |
| 2512 scoped_refptr<SiteInstanceImpl> initial_instance = | 2514 scoped_refptr<SiteInstanceImpl> initial_instance = |
| 2513 SiteInstanceImpl::Create(browser_context()); | 2515 SiteInstanceImpl::Create(browser_context(), child_process_param_id); |
| 2514 initial_instance->SetSite(kInitUrl); | 2516 initial_instance->SetSite(kInitUrl); |
| 2515 std::unique_ptr<TestWebContents> web_contents( | 2517 std::unique_ptr<TestWebContents> web_contents( |
| 2516 TestWebContents::Create(browser_context(), initial_instance)); | 2518 TestWebContents::Create(browser_context(), initial_instance)); |
| 2517 RenderFrameHostManager* manager = web_contents->GetRenderManagerForTesting(); | 2519 RenderFrameHostManager* manager = web_contents->GetRenderManagerForTesting(); |
| 2518 NavigationControllerImpl& controller = web_contents->GetController(); | 2520 NavigationControllerImpl& controller = web_contents->GetController(); |
| 2519 | 2521 |
| 2520 // Setup a restored entry. | 2522 // Setup a restored entry. |
| 2521 std::vector<std::unique_ptr<NavigationEntry>> entries; | 2523 std::vector<std::unique_ptr<NavigationEntry>> entries; |
| 2522 std::unique_ptr<NavigationEntry> new_entry = | 2524 std::unique_ptr<NavigationEntry> new_entry = |
| 2523 NavigationControllerImpl::CreateNavigationEntry( | 2525 NavigationControllerImpl::CreateNavigationEntry( |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3146 ASSERT_FALSE(delete_observer.deleted()); | 3148 ASSERT_FALSE(delete_observer.deleted()); |
| 3147 EXPECT_FALSE(initial_rfh->is_active()); | 3149 EXPECT_FALSE(initial_rfh->is_active()); |
| 3148 | 3150 |
| 3149 // The initial RFH receives a DidStartProvisionalLoad IPC. It should not | 3151 // The initial RFH receives a DidStartProvisionalLoad IPC. It should not |
| 3150 // create a NavigationHandle. | 3152 // create a NavigationHandle. |
| 3151 initial_rfh->SimulateNavigationStart(kUrl3); | 3153 initial_rfh->SimulateNavigationStart(kUrl3); |
| 3152 EXPECT_FALSE(initial_rfh->navigation_handle()); | 3154 EXPECT_FALSE(initial_rfh->navigation_handle()); |
| 3153 } | 3155 } |
| 3154 | 3156 |
| 3155 } // namespace content | 3157 } // namespace content |
| OLD | NEW |