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