OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/test/test_web_contents.h" | 5 #include "content/test/test_web_contents.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "content/browser/browser_url_handler_impl.h" | 9 #include "content/browser/browser_url_handler_impl.h" |
10 #include "content/browser/frame_host/navigation_entry_impl.h" | 10 #include "content/browser/frame_host/navigation_entry_impl.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 rvh = static_cast<TestRenderViewHost*>(old_rvh); | 136 rvh = static_cast<TestRenderViewHost*>(old_rvh); |
137 | 137 |
138 const NavigationEntry* entry = GetController().GetPendingEntry(); | 138 const NavigationEntry* entry = GetController().GetPendingEntry(); |
139 DCHECK(entry); | 139 DCHECK(entry); |
140 int page_id = entry->GetPageID(); | 140 int page_id = entry->GetPageID(); |
141 if (page_id == -1) { | 141 if (page_id == -1) { |
142 // It's a new navigation, assign a never-seen page id to it. | 142 // It's a new navigation, assign a never-seen page id to it. |
143 page_id = GetMaxPageIDForSiteInstance(rvh->GetSiteInstance()) + 1; | 143 page_id = GetMaxPageIDForSiteInstance(rvh->GetSiteInstance()) + 1; |
144 } | 144 } |
145 | 145 |
146 // Simulate the SwapOut_ACK that happens when we swap out the old | 146 rvh->SendNavigate(page_id, entry->GetURL()); |
147 // RVH, before the navigation commits. This is needed when | 147 // Simulate the SwapOut_ACK. This is needed when cross-site navigation happens |
148 // cross-site navigation happens (old_rvh != rvh). | 148 // (old_rvh != rvh). |
149 if (old_rvh != rvh) | 149 if (old_rvh != rvh) |
150 static_cast<RenderViewHostImpl*>(old_rvh)->OnSwappedOut(false); | 150 static_cast<RenderViewHostImpl*>(old_rvh)->OnSwappedOut(false); |
151 rvh->SendNavigate(page_id, entry->GetURL()); | |
152 } | 151 } |
153 | 152 |
154 void TestWebContents::ProceedWithCrossSiteNavigation() { | 153 void TestWebContents::ProceedWithCrossSiteNavigation() { |
155 if (!GetPendingRenderViewHost()) | 154 if (!GetPendingRenderViewHost()) |
156 return; | 155 return; |
157 TestRenderViewHost* rvh = static_cast<TestRenderViewHost*>( | 156 TestRenderViewHost* rvh = static_cast<TestRenderViewHost*>( |
158 GetRenderViewHost()); | 157 GetRenderViewHost()); |
159 rvh->SendShouldCloseACK(true); | 158 rvh->SendShouldCloseACK(true); |
160 } | 159 } |
161 | 160 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 } | 241 } |
243 | 242 |
244 void TestWebContents::ShowCreatedWidget(int route_id, | 243 void TestWebContents::ShowCreatedWidget(int route_id, |
245 const gfx::Rect& initial_pos) { | 244 const gfx::Rect& initial_pos) { |
246 } | 245 } |
247 | 246 |
248 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) { | 247 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) { |
249 } | 248 } |
250 | 249 |
251 } // namespace content | 250 } // namespace content |
OLD | NEW |