| 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 "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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 FrameTreeNode* root = contents()->GetFrameTree()->root(); |
| 224 NavigationRequest* navigation_request = static_cast<NavigatorImpl*>( | 224 NavigationRequest* navigation_request = |
| 225 root->navigator())->GetNavigationRequestForNodeForTesting(root); | 225 static_cast<NavigatorImpl*>(root->navigator()) |
| 226 ->GetNavigationRequestForNodeForTesting( |
| 227 root->frame_tree_node_id()); |
| 226 return navigation_request != nullptr; | 228 return navigation_request != nullptr; |
| 227 } | 229 } |
| 228 return process()->sink().GetFirstMessageMatching(FrameMsg_Navigate::ID) | 230 return process()->sink().GetFirstMessageMatching(FrameMsg_Navigate::ID) |
| 229 != nullptr; | 231 != nullptr; |
| 230 } | 232 } |
| 231 | 233 |
| 232 const GURL GetLastNavigationURL() { | 234 const GURL GetLastNavigationURL() { |
| 233 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 235 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 234 switches::kEnableBrowserSideNavigation)) { | 236 switches::kEnableBrowserSideNavigation)) { |
| 235 FrameTreeNode* root = contents()->GetFrameTree()->root(); | 237 FrameTreeNode* root = contents()->GetFrameTree()->root(); |
| 236 NavigationRequest* navigation_request = static_cast<NavigatorImpl*>( | 238 NavigationRequest* navigation_request = |
| 237 root->navigator())->GetNavigationRequestForNodeForTesting(root); | 239 static_cast<NavigatorImpl*>(root->navigator()) |
| 240 ->GetNavigationRequestForNodeForTesting( |
| 241 root->frame_tree_node_id()); |
| 238 CHECK(navigation_request); | 242 CHECK(navigation_request); |
| 239 return navigation_request->common_params().url; | 243 return navigation_request->common_params().url; |
| 240 } | 244 } |
| 241 const IPC::Message* message = | 245 const IPC::Message* message = |
| 242 process()->sink().GetFirstMessageMatching(FrameMsg_Navigate::ID); | 246 process()->sink().GetFirstMessageMatching(FrameMsg_Navigate::ID); |
| 243 CHECK(message); | 247 CHECK(message); |
| 244 Tuple<CommonNavigationParams, StartNavigationParams, | 248 Tuple<CommonNavigationParams, StartNavigationParams, |
| 245 RequestNavigationParams> nav_params; | 249 RequestNavigationParams> nav_params; |
| 246 FrameMsg_Navigate::Read(message, &nav_params); | 250 FrameMsg_Navigate::Read(message, &nav_params); |
| 247 return get<0>(nav_params).url; | 251 return get<0>(nav_params).url; |
| (...skipping 4345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4593 { | 4597 { |
| 4594 LoadCommittedDetails details; | 4598 LoadCommittedDetails details; |
| 4595 controller_impl().RendererDidNavigate(main_test_rfh(), params, &details); | 4599 controller_impl().RendererDidNavigate(main_test_rfh(), params, &details); |
| 4596 EXPECT_EQ(PAGE_TYPE_ERROR, | 4600 EXPECT_EQ(PAGE_TYPE_ERROR, |
| 4597 controller_impl().GetLastCommittedEntry()->GetPageType()); | 4601 controller_impl().GetLastCommittedEntry()->GetPageType()); |
| 4598 EXPECT_EQ(NAVIGATION_TYPE_IN_PAGE, details.type); | 4602 EXPECT_EQ(NAVIGATION_TYPE_IN_PAGE, details.type); |
| 4599 } | 4603 } |
| 4600 } | 4604 } |
| 4601 | 4605 |
| 4602 } // namespace content | 4606 } // namespace content |
| OLD | NEW |