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