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

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

Issue 1080073004: PlzNavigate: move ownership of the NavigationRequest to the FrameTreeNode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed compilation error Created 5 years, 8 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 return navigated_url_; 213 return navigated_url_;
214 } 214 }
215 215
216 NavigationControllerImpl& controller_impl() { 216 NavigationControllerImpl& controller_impl() {
217 return static_cast<NavigationControllerImpl&>(controller()); 217 return static_cast<NavigationControllerImpl&>(controller());
218 } 218 }
219 219
220 bool HasNavigationRequest() { 220 bool HasNavigationRequest() {
221 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 221 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
222 switches::kEnableBrowserSideNavigation)) { 222 switches::kEnableBrowserSideNavigation)) {
223 FrameTreeNode* root = contents()->GetFrameTree()->root(); 223 return contents()->GetFrameTree()->root()->navigation_request() !=
224 NavigationRequest* navigation_request = static_cast<NavigatorImpl*>( 224 nullptr;
225 root->navigator())->GetNavigationRequestForNodeForTesting(root);
226 return navigation_request != nullptr;
227 } 225 }
228 return process()->sink().GetFirstMessageMatching(FrameMsg_Navigate::ID) 226 return process()->sink().GetFirstMessageMatching(FrameMsg_Navigate::ID)
229 != nullptr; 227 != nullptr;
230 } 228 }
231 229
232 const GURL GetLastNavigationURL() { 230 const GURL GetLastNavigationURL() {
233 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 231 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
234 switches::kEnableBrowserSideNavigation)) { 232 switches::kEnableBrowserSideNavigation)) {
235 FrameTreeNode* root = contents()->GetFrameTree()->root(); 233 NavigationRequest* navigation_request =
236 NavigationRequest* navigation_request = static_cast<NavigatorImpl*>( 234 contents()->GetFrameTree()->root()->navigation_request();
237 root->navigator())->GetNavigationRequestForNodeForTesting(root);
238 CHECK(navigation_request); 235 CHECK(navigation_request);
239 return navigation_request->common_params().url; 236 return navigation_request->common_params().url;
240 } 237 }
241 const IPC::Message* message = 238 const IPC::Message* message =
242 process()->sink().GetFirstMessageMatching(FrameMsg_Navigate::ID); 239 process()->sink().GetFirstMessageMatching(FrameMsg_Navigate::ID);
243 CHECK(message); 240 CHECK(message);
244 Tuple<CommonNavigationParams, StartNavigationParams, 241 Tuple<CommonNavigationParams, StartNavigationParams,
245 RequestNavigationParams> nav_params; 242 RequestNavigationParams> nav_params;
246 FrameMsg_Navigate::Read(message, &nav_params); 243 FrameMsg_Navigate::Read(message, &nav_params);
247 return get<0>(nav_params).url; 244 return get<0>(nav_params).url;
(...skipping 4350 matching lines...) Expand 10 before | Expand all | Expand 10 after
4598 { 4595 {
4599 LoadCommittedDetails details; 4596 LoadCommittedDetails details;
4600 controller_impl().RendererDidNavigate(main_test_rfh(), params, &details); 4597 controller_impl().RendererDidNavigate(main_test_rfh(), params, &details);
4601 EXPECT_EQ(PAGE_TYPE_ERROR, 4598 EXPECT_EQ(PAGE_TYPE_ERROR,
4602 controller_impl().GetLastCommittedEntry()->GetPageType()); 4599 controller_impl().GetLastCommittedEntry()->GetPageType());
4603 EXPECT_EQ(NAVIGATION_TYPE_IN_PAGE, details.type); 4600 EXPECT_EQ(NAVIGATION_TYPE_IN_PAGE, details.type);
4604 } 4601 }
4605 } 4602 }
4606 4603
4607 } // namespace content 4604 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/frame_tree_node.cc ('k') | content/browser/frame_host/navigator_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698