Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2051)

Unified Diff: chrome/test/base/browser_with_test_window_test.cc

Issue 8224023: Don't show URL for pending new navigations initiated by the renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add IsBrowserInitiated helper. Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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(

Powered by Google App Engine
This is Rietveld 408576698