OLD | NEW |
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/macros.h" | 6 #include "base/macros.h" |
7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
8 #include "content/browser/frame_host/navigation_controller_impl.h" | 8 #include "content/browser/frame_host/navigation_controller_impl.h" |
9 #include "content/browser/frame_host/navigation_entry_impl.h" | 9 #include "content/browser/frame_host/navigation_entry_impl.h" |
10 #include "content/browser/frame_host/navigation_request.h" | 10 #include "content/browser/frame_host/navigation_request.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // flag kEnableBrowserSideNavigation. | 126 // flag kEnableBrowserSideNavigation. |
127 TEST_F(NavigatorTestWithBrowserSideNavigation, BeginNavigation) { | 127 TEST_F(NavigatorTestWithBrowserSideNavigation, BeginNavigation) { |
128 const GURL kUrl1("http://www.google.com/"); | 128 const GURL kUrl1("http://www.google.com/"); |
129 const GURL kUrl2("http://www.chromium.org/"); | 129 const GURL kUrl2("http://www.chromium.org/"); |
130 const GURL kUrl3("http://www.gmail.com/"); | 130 const GURL kUrl3("http://www.gmail.com/"); |
131 | 131 |
132 contents()->NavigateAndCommit(kUrl1); | 132 contents()->NavigateAndCommit(kUrl1); |
133 | 133 |
134 // Add a subframe. | 134 // Add a subframe. |
135 FrameTreeNode* root_node = contents()->GetFrameTree()->root(); | 135 FrameTreeNode* root_node = contents()->GetFrameTree()->root(); |
136 TestRenderFrameHost* subframe_rfh = | 136 TestRenderFrameHost* subframe_rfh = main_test_rfh()->AppendChild("Child"); |
137 static_cast<TestRenderFrameHost*>(contents()->GetFrameTree()->AddFrame( | |
138 root_node, root_node->current_frame_host()->GetProcess()->GetID(), 14, | |
139 "Child")); | |
140 ASSERT_TRUE(subframe_rfh); | 137 ASSERT_TRUE(subframe_rfh); |
141 | 138 |
142 FrameTreeNode* subframe_node = subframe_rfh->frame_tree_node(); | 139 FrameTreeNode* subframe_node = subframe_rfh->frame_tree_node(); |
143 SendRequestNavigation(subframe_node, kUrl2); | 140 SendRequestNavigation(subframe_node, kUrl2); |
144 // There is no previous renderer in the subframe, so BeginNavigation is | 141 // There is no previous renderer in the subframe, so BeginNavigation is |
145 // handled already. | 142 // handled already. |
146 NavigationRequest* subframe_request = | 143 NavigationRequest* subframe_request = |
147 GetNavigationRequestForFrameTreeNode(subframe_node); | 144 GetNavigationRequestForFrameTreeNode(subframe_node); |
148 TestNavigationURLLoader* subframe_loader = | 145 TestNavigationURLLoader* subframe_loader = |
149 GetLoaderForNavigationRequest(subframe_request); | 146 GetLoaderForNavigationRequest(subframe_request); |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 EXPECT_TRUE(DidRenderFrameHostRequestCommit(rfh1)); | 634 EXPECT_TRUE(DidRenderFrameHostRequestCommit(rfh1)); |
638 EXPECT_FALSE(DidRenderFrameHostRequestCommit(main_test_rfh())); | 635 EXPECT_FALSE(DidRenderFrameHostRequestCommit(main_test_rfh())); |
639 | 636 |
640 rfh1->SendNavigate(1, kUrl1); | 637 rfh1->SendNavigate(1, kUrl1); |
641 EXPECT_EQ(rfh1, main_test_rfh()); | 638 EXPECT_EQ(rfh1, main_test_rfh()); |
642 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); | 639 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); |
643 EXPECT_FALSE(rfhm->IsOnSwappedOutList(rfh1)); | 640 EXPECT_FALSE(rfhm->IsOnSwappedOutList(rfh1)); |
644 } | 641 } |
645 | 642 |
646 } // namespace content | 643 } // namespace content |
OLD | NEW |