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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 ->navigator() | 430 ->navigator() |
431 ->GetController()); | 431 ->GetController()); |
432 FrameMsg_Navigate_Type::Value navigate_type = | 432 FrameMsg_Navigate_Type::Value navigate_type = |
433 entry.restore_type() == RestoreType::NONE | 433 entry.restore_type() == RestoreType::NONE |
434 ? FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT | 434 ? FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT |
435 : FrameMsg_Navigate_Type::RESTORE; | 435 : FrameMsg_Navigate_Type::RESTORE; |
436 std::unique_ptr<NavigationRequest> navigation_request = | 436 std::unique_ptr<NavigationRequest> navigation_request = |
437 NavigationRequest::CreateBrowserInitiated( | 437 NavigationRequest::CreateBrowserInitiated( |
438 manager->frame_tree_node_, frame_entry->url(), | 438 manager->frame_tree_node_, frame_entry->url(), |
439 frame_entry->referrer(), *frame_entry, entry, navigate_type, | 439 frame_entry->referrer(), *frame_entry, entry, navigate_type, |
440 PREVIEWS_UNSPECIFIED, false, false, base::TimeTicks::Now(), | 440 PREVIEWS_UNSPECIFIED, false, false, nullptr, |
441 controller); | 441 base::TimeTicks::Now(), controller); |
442 | 442 |
443 // Simulates request creation that triggers the 1st internal call to | 443 // Simulates request creation that triggers the 1st internal call to |
444 // GetFrameHostForNavigation. | 444 // GetFrameHostForNavigation. |
445 manager->DidCreateNavigationRequest(navigation_request.get()); | 445 manager->DidCreateNavigationRequest(navigation_request.get()); |
446 | 446 |
447 // And also simulates the 2nd and final call to GetFrameHostForNavigation | 447 // And also simulates the 2nd and final call to GetFrameHostForNavigation |
448 // that determines the final frame that will commit the navigation. | 448 // that determines the final frame that will commit the navigation. |
449 TestRenderFrameHost* frame_host = static_cast<TestRenderFrameHost*>( | 449 TestRenderFrameHost* frame_host = static_cast<TestRenderFrameHost*>( |
450 manager->GetFrameHostForNavigation(*navigation_request)); | 450 manager->GetFrameHostForNavigation(*navigation_request)); |
451 CHECK(frame_host); | 451 CHECK(frame_host); |
(...skipping 2393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2845 NavigationEntryImpl entry(nullptr /* instance */, kUrl, | 2845 NavigationEntryImpl entry(nullptr /* instance */, kUrl, |
2846 Referrer(), base::string16() /* title */, | 2846 Referrer(), base::string16() /* title */, |
2847 ui::PAGE_TRANSITION_TYPED, | 2847 ui::PAGE_TRANSITION_TYPED, |
2848 false /* is_renderer_init */); | 2848 false /* is_renderer_init */); |
2849 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get(); | 2849 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get(); |
2850 std::unique_ptr<NavigationRequest> navigation_request = | 2850 std::unique_ptr<NavigationRequest> navigation_request = |
2851 NavigationRequest::CreateBrowserInitiated( | 2851 NavigationRequest::CreateBrowserInitiated( |
2852 contents()->GetFrameTree()->root(), frame_entry->url(), | 2852 contents()->GetFrameTree()->root(), frame_entry->url(), |
2853 frame_entry->referrer(), *frame_entry, entry, | 2853 frame_entry->referrer(), *frame_entry, entry, |
2854 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT, PREVIEWS_UNSPECIFIED, | 2854 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT, PREVIEWS_UNSPECIFIED, |
2855 false, false, base::TimeTicks::Now(), | 2855 false, false, nullptr, base::TimeTicks::Now(), |
2856 static_cast<NavigationControllerImpl*>(&controller())); | 2856 static_cast<NavigationControllerImpl*>(&controller())); |
2857 manager->DidCreateNavigationRequest(navigation_request.get()); | 2857 manager->DidCreateNavigationRequest(navigation_request.get()); |
2858 | 2858 |
2859 // As the initial RenderFrame was not live, the new RenderFrameHost should be | 2859 // As the initial RenderFrame was not live, the new RenderFrameHost should be |
2860 // made as active/current immediately along with its WebUI at request time. | 2860 // made as active/current immediately along with its WebUI at request time. |
2861 RenderFrameHostImpl* host = manager->current_frame_host(); | 2861 RenderFrameHostImpl* host = manager->current_frame_host(); |
2862 ASSERT_TRUE(host); | 2862 ASSERT_TRUE(host); |
2863 EXPECT_NE(host, initial_host); | 2863 EXPECT_NE(host, initial_host); |
2864 EXPECT_TRUE(host->IsRenderFrameLive()); | 2864 EXPECT_TRUE(host->IsRenderFrameLive()); |
2865 WebUIImpl* web_ui = host->web_ui(); | 2865 WebUIImpl* web_ui = host->web_ui(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2906 NavigationEntryImpl entry(nullptr /* instance */, kUrl, | 2906 NavigationEntryImpl entry(nullptr /* instance */, kUrl, |
2907 Referrer(), base::string16() /* title */, | 2907 Referrer(), base::string16() /* title */, |
2908 ui::PAGE_TRANSITION_TYPED, | 2908 ui::PAGE_TRANSITION_TYPED, |
2909 false /* is_renderer_init */); | 2909 false /* is_renderer_init */); |
2910 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get(); | 2910 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get(); |
2911 std::unique_ptr<NavigationRequest> navigation_request = | 2911 std::unique_ptr<NavigationRequest> navigation_request = |
2912 NavigationRequest::CreateBrowserInitiated( | 2912 NavigationRequest::CreateBrowserInitiated( |
2913 contents()->GetFrameTree()->root(), frame_entry->url(), | 2913 contents()->GetFrameTree()->root(), frame_entry->url(), |
2914 frame_entry->referrer(), *frame_entry, entry, | 2914 frame_entry->referrer(), *frame_entry, entry, |
2915 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT, PREVIEWS_UNSPECIFIED, | 2915 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT, PREVIEWS_UNSPECIFIED, |
2916 false, false, base::TimeTicks::Now(), | 2916 false, false, nullptr, base::TimeTicks::Now(), |
2917 static_cast<NavigationControllerImpl*>(&controller())); | 2917 static_cast<NavigationControllerImpl*>(&controller())); |
2918 manager->DidCreateNavigationRequest(navigation_request.get()); | 2918 manager->DidCreateNavigationRequest(navigation_request.get()); |
2919 | 2919 |
2920 // The current WebUI should still be in place and the pending WebUI should be | 2920 // The current WebUI should still be in place and the pending WebUI should be |
2921 // set to reuse it. | 2921 // set to reuse it. |
2922 EXPECT_EQ(web_ui, manager->GetNavigatingWebUI()); | 2922 EXPECT_EQ(web_ui, manager->GetNavigatingWebUI()); |
2923 EXPECT_EQ(web_ui, host->web_ui()); | 2923 EXPECT_EQ(web_ui, host->web_ui()); |
2924 EXPECT_EQ(web_ui, host->pending_web_ui()); | 2924 EXPECT_EQ(web_ui, host->pending_web_ui()); |
2925 EXPECT_FALSE(GetPendingFrameHost(manager)); | 2925 EXPECT_FALSE(GetPendingFrameHost(manager)); |
2926 | 2926 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2964 NavigationEntryImpl entry(nullptr /* instance */, kUrl, | 2964 NavigationEntryImpl entry(nullptr /* instance */, kUrl, |
2965 Referrer(), base::string16() /* title */, | 2965 Referrer(), base::string16() /* title */, |
2966 ui::PAGE_TRANSITION_TYPED, | 2966 ui::PAGE_TRANSITION_TYPED, |
2967 false /* is_renderer_init */); | 2967 false /* is_renderer_init */); |
2968 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get(); | 2968 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get(); |
2969 std::unique_ptr<NavigationRequest> navigation_request = | 2969 std::unique_ptr<NavigationRequest> navigation_request = |
2970 NavigationRequest::CreateBrowserInitiated( | 2970 NavigationRequest::CreateBrowserInitiated( |
2971 contents()->GetFrameTree()->root(), frame_entry->url(), | 2971 contents()->GetFrameTree()->root(), frame_entry->url(), |
2972 frame_entry->referrer(), *frame_entry, entry, | 2972 frame_entry->referrer(), *frame_entry, entry, |
2973 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT, PREVIEWS_UNSPECIFIED, | 2973 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT, PREVIEWS_UNSPECIFIED, |
2974 false, false, base::TimeTicks::Now(), | 2974 false, false, nullptr, base::TimeTicks::Now(), |
2975 static_cast<NavigationControllerImpl*>(&controller())); | 2975 static_cast<NavigationControllerImpl*>(&controller())); |
2976 manager->DidCreateNavigationRequest(navigation_request.get()); | 2976 manager->DidCreateNavigationRequest(navigation_request.get()); |
2977 | 2977 |
2978 // The current WebUI should still be in place and there should be a new | 2978 // The current WebUI should still be in place and there should be a new |
2979 // active WebUI instance in the speculative RenderFrameHost. | 2979 // active WebUI instance in the speculative RenderFrameHost. |
2980 EXPECT_TRUE(manager->current_frame_host()->web_ui()); | 2980 EXPECT_TRUE(manager->current_frame_host()->web_ui()); |
2981 EXPECT_FALSE(manager->current_frame_host()->pending_web_ui()); | 2981 EXPECT_FALSE(manager->current_frame_host()->pending_web_ui()); |
2982 RenderFrameHostImpl* speculative_host = GetPendingFrameHost(manager); | 2982 RenderFrameHostImpl* speculative_host = GetPendingFrameHost(manager); |
2983 EXPECT_TRUE(speculative_host); | 2983 EXPECT_TRUE(speculative_host); |
2984 WebUIImpl* next_web_ui = manager->GetNavigatingWebUI(); | 2984 WebUIImpl* next_web_ui = manager->GetNavigatingWebUI(); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3161 ASSERT_FALSE(delete_observer.deleted()); | 3161 ASSERT_FALSE(delete_observer.deleted()); |
3162 EXPECT_FALSE(initial_rfh->is_active()); | 3162 EXPECT_FALSE(initial_rfh->is_active()); |
3163 | 3163 |
3164 // The initial RFH receives a DidStartProvisionalLoad IPC. It should not | 3164 // The initial RFH receives a DidStartProvisionalLoad IPC. It should not |
3165 // create a NavigationHandle. | 3165 // create a NavigationHandle. |
3166 initial_rfh->SimulateNavigationStart(kUrl3); | 3166 initial_rfh->SimulateNavigationStart(kUrl3); |
3167 EXPECT_FALSE(initial_rfh->navigation_handle()); | 3167 EXPECT_FALSE(initial_rfh->navigation_handle()); |
3168 } | 3168 } |
3169 | 3169 |
3170 } // namespace content | 3170 } // namespace content |
OLD | NEW |