Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: content/browser/frame_host/render_frame_host_manager_unittest.cc

Issue 2697753002: PlzNavigate: Fix dynamic iframe back forward layout test failure (Closed)
Patch Set: Renamed is_user_gesture to has_user_gesture Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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, false,
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 2379 matching lines...) Expand 10 before | Expand all | Expand 10 after
2831 NavigationEntryImpl entry(nullptr /* instance */, kUrl, 2831 NavigationEntryImpl entry(nullptr /* instance */, kUrl,
2832 Referrer(), base::string16() /* title */, 2832 Referrer(), base::string16() /* title */,
2833 ui::PAGE_TRANSITION_TYPED, 2833 ui::PAGE_TRANSITION_TYPED,
2834 false /* is_renderer_init */); 2834 false /* is_renderer_init */);
2835 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get(); 2835 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get();
2836 std::unique_ptr<NavigationRequest> navigation_request = 2836 std::unique_ptr<NavigationRequest> navigation_request =
2837 NavigationRequest::CreateBrowserInitiated( 2837 NavigationRequest::CreateBrowserInitiated(
2838 contents()->GetFrameTree()->root(), frame_entry->url(), 2838 contents()->GetFrameTree()->root(), frame_entry->url(),
2839 frame_entry->referrer(), *frame_entry, entry, 2839 frame_entry->referrer(), *frame_entry, entry,
2840 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT, PREVIEWS_UNSPECIFIED, 2840 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT, PREVIEWS_UNSPECIFIED,
2841 false, false, base::TimeTicks::Now(), 2841 false, false, false, base::TimeTicks::Now(),
2842 static_cast<NavigationControllerImpl*>(&controller())); 2842 static_cast<NavigationControllerImpl*>(&controller()));
2843 manager->DidCreateNavigationRequest(navigation_request.get()); 2843 manager->DidCreateNavigationRequest(navigation_request.get());
2844 2844
2845 // As the initial RenderFrame was not live, the new RenderFrameHost should be 2845 // As the initial RenderFrame was not live, the new RenderFrameHost should be
2846 // made as active/current immediately along with its WebUI at request time. 2846 // made as active/current immediately along with its WebUI at request time.
2847 RenderFrameHostImpl* host = manager->current_frame_host(); 2847 RenderFrameHostImpl* host = manager->current_frame_host();
2848 ASSERT_TRUE(host); 2848 ASSERT_TRUE(host);
2849 EXPECT_NE(host, initial_host); 2849 EXPECT_NE(host, initial_host);
2850 EXPECT_TRUE(host->IsRenderFrameLive()); 2850 EXPECT_TRUE(host->IsRenderFrameLive());
2851 WebUIImpl* web_ui = host->web_ui(); 2851 WebUIImpl* web_ui = host->web_ui();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2892 NavigationEntryImpl entry(nullptr /* instance */, kUrl, 2892 NavigationEntryImpl entry(nullptr /* instance */, kUrl,
2893 Referrer(), base::string16() /* title */, 2893 Referrer(), base::string16() /* title */,
2894 ui::PAGE_TRANSITION_TYPED, 2894 ui::PAGE_TRANSITION_TYPED,
2895 false /* is_renderer_init */); 2895 false /* is_renderer_init */);
2896 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get(); 2896 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get();
2897 std::unique_ptr<NavigationRequest> navigation_request = 2897 std::unique_ptr<NavigationRequest> navigation_request =
2898 NavigationRequest::CreateBrowserInitiated( 2898 NavigationRequest::CreateBrowserInitiated(
2899 contents()->GetFrameTree()->root(), frame_entry->url(), 2899 contents()->GetFrameTree()->root(), frame_entry->url(),
2900 frame_entry->referrer(), *frame_entry, entry, 2900 frame_entry->referrer(), *frame_entry, entry,
2901 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT, PREVIEWS_UNSPECIFIED, 2901 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT, PREVIEWS_UNSPECIFIED,
2902 false, false, base::TimeTicks::Now(), 2902 false, false, false, base::TimeTicks::Now(),
2903 static_cast<NavigationControllerImpl*>(&controller())); 2903 static_cast<NavigationControllerImpl*>(&controller()));
2904 manager->DidCreateNavigationRequest(navigation_request.get()); 2904 manager->DidCreateNavigationRequest(navigation_request.get());
2905 2905
2906 // The current WebUI should still be in place and the pending WebUI should be 2906 // The current WebUI should still be in place and the pending WebUI should be
2907 // set to reuse it. 2907 // set to reuse it.
2908 EXPECT_EQ(web_ui, manager->GetNavigatingWebUI()); 2908 EXPECT_EQ(web_ui, manager->GetNavigatingWebUI());
2909 EXPECT_EQ(web_ui, host->web_ui()); 2909 EXPECT_EQ(web_ui, host->web_ui());
2910 EXPECT_EQ(web_ui, host->pending_web_ui()); 2910 EXPECT_EQ(web_ui, host->pending_web_ui());
2911 EXPECT_FALSE(GetPendingFrameHost(manager)); 2911 EXPECT_FALSE(GetPendingFrameHost(manager));
2912 2912
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2950 NavigationEntryImpl entry(nullptr /* instance */, kUrl, 2950 NavigationEntryImpl entry(nullptr /* instance */, kUrl,
2951 Referrer(), base::string16() /* title */, 2951 Referrer(), base::string16() /* title */,
2952 ui::PAGE_TRANSITION_TYPED, 2952 ui::PAGE_TRANSITION_TYPED,
2953 false /* is_renderer_init */); 2953 false /* is_renderer_init */);
2954 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get(); 2954 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get();
2955 std::unique_ptr<NavigationRequest> navigation_request = 2955 std::unique_ptr<NavigationRequest> navigation_request =
2956 NavigationRequest::CreateBrowserInitiated( 2956 NavigationRequest::CreateBrowserInitiated(
2957 contents()->GetFrameTree()->root(), frame_entry->url(), 2957 contents()->GetFrameTree()->root(), frame_entry->url(),
2958 frame_entry->referrer(), *frame_entry, entry, 2958 frame_entry->referrer(), *frame_entry, entry,
2959 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT, PREVIEWS_UNSPECIFIED, 2959 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT, PREVIEWS_UNSPECIFIED,
2960 false, false, base::TimeTicks::Now(), 2960 false, false, false, base::TimeTicks::Now(),
2961 static_cast<NavigationControllerImpl*>(&controller())); 2961 static_cast<NavigationControllerImpl*>(&controller()));
2962 manager->DidCreateNavigationRequest(navigation_request.get()); 2962 manager->DidCreateNavigationRequest(navigation_request.get());
2963 2963
2964 // The current WebUI should still be in place and there should be a new 2964 // The current WebUI should still be in place and there should be a new
2965 // active WebUI instance in the speculative RenderFrameHost. 2965 // active WebUI instance in the speculative RenderFrameHost.
2966 EXPECT_TRUE(manager->current_frame_host()->web_ui()); 2966 EXPECT_TRUE(manager->current_frame_host()->web_ui());
2967 EXPECT_FALSE(manager->current_frame_host()->pending_web_ui()); 2967 EXPECT_FALSE(manager->current_frame_host()->pending_web_ui());
2968 RenderFrameHostImpl* speculative_host = GetPendingFrameHost(manager); 2968 RenderFrameHostImpl* speculative_host = GetPendingFrameHost(manager);
2969 EXPECT_TRUE(speculative_host); 2969 EXPECT_TRUE(speculative_host);
2970 WebUIImpl* next_web_ui = manager->GetNavigatingWebUI(); 2970 WebUIImpl* next_web_ui = manager->GetNavigatingWebUI();
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
3146 ASSERT_FALSE(delete_observer.deleted()); 3146 ASSERT_FALSE(delete_observer.deleted());
3147 EXPECT_FALSE(initial_rfh->is_active()); 3147 EXPECT_FALSE(initial_rfh->is_active());
3148 3148
3149 // The initial RFH receives a DidStartProvisionalLoad IPC. It should not 3149 // The initial RFH receives a DidStartProvisionalLoad IPC. It should not
3150 // create a NavigationHandle. 3150 // create a NavigationHandle.
3151 initial_rfh->SimulateNavigationStart(kUrl3); 3151 initial_rfh->SimulateNavigationStart(kUrl3);
3152 EXPECT_FALSE(initial_rfh->navigation_handle()); 3152 EXPECT_FALSE(initial_rfh->navigation_handle());
3153 } 3153 }
3154 3154
3155 } // namespace content 3155 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698