| 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 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2506 // page focus should propagate to the new subframe process. Check that | 2507 // page focus should propagate to the new subframe process. Check that |
| 2507 // process C received the proper focus message. | 2508 // process C received the proper focus message. |
| 2508 VerifyPageFocusMessage(hostC->GetProcess(), true, proxy->GetRoutingID()); | 2509 VerifyPageFocusMessage(hostC->GetProcess(), true, proxy->GetRoutingID()); |
| 2509 } | 2510 } |
| 2510 | 2511 |
| 2511 // Checks that a restore navigation to a WebUI works. | 2512 // Checks that a restore navigation to a WebUI works. |
| 2512 TEST_F(RenderFrameHostManagerTest, RestoreNavigationToWebUI) { | 2513 TEST_F(RenderFrameHostManagerTest, RestoreNavigationToWebUI) { |
| 2513 set_should_create_webui(true); | 2514 set_should_create_webui(true); |
| 2514 | 2515 |
| 2515 const GURL kInitUrl("chrome://foo/"); | 2516 const GURL kInitUrl("chrome://foo/"); |
| 2517 constexpr int child_process_param_id = 0; |
| 2516 scoped_refptr<SiteInstanceImpl> initial_instance = | 2518 scoped_refptr<SiteInstanceImpl> initial_instance = |
| 2517 SiteInstanceImpl::Create(browser_context()); | 2519 SiteInstanceImpl::Create(browser_context(), child_process_param_id); |
| 2518 initial_instance->SetSite(kInitUrl); | 2520 initial_instance->SetSite(kInitUrl); |
| 2519 std::unique_ptr<TestWebContents> web_contents( | 2521 std::unique_ptr<TestWebContents> web_contents( |
| 2520 TestWebContents::Create(browser_context(), initial_instance)); | 2522 TestWebContents::Create(browser_context(), initial_instance)); |
| 2521 RenderFrameHostManager* manager = web_contents->GetRenderManagerForTesting(); | 2523 RenderFrameHostManager* manager = web_contents->GetRenderManagerForTesting(); |
| 2522 NavigationControllerImpl& controller = web_contents->GetController(); | 2524 NavigationControllerImpl& controller = web_contents->GetController(); |
| 2523 | 2525 |
| 2524 // Setup a restored entry. | 2526 // Setup a restored entry. |
| 2525 std::vector<std::unique_ptr<NavigationEntry>> entries; | 2527 std::vector<std::unique_ptr<NavigationEntry>> entries; |
| 2526 std::unique_ptr<NavigationEntry> new_entry = | 2528 std::unique_ptr<NavigationEntry> new_entry = |
| 2527 NavigationControllerImpl::CreateNavigationEntry( | 2529 NavigationControllerImpl::CreateNavigationEntry( |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3150 ASSERT_FALSE(delete_observer.deleted()); | 3152 ASSERT_FALSE(delete_observer.deleted()); |
| 3151 EXPECT_FALSE(initial_rfh->is_active()); | 3153 EXPECT_FALSE(initial_rfh->is_active()); |
| 3152 | 3154 |
| 3153 // The initial RFH receives a DidStartProvisionalLoad IPC. It should not | 3155 // The initial RFH receives a DidStartProvisionalLoad IPC. It should not |
| 3154 // create a NavigationHandle. | 3156 // create a NavigationHandle. |
| 3155 initial_rfh->SimulateNavigationStart(kUrl3); | 3157 initial_rfh->SimulateNavigationStart(kUrl3); |
| 3156 EXPECT_FALSE(initial_rfh->navigation_handle()); | 3158 EXPECT_FALSE(initial_rfh->navigation_handle()); |
| 3157 } | 3159 } |
| 3158 | 3160 |
| 3159 } // namespace content | 3161 } // namespace content |
| OLD | NEW |