Chromium Code Reviews| Index: chrome/test/base/browser_with_test_window_test.cc |
| diff --git a/chrome/test/base/browser_with_test_window_test.cc b/chrome/test/base/browser_with_test_window_test.cc |
| index 918ed011a36431902d4f6acc490a0cbb18bdbecc..632dfc1bd196bcf77e56f50f357b3a8098e484c7 100644 |
| --- a/chrome/test/base/browser_with_test_window_test.cc |
| +++ b/chrome/test/base/browser_with_test_window_test.cc |
| @@ -70,22 +70,44 @@ void BrowserWithTestWindowTest::CommitPendingLoad( |
| if (!controller->pending_entry()) |
| return; // Nothing to commit. |
| - TestRenderViewHost* test_rvh = |
| + TestRenderViewHost* old_rvh = |
| TestRenderViewHostForTab(controller->tab_contents()); |
| MockRenderProcessHost* mock_rph = static_cast<MockRenderProcessHost*>( |
| - test_rvh->process()); |
| + old_rvh->process()); |
| + |
| + TestRenderViewHost* pending_rvh = static_cast<TestRenderViewHost*>( |
| + controller->tab_contents()->render_manager_for_testing()-> |
| + pending_render_view_host()); |
| + if (pending_rvh) { |
| + // Simulate the ShouldClose_ACK that is received from the current renderer |
| + // for a cross-site navigation. |
| + DCHECK(old_rvh != pending_rvh); |
|
Paweł Hajdan Jr.
2011/10/11 22:26:18
nit: DCHECK_NE.
Charlie Reis
2011/10/12 21:55:56
Done.
|
| + old_rvh->SendShouldCloseACK(true); |
| + } |
| + // Commit on the pending_rvh, if one exists. |
| + TestRenderViewHost* test_rvh = pending_rvh ? pending_rvh : old_rvh; |
| // For new navigations, we need to send a larger page ID. For renavigations, |
| // we need to send the preexisting page ID. We can tell these apart because |
| // renavigations will have a pending_entry_index while new ones won't (they'll |
| // just have a standalong pending_entry that isn't in the list already). |
| if (controller->pending_entry_index() >= 0) { |
| - test_rvh->SendNavigate(controller->pending_entry()->page_id(), |
| - controller->pending_entry()->url()); |
| + test_rvh->SendNavigateWithTransition( |
| + controller->pending_entry()->page_id(), |
| + controller->pending_entry()->url(), |
| + controller->pending_entry()->transition_type()); |
| } else { |
| - test_rvh->SendNavigate(mock_rph->max_page_id() + 1, |
| - controller->pending_entry()->url()); |
| + test_rvh->SendNavigateWithTransition( |
| + mock_rph->max_page_id() + 1, |
| + controller->pending_entry()->url(), |
| + controller->pending_entry()->transition_type()); |
| + mock_rph->UpdateMaxPageID(mock_rph->max_page_id() + 1); |
| } |
| + |
| + // Simulate the SwapOut_ACK that fires if you commit a cross-site navigation |
| + // without making any network requests. |
| + if (pending_rvh) |
| + old_rvh->OnSwapOutACK(); |
| } |
| void BrowserWithTestWindowTest::NavigateAndCommit( |