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/cross_process_frame_connector.h" | 10 #include "content/browser/frame_host/cross_process_frame_connector.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 rvh = static_cast<TestRenderViewHost*>(old_rvh); | 144 rvh = static_cast<TestRenderViewHost*>(old_rvh); |
145 | 145 |
146 const NavigationEntry* entry = GetController().GetPendingEntry(); | 146 const NavigationEntry* entry = GetController().GetPendingEntry(); |
147 DCHECK(entry); | 147 DCHECK(entry); |
148 int page_id = entry->GetPageID(); | 148 int page_id = entry->GetPageID(); |
149 if (page_id == -1) { | 149 if (page_id == -1) { |
150 // It's a new navigation, assign a never-seen page id to it. | 150 // It's a new navigation, assign a never-seen page id to it. |
151 page_id = GetMaxPageIDForSiteInstance(rvh->GetSiteInstance()) + 1; | 151 page_id = GetMaxPageIDForSiteInstance(rvh->GetSiteInstance()) + 1; |
152 } | 152 } |
153 | 153 |
154 // Simulate the SwapOut_ACK that happens when we swap out the old | 154 rvh->SendNavigate(page_id, entry->GetURL()); |
155 // RVH, before the navigation commits. This is needed when | 155 // Simulate the SwapOut_ACK. This is needed when cross-site navigation happens |
156 // cross-site navigation happens (old_rvh != rvh). | 156 // (old_rvh != rvh). |
157 if (old_rvh != rvh) | 157 if (old_rvh != rvh) |
158 static_cast<RenderViewHostImpl*>(old_rvh)->OnSwappedOut(false); | 158 static_cast<RenderViewHostImpl*>(old_rvh)->OnSwappedOut(false); |
159 rvh->SendNavigate(page_id, entry->GetURL()); | |
160 } | 159 } |
161 | 160 |
162 void TestWebContents::ProceedWithCrossSiteNavigation() { | 161 void TestWebContents::ProceedWithCrossSiteNavigation() { |
163 if (!GetPendingRenderViewHost()) | 162 if (!GetPendingRenderViewHost()) |
164 return; | 163 return; |
165 TestRenderViewHost* rvh = static_cast<TestRenderViewHost*>( | 164 TestRenderViewHost* rvh = static_cast<TestRenderViewHost*>( |
166 GetRenderViewHost()); | 165 GetRenderViewHost()); |
167 rvh->SendShouldCloseACK(true); | 166 rvh->SendShouldCloseACK(true); |
168 } | 167 } |
169 | 168 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 } | 248 } |
250 | 249 |
251 void TestWebContents::ShowCreatedWidget(int route_id, | 250 void TestWebContents::ShowCreatedWidget(int route_id, |
252 const gfx::Rect& initial_pos) { | 251 const gfx::Rect& initial_pos) { |
253 } | 252 } |
254 | 253 |
255 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) { | 254 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) { |
256 } | 255 } |
257 | 256 |
258 } // namespace content | 257 } // namespace content |
OLD | NEW |