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

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

Issue 642813007: Drop CreateChildFrame messages when swapping out. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another round of fixes. Created 6 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/guid.h" 6 #include "base/guid.h"
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/test/histogram_tester.h" 8 #include "base/test/histogram_tester.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/browser/frame_host/navigation_controller_impl.h" 10 #include "content/browser/frame_host/navigation_controller_impl.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 TEST_F(NavigatorTest, BrowserSideNavigationBeginNavigation) { 92 TEST_F(NavigatorTest, BrowserSideNavigationBeginNavigation) {
93 const GURL kUrl1("http://www.google.com/"); 93 const GURL kUrl1("http://www.google.com/");
94 const GURL kUrl2("http://www.chromium.org/"); 94 const GURL kUrl2("http://www.chromium.org/");
95 const GURL kUrl3("http://www.gmail.com/"); 95 const GURL kUrl3("http://www.gmail.com/");
96 96
97 contents()->NavigateAndCommit(kUrl1); 97 contents()->NavigateAndCommit(kUrl1);
98 98
99 EnableBrowserSideNavigation(); 99 EnableBrowserSideNavigation();
100 100
101 // Add a subframe. 101 // Add a subframe.
102 FrameTreeNode* root = contents()->GetFrameTree()->root();
102 TestRenderFrameHost* subframe_rfh = static_cast<TestRenderFrameHost*>( 103 TestRenderFrameHost* subframe_rfh = static_cast<TestRenderFrameHost*>(
103 contents()->GetFrameTree()->AddFrame( 104 contents()->GetFrameTree()->AddFrame(
104 contents()->GetFrameTree()->root(), 14, "Child")); 105 root, root->current_frame_host()->GetProcess()->GetID(), 14,
106 "Child"));
107 EXPECT_TRUE(subframe_rfh);
105 108
106 FrameTreeNode* subframe_node = subframe_rfh->frame_tree_node(); 109 FrameTreeNode* subframe_node = subframe_rfh->frame_tree_node();
107 SendRequestNavigation(subframe_rfh->frame_tree_node(), kUrl2); 110 SendRequestNavigation(subframe_rfh->frame_tree_node(), kUrl2);
108 // There is no previous renderer in the subframe, so BeginNavigation is 111 // There is no previous renderer in the subframe, so BeginNavigation is
109 // handled already. 112 // handled already.
110 NavigationRequest* subframe_request = 113 NavigationRequest* subframe_request =
111 GetNavigationRequestForFrameTreeNode(subframe_node); 114 GetNavigationRequestForFrameTreeNode(subframe_node);
112 ASSERT_TRUE(subframe_request); 115 ASSERT_TRUE(subframe_request);
113 EXPECT_EQ(kUrl2, subframe_request->common_params().url); 116 EXPECT_EQ(kUrl2, subframe_request->common_params().url);
114 // First party for cookies url should be that of the main frame. 117 // First party for cookies url should be that of the main frame.
115 EXPECT_EQ(kUrl1, subframe_request->info_for_test()->first_party_for_cookies); 118 EXPECT_EQ(kUrl1, subframe_request->info_for_test()->first_party_for_cookies);
116 EXPECT_FALSE(subframe_request->info_for_test()->is_main_frame); 119 EXPECT_FALSE(subframe_request->info_for_test()->is_main_frame);
117 EXPECT_TRUE(subframe_request->info_for_test()->parent_is_main_frame); 120 EXPECT_TRUE(subframe_request->info_for_test()->parent_is_main_frame);
118 121
119 FrameTreeNode* main_frame_node = 122 SendRequestNavigation(root, kUrl3);
120 contents()->GetMainFrame()->frame_tree_node();
121 SendRequestNavigation(main_frame_node, kUrl3);
122 // Simulate a BeginNavigation IPC on the main frame. 123 // Simulate a BeginNavigation IPC on the main frame.
123 contents()->GetMainFrame()->SendBeginNavigationWithURL(kUrl3); 124 contents()->GetMainFrame()->SendBeginNavigationWithURL(kUrl3);
124 NavigationRequest* main_request = 125 NavigationRequest* main_request = GetNavigationRequestForFrameTreeNode(root);
125 GetNavigationRequestForFrameTreeNode(main_frame_node);
126 ASSERT_TRUE(main_request); 126 ASSERT_TRUE(main_request);
127 EXPECT_EQ(kUrl3, main_request->common_params().url); 127 EXPECT_EQ(kUrl3, main_request->common_params().url);
128 EXPECT_EQ(kUrl3, main_request->info_for_test()->first_party_for_cookies); 128 EXPECT_EQ(kUrl3, main_request->info_for_test()->first_party_for_cookies);
129 EXPECT_TRUE(main_request->info_for_test()->is_main_frame); 129 EXPECT_TRUE(main_request->info_for_test()->is_main_frame);
130 EXPECT_FALSE(main_request->info_for_test()->parent_is_main_frame); 130 EXPECT_FALSE(main_request->info_for_test()->parent_is_main_frame);
131 } 131 }
132 132
133 // PlzNavigate: Test that RequestNavigation creates a NavigationRequest and that 133 // PlzNavigate: Test that RequestNavigation creates a NavigationRequest and that
134 // RenderFrameHost is not modified when the navigation commits. 134 // RenderFrameHost is not modified when the navigation commits.
135 TEST_F(NavigatorTest, BrowserSideNavigationRequestNavigationNoLiveRenderer) { 135 TEST_F(NavigatorTest, BrowserSideNavigationRequestNavigationNoLiveRenderer) {
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 NavigationController::RELOAD_IGNORING_CACHE); 329 NavigationController::RELOAD_IGNORING_CACHE);
330 contents()->GetMainFrame()->SendBeginNavigationWithURL(kUrl); 330 contents()->GetMainFrame()->SendBeginNavigationWithURL(kUrl);
331 // A NavigationRequest should have been generated. 331 // A NavigationRequest should have been generated.
332 main_request = GetNavigationRequestForFrameTreeNode(node); 332 main_request = GetNavigationRequestForFrameTreeNode(node);
333 ASSERT_TRUE(main_request != NULL); 333 ASSERT_TRUE(main_request != NULL);
334 EXPECT_EQ(FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE, 334 EXPECT_EQ(FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE,
335 main_request->common_params().navigation_type); 335 main_request->common_params().navigation_type);
336 } 336 }
337 337
338 } // namespace content 338 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/frame_tree_unittest.cc ('k') | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698