| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 4345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4593 { | 4590 { |
| 4594 LoadCommittedDetails details; | 4591 LoadCommittedDetails details; |
| 4595 controller_impl().RendererDidNavigate(main_test_rfh(), params, &details); | 4592 controller_impl().RendererDidNavigate(main_test_rfh(), params, &details); |
| 4596 EXPECT_EQ(PAGE_TYPE_ERROR, | 4593 EXPECT_EQ(PAGE_TYPE_ERROR, |
| 4597 controller_impl().GetLastCommittedEntry()->GetPageType()); | 4594 controller_impl().GetLastCommittedEntry()->GetPageType()); |
| 4598 EXPECT_EQ(NAVIGATION_TYPE_IN_PAGE, details.type); | 4595 EXPECT_EQ(NAVIGATION_TYPE_IN_PAGE, details.type); |
| 4599 } | 4596 } |
| 4600 } | 4597 } |
| 4601 | 4598 |
| 4602 } // namespace content | 4599 } // namespace content |
| OLD | NEW |