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

Unified Diff: content/browser/web_contents/web_contents_impl_unittest.cc

Issue 1002803002: Classify navigations without page id in parallel to the existing classifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: greeeeeeen Created 5 years, 8 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: content/browser/web_contents/web_contents_impl_unittest.cc
diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc
index 32f102dfbdf6e5f0414c9aeaf0030037c9590328..82f956c56695c218386590a3cf9eb7e9a90c9614 100644
--- a/content/browser/web_contents/web_contents_impl_unittest.cc
+++ b/content/browser/web_contents/web_contents_impl_unittest.cc
@@ -159,9 +159,13 @@ class TestInterstitialPage : public InterstitialPageImpl {
CommandReceived();
}
- void TestDidNavigate(int page_id, const GURL& url) {
+ void TestDidNavigate(int page_id,
+ int nav_entry_id,
+ bool did_create_new_entry,
+ const GURL& url) {
FrameHostMsg_DidCommitProvisionalLoad_Params params;
- InitNavigateParams(&params, page_id, url, ui::PAGE_TRANSITION_TYPED);
+ InitNavigateParams(&params, page_id, nav_entry_id, did_create_new_entry,
+ url, ui::PAGE_TRANSITION_TYPED);
DidNavigate(GetMainFrame()->GetRenderViewHost(), params);
}
@@ -350,8 +354,8 @@ TEST_F(WebContentsImplTest, UpdateTitle) {
NavigationControllerImpl& cont =
static_cast<NavigationControllerImpl&>(controller());
FrameHostMsg_DidCommitProvisionalLoad_Params params;
- InitNavigateParams(
- &params, 0, GURL(url::kAboutBlankURL), ui::PAGE_TRANSITION_TYPED);
+ InitNavigateParams(&params, 0, 0, true, GURL(url::kAboutBlankURL),
+ ui::PAGE_TRANSITION_TYPED);
LoadCommittedDetails details;
cont.RendererDidNavigate(contents()->GetMainFrame(), params, &details);
@@ -393,13 +397,15 @@ TEST_F(WebContentsImplTest, NTPViewSource) {
cont.LoadURL(
kGURL, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ int entry_id = cont.GetPendingEntry()->GetUniqueID();
rvh()->GetDelegate()->RenderViewCreated(rvh());
// Did we get the expected message?
EXPECT_TRUE(process()->sink().GetFirstMessageMatching(
ViewMsg_EnableViewSourceMode::ID));
FrameHostMsg_DidCommitProvisionalLoad_Params params;
- InitNavigateParams(&params, 0, kGURL, ui::PAGE_TRANSITION_TYPED);
+ InitNavigateParams(&params, 0, entry_id, true, kGURL,
+ ui::PAGE_TRANSITION_TYPED);
LoadCommittedDetails details;
cont.RendererDidNavigate(contents()->GetMainFrame(), params, &details);
// Also check title and url.
@@ -439,6 +445,7 @@ TEST_F(WebContentsImplTest, SimpleNavigation) {
const GURL url("http://www.google.com");
controller().LoadURL(
url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ int entry_id = controller().GetPendingEntry()->GetUniqueID();
EXPECT_FALSE(contents()->cross_navigation_pending());
EXPECT_EQ(instance1, orig_rfh->GetSiteInstance());
// Controller's pending entry will have a null site instance until we assign
@@ -449,7 +456,8 @@ TEST_F(WebContentsImplTest, SimpleNavigation) {
site_instance());
// DidNavigate from the page
- contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(orig_rfh, 1, entry_id, true, url,
+ ui::PAGE_TRANSITION_TYPED);
EXPECT_FALSE(contents()->cross_navigation_pending());
EXPECT_EQ(orig_rfh, contents()->GetMainFrame());
EXPECT_EQ(instance1, orig_rfh->GetSiteInstance());
@@ -484,8 +492,10 @@ TEST_F(WebContentsImplTest, CrossSiteBoundaries) {
const GURL url("http://www.google.com");
controller().LoadURL(
url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ int entry_id = controller().GetPendingEntry()->GetUniqueID();
orig_rfh->PrepareForCommit();
- contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(orig_rfh, 1, entry_id, true, url,
+ ui::PAGE_TRANSITION_TYPED);
// Keep the number of active frames in orig_rfh's SiteInstance non-zero so
// that orig_rfh doesn't get deleted when it gets swapped out.
@@ -500,6 +510,7 @@ TEST_F(WebContentsImplTest, CrossSiteBoundaries) {
const GURL url2("http://www.yahoo.com");
controller().LoadURL(
url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ entry_id = controller().GetPendingEntry()->GetUniqueID();
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableBrowserSideNavigation)) {
orig_rfh->PrepareForCommit();
@@ -521,8 +532,8 @@ TEST_F(WebContentsImplTest, CrossSiteBoundaries) {
}
// DidNavigate from the pending page
- contents()->TestDidNavigate(
- pending_rfh, 1, url2, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(pending_rfh, 1, entry_id, true, url2,
+ ui::PAGE_TRANSITION_TYPED);
SiteInstance* instance2 = contents()->GetSiteInstance();
// Keep the number of active frames in pending_rfh's SiteInstance
@@ -545,6 +556,7 @@ TEST_F(WebContentsImplTest, CrossSiteBoundaries) {
// stored in the NavigationEntry, so it should be the same as at the start.
// We should use the same RFH as before, swapping it back in.
controller().GoBack();
+ entry_id = controller().GetPendingEntry()->GetUniqueID();
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableBrowserSideNavigation)) {
contents()->GetMainFrame()->PrepareForCommit();
@@ -562,7 +574,8 @@ TEST_F(WebContentsImplTest, CrossSiteBoundaries) {
}
// DidNavigate from the back action
- contents()->TestDidNavigate(goback_rfh, 1, url2, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(goback_rfh, 1, entry_id, false, url2,
+ ui::PAGE_TRANSITION_TYPED);
EXPECT_FALSE(contents()->cross_navigation_pending());
EXPECT_EQ(goback_rfh, contents()->GetMainFrame());
EXPECT_EQ(instance1, contents()->GetSiteInstance());
@@ -591,8 +604,10 @@ TEST_F(WebContentsImplTest, CrossSiteBoundariesAfterCrash) {
const GURL url("http://www.google.com");
controller().LoadURL(
url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ int entry_id = controller().GetPendingEntry()->GetUniqueID();
contents()->GetMainFrame()->PrepareForCommit();
- contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(orig_rfh, 1, entry_id, true, url,
+ ui::PAGE_TRANSITION_TYPED);
EXPECT_FALSE(contents()->cross_navigation_pending());
EXPECT_EQ(orig_rfh->GetRenderViewHost(), contents()->GetRenderViewHost());
@@ -605,6 +620,7 @@ TEST_F(WebContentsImplTest, CrossSiteBoundariesAfterCrash) {
const GURL url2("http://www.yahoo.com");
controller().LoadURL(
url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ entry_id = controller().GetPendingEntry()->GetUniqueID();
contents()->GetMainFrame()->PrepareForCommit();
TestRenderFrameHost* new_rfh = contents()->GetMainFrame();
EXPECT_FALSE(contents()->cross_navigation_pending());
@@ -613,7 +629,8 @@ TEST_F(WebContentsImplTest, CrossSiteBoundariesAfterCrash) {
EXPECT_EQ(orig_rvh_delete_count, 1);
// DidNavigate from the new page
- contents()->TestDidNavigate(new_rfh, 1, url2, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(new_rfh, 1, entry_id, true, url2,
+ ui::PAGE_TRANSITION_TYPED);
SiteInstance* instance2 = contents()->GetSiteInstance();
EXPECT_FALSE(contents()->cross_navigation_pending());
@@ -637,8 +654,10 @@ TEST_F(WebContentsImplTest, NavigateTwoTabsCrossSite) {
const GURL url("http://www.google.com");
controller().LoadURL(
url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ int entry_id = controller().GetPendingEntry()->GetUniqueID();
contents()->GetMainFrame()->PrepareForCommit();
- contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(orig_rfh, 1, entry_id, true, url,
+ ui::PAGE_TRANSITION_TYPED);
// Open a new contents with the same SiteInstance, navigated to the same site.
scoped_ptr<TestWebContents> contents2(
@@ -646,20 +665,22 @@ TEST_F(WebContentsImplTest, NavigateTwoTabsCrossSite) {
contents2->GetController().LoadURL(url, Referrer(),
ui::PAGE_TRANSITION_TYPED,
std::string());
+ entry_id = contents2->GetController().GetPendingEntry()->GetUniqueID();
contents2->GetMainFrame()->PrepareForCommit();
// Need this page id to be 2 since the site instance is the same (which is the
// scope of page IDs) and we want to consider this a new page.
- contents2->TestDidNavigate(
- contents2->GetMainFrame(), 2, url, ui::PAGE_TRANSITION_TYPED);
+ contents2->TestDidNavigate(contents2->GetMainFrame(), 2, entry_id, true, url,
+ ui::PAGE_TRANSITION_TYPED);
// Navigate first contents to a new site.
const GURL url2a("http://www.yahoo.com");
controller().LoadURL(
url2a, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ entry_id = controller().GetPendingEntry()->GetUniqueID();
orig_rfh->PrepareForCommit();
TestRenderFrameHost* pending_rfh_a = contents()->GetPendingMainFrame();
- contents()->TestDidNavigate(
- pending_rfh_a, 1, url2a, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(pending_rfh_a, 1, entry_id, true, url2a,
+ ui::PAGE_TRANSITION_TYPED);
SiteInstance* instance2a = contents()->GetSiteInstance();
EXPECT_NE(instance1, instance2a);
@@ -668,6 +689,7 @@ TEST_F(WebContentsImplTest, NavigateTwoTabsCrossSite) {
contents2->GetController().LoadURL(url2b, Referrer(),
ui::PAGE_TRANSITION_TYPED,
std::string());
+ entry_id = contents2->GetController().GetPendingEntry()->GetUniqueID();
TestRenderFrameHost* rfh2 = contents2->GetMainFrame();
rfh2->PrepareForCommit();
TestRenderFrameHost* pending_rfh_b = contents2->GetPendingMainFrame();
@@ -677,8 +699,8 @@ TEST_F(WebContentsImplTest, NavigateTwoTabsCrossSite) {
// NOTE(creis): We used to be in danger of showing a crash page here if the
// second contents hadn't navigated somewhere first (bug 1145430). That case
// is now covered by the CrossSiteBoundariesAfterCrash test.
- contents2->TestDidNavigate(
- pending_rfh_b, 2, url2b, ui::PAGE_TRANSITION_TYPED);
+ contents2->TestDidNavigate(pending_rfh_b, 2, entry_id, true, url2b,
+ ui::PAGE_TRANSITION_TYPED);
SiteInstance* instance2b = contents2->GetSiteInstance();
EXPECT_NE(instance1, instance2b);
@@ -704,9 +726,10 @@ TEST_F(WebContentsImplTest, NavigateFromSitelessUrl) {
const GURL native_url("non-site-url://stuffandthings");
controller().LoadURL(
native_url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ int entry_id = controller().GetPendingEntry()->GetUniqueID();
contents()->GetMainFrame()->PrepareForCommit();
- contents()->TestDidNavigate(
- orig_rfh, 1, native_url, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(orig_rfh, 1, entry_id, true, native_url,
+ ui::PAGE_TRANSITION_TYPED);
EXPECT_FALSE(contents()->cross_navigation_pending());
EXPECT_EQ(orig_rfh, contents()->GetMainFrame());
@@ -721,12 +744,14 @@ TEST_F(WebContentsImplTest, NavigateFromSitelessUrl) {
const GURL url("http://www.google.com");
controller().LoadURL(
url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ entry_id = controller().GetPendingEntry()->GetUniqueID();
contents()->GetMainFrame()->PrepareForCommit();
EXPECT_FALSE(contents()->cross_navigation_pending());
EXPECT_EQ(native_url, contents()->GetLastCommittedURL());
EXPECT_EQ(url, contents()->GetVisibleURL());
EXPECT_FALSE(contents()->GetPendingMainFrame());
- contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(orig_rfh, 2, entry_id, true, url,
+ ui::PAGE_TRANSITION_TYPED);
// Keep the number of active frames in orig_rfh's SiteInstance
// non-zero so that orig_rfh doesn't get deleted when it gets
@@ -742,6 +767,7 @@ TEST_F(WebContentsImplTest, NavigateFromSitelessUrl) {
const GURL url2("http://www.yahoo.com");
controller().LoadURL(
url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ entry_id = controller().GetPendingEntry()->GetUniqueID();
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableBrowserSideNavigation)) {
orig_rfh->PrepareForCommit();
@@ -763,8 +789,8 @@ TEST_F(WebContentsImplTest, NavigateFromSitelessUrl) {
}
// DidNavigate from the pending page.
- contents()->TestDidNavigate(
- pending_rfh, 1, url2, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(pending_rfh, 1, entry_id, true, url2,
+ ui::PAGE_TRANSITION_TYPED);
SiteInstance* new_instance = contents()->GetSiteInstance();
EXPECT_FALSE(contents()->cross_navigation_pending());
@@ -811,8 +837,9 @@ TEST_F(WebContentsImplTest, NavigateFromRestoredSitelessUrl) {
ASSERT_EQ(0u, entries.size());
ASSERT_EQ(1, controller().GetEntryCount());
controller().GoToIndex(0);
- contents()->TestDidNavigate(
- orig_rfh, 0, native_url, ui::PAGE_TRANSITION_RELOAD);
+ entry = controller().GetPendingEntry();
+ contents()->TestDidNavigate(orig_rfh, 0, entry->GetUniqueID(), false,
+ native_url, ui::PAGE_TRANSITION_RELOAD);
EXPECT_EQ(orig_instance, contents()->GetSiteInstance());
EXPECT_EQ(GURL(), contents()->GetSiteInstance()->GetSiteURL());
EXPECT_FALSE(orig_instance->HasSite());
@@ -822,7 +849,9 @@ TEST_F(WebContentsImplTest, NavigateFromRestoredSitelessUrl) {
const GURL url("http://www.google.com");
controller().LoadURL(
url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
- contents()->TestDidNavigate(orig_rfh, 2, url, ui::PAGE_TRANSITION_TYPED);
+ entry = controller().GetPendingEntry();
+ contents()->TestDidNavigate(orig_rfh, 2, entry->GetUniqueID(), true, url,
+ ui::PAGE_TRANSITION_TYPED);
EXPECT_EQ(orig_instance, contents()->GetSiteInstance());
// Cleanup.
@@ -854,9 +883,10 @@ TEST_F(WebContentsImplTest, NavigateFromRestoredRegularUrl) {
ASSERT_EQ(0u, entries.size());
ASSERT_EQ(1, controller().GetEntryCount());
controller().GoToIndex(0);
+ entry = controller().GetPendingEntry();
orig_rfh->PrepareForCommit();
- contents()->TestDidNavigate(
- orig_rfh, 0, regular_url, ui::PAGE_TRANSITION_RELOAD);
+ contents()->TestDidNavigate(orig_rfh, 0, entry->GetUniqueID(), false,
+ regular_url, ui::PAGE_TRANSITION_RELOAD);
EXPECT_EQ(orig_instance, contents()->GetSiteInstance());
EXPECT_TRUE(orig_instance->HasSite());
@@ -864,9 +894,11 @@ TEST_F(WebContentsImplTest, NavigateFromRestoredRegularUrl) {
const GURL url("http://www.google.com");
controller().LoadURL(
url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ entry = controller().GetPendingEntry();
orig_rfh->PrepareForCommit();
- contents()->TestDidNavigate(
- contents()->GetPendingMainFrame(), 2, url, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(contents()->GetPendingMainFrame(), 2,
+ entry->GetUniqueID(), true, url,
+ ui::PAGE_TRANSITION_TYPED);
EXPECT_NE(orig_instance, contents()->GetSiteInstance());
// Cleanup.
@@ -882,8 +914,10 @@ TEST_F(WebContentsImplTest, FindOpenerRVHWhenPending) {
const GURL url("http://www.google.com");
controller().LoadURL(
url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ int entry_id = controller().GetPendingEntry()->GetUniqueID();
orig_rfh->PrepareForCommit();
- contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(orig_rfh, 1, entry_id, true, url,
+ ui::PAGE_TRANSITION_TYPED);
// Start to navigate first tab to a new site, so that it has a pending RVH.
const GURL url2("http://www.yahoo.com");
@@ -913,9 +947,10 @@ TEST_F(WebContentsImplTest, CrossSiteComparesAgainstCurrentPage) {
const GURL url("http://www.google.com");
controller().LoadURL(
url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ int entry_id = controller().GetPendingEntry()->GetUniqueID();
contents()->GetMainFrame()->PrepareForCommit();
- contents()->TestDidNavigate(
- orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(orig_rfh, 1, entry_id, true, url,
+ ui::PAGE_TRANSITION_TYPED);
// Open a related contents to a second site.
scoped_ptr<TestWebContents> contents2(
@@ -924,20 +959,23 @@ TEST_F(WebContentsImplTest, CrossSiteComparesAgainstCurrentPage) {
contents2->GetController().LoadURL(url2, Referrer(),
ui::PAGE_TRANSITION_TYPED,
std::string());
+ entry_id = contents2->GetController().GetPendingEntry()->GetUniqueID();
contents2->GetMainFrame()->PrepareForCommit();
+
// The first RVH in contents2 isn't live yet, so we shortcut the cross site
// pending.
TestRenderFrameHost* rfh2 = contents2->GetMainFrame();
EXPECT_FALSE(contents2->cross_navigation_pending());
- contents2->TestDidNavigate(rfh2, 2, url2, ui::PAGE_TRANSITION_TYPED);
+ contents2->TestDidNavigate(rfh2, 2, entry_id, true, url2,
+ ui::PAGE_TRANSITION_TYPED);
SiteInstance* instance2 = contents2->GetSiteInstance();
EXPECT_NE(instance1, instance2);
EXPECT_FALSE(contents2->cross_navigation_pending());
// Simulate a link click in first contents to second site. Doesn't switch
- // SiteInstances, because we don't intercept WebKit navigations.
- contents()->TestDidNavigate(
- orig_rfh, 2, url2, ui::PAGE_TRANSITION_TYPED);
+ // SiteInstances, because we don't intercept Blink navigations.
+ contents()->TestDidNavigate(orig_rfh, 2, 0, true, url2,
+ ui::PAGE_TRANSITION_TYPED);
SiteInstance* instance3 = contents()->GetSiteInstance();
EXPECT_EQ(instance1, instance3);
EXPECT_FALSE(contents()->cross_navigation_pending());
@@ -947,10 +985,11 @@ TEST_F(WebContentsImplTest, CrossSiteComparesAgainstCurrentPage) {
const GURL url3("http://mail.yahoo.com");
controller().LoadURL(
url3, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ entry_id = controller().GetPendingEntry()->GetUniqueID();
EXPECT_FALSE(contents()->cross_navigation_pending());
contents()->GetMainFrame()->PrepareForCommit();
- contents()->TestDidNavigate(
- orig_rfh, 3, url3, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(orig_rfh, 3, entry_id, true, url3,
+ ui::PAGE_TRANSITION_TYPED);
SiteInstance* instance4 = contents()->GetSiteInstance();
EXPECT_EQ(instance1, instance4);
}
@@ -965,8 +1004,10 @@ TEST_F(WebContentsImplTest, CrossSiteUnloadHandlers) {
const GURL url("http://www.google.com");
controller().LoadURL(
url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ int entry_id = controller().GetPendingEntry()->GetUniqueID();
contents()->GetMainFrame()->PrepareForCommit();
- contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(orig_rfh, 1, entry_id, true, url,
+ ui::PAGE_TRANSITION_TYPED);
EXPECT_FALSE(contents()->cross_navigation_pending());
EXPECT_EQ(orig_rfh, contents()->GetMainFrame());
@@ -985,6 +1026,7 @@ TEST_F(WebContentsImplTest, CrossSiteUnloadHandlers) {
// Navigate again, but simulate an onbeforeunload approval.
controller().LoadURL(
url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ entry_id = controller().GetPendingEntry()->GetUniqueID();
EXPECT_TRUE(orig_rfh->IsWaitingForBeforeUnloadACK());
now = base::TimeTicks::Now();
orig_rfh->PrepareForCommit();
@@ -995,8 +1037,8 @@ TEST_F(WebContentsImplTest, CrossSiteUnloadHandlers) {
// We won't hear DidNavigate until the onunload handler has finished running.
// DidNavigate from the pending page.
- contents()->TestDidNavigate(
- pending_rfh, 1, url2, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(pending_rfh, 1, entry_id, true, url2,
+ ui::PAGE_TRANSITION_TYPED);
SiteInstance* instance2 = contents()->GetSiteInstance();
EXPECT_FALSE(contents()->cross_navigation_pending());
EXPECT_EQ(pending_rfh, contents()->GetMainFrame());
@@ -1015,8 +1057,10 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationPreempted) {
const GURL url("http://www.google.com");
controller().LoadURL(
url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ int entry_id = controller().GetPendingEntry()->GetUniqueID();
contents()->GetMainFrame()->PrepareForCommit();
- contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(orig_rfh, 1, entry_id, true, url,
+ ui::PAGE_TRANSITION_TYPED);
EXPECT_FALSE(contents()->cross_navigation_pending());
EXPECT_EQ(orig_rfh, contents()->GetMainFrame());
@@ -1029,7 +1073,7 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationPreempted) {
EXPECT_TRUE(contents()->cross_navigation_pending());
// Suppose the original renderer navigates before the new one is ready.
- orig_rfh->SendNavigate(2, GURL("http://www.google.com/foo"));
+ orig_rfh->SendNavigate(2, 0, true, GURL("http://www.google.com/foo"));
// Verify that the pending navigation is cancelled.
EXPECT_FALSE(orig_rfh->IsWaitingForBeforeUnloadACK());
@@ -1045,9 +1089,11 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationBackPreempted) {
const GURL url1("chrome://blah");
controller().LoadURL(
url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ int entry_id = controller().GetPendingEntry()->GetUniqueID();
TestRenderFrameHost* ntp_rfh = contents()->GetMainFrame();
ntp_rfh->PrepareForCommit();
- contents()->TestDidNavigate(ntp_rfh, 1, url1, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(ntp_rfh, 1, entry_id, true, url1,
+ ui::PAGE_TRANSITION_TYPED);
NavigationEntry* entry1 = controller().GetLastCommittedEntry();
SiteInstance* instance1 = contents()->GetSiteInstance();
@@ -1063,6 +1109,7 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationBackPreempted) {
const GURL url2("http://www.google.com");
controller().LoadURL(
url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ entry_id = controller().GetPendingEntry()->GetUniqueID();
EXPECT_TRUE(contents()->cross_navigation_pending());
TestRenderFrameHost* google_rfh = contents()->GetPendingMainFrame();
@@ -1072,8 +1119,8 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationBackPreempted) {
ntp_rfh->PrepareForCommit();
// DidNavigate from the pending page.
- contents()->TestDidNavigate(
- google_rfh, 1, url2, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(google_rfh, 1, entry_id, true, url2,
+ ui::PAGE_TRANSITION_TYPED);
NavigationEntry* entry2 = controller().GetLastCommittedEntry();
SiteInstance* instance2 = contents()->GetSiteInstance();
@@ -1091,10 +1138,11 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationBackPreempted) {
const GURL url3("http://news.google.com");
controller().LoadURL(
url3, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ entry_id = controller().GetPendingEntry()->GetUniqueID();
EXPECT_FALSE(contents()->cross_navigation_pending());
contents()->GetMainFrame()->PrepareForCommit();
- contents()->TestDidNavigate(
- google_rfh, 2, url3, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(google_rfh, 2, entry_id, true, url3,
+ ui::PAGE_TRANSITION_TYPED);
NavigationEntry* entry3 = controller().GetLastCommittedEntry();
SiteInstance* instance3 = contents()->GetSiteInstance();
@@ -1108,6 +1156,7 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationBackPreempted) {
// Go back within the site.
controller().GoBack();
+ NavigationEntry* goback_entry = controller().GetPendingEntry();
EXPECT_FALSE(contents()->cross_navigation_pending());
EXPECT_EQ(entry2, controller().GetPendingEntry());
@@ -1125,7 +1174,8 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationBackPreempted) {
FrameHostMsg_BeforeUnload_ACK(0, true, now, now));
// DidNavigate from the first back. This aborts the second back's pending RFH.
- contents()->TestDidNavigate(google_rfh, 1, url2, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(google_rfh, 1, goback_entry->GetUniqueID(), false,
+ url2, ui::PAGE_TRANSITION_TYPED);
// We should commit this page and forget about the second back.
EXPECT_FALSE(contents()->cross_navigation_pending());
@@ -1152,8 +1202,10 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationNotPreemptedByFrame) {
const GURL url("http://www.google.com");
controller().LoadURL(
url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ int entry_id = controller().GetPendingEntry()->GetUniqueID();
contents()->GetMainFrame()->PrepareForCommit();
- contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(orig_rfh, 1, entry_id, true, url,
+ ui::PAGE_TRANSITION_TYPED);
EXPECT_FALSE(contents()->cross_navigation_pending());
EXPECT_EQ(orig_rfh, contents()->GetMainFrame());
@@ -1165,8 +1217,9 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationNotPreemptedByFrame) {
// Simulate a sub-frame navigation arriving and ensure the RVH is still
// waiting for a before unload response.
TestRenderFrameHost* child_rfh = orig_rfh->AppendChild("subframe");
- child_rfh->SendNavigateWithTransition(
- 1, GURL("http://google.com/frame"), ui::PAGE_TRANSITION_AUTO_SUBFRAME);
+ child_rfh->SendNavigateWithTransition(1, 0, false,
+ GURL("http://google.com/frame"),
+ ui::PAGE_TRANSITION_AUTO_SUBFRAME);
EXPECT_TRUE(orig_rfh->IsWaitingForBeforeUnloadACK());
// Now simulate the onbeforeunload approval and verify the navigation is
@@ -1185,6 +1238,7 @@ TEST_F(WebContentsImplTest, CrossSiteNotPreemptedDuringBeforeUnload) {
const GURL url("chrome://blah");
controller().LoadURL(
url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ int entry1_id = controller().GetPendingEntry()->GetUniqueID();
TestRenderFrameHost* orig_rfh = contents()->GetMainFrame();
EXPECT_FALSE(contents()->cross_navigation_pending());
@@ -1192,6 +1246,7 @@ TEST_F(WebContentsImplTest, CrossSiteNotPreemptedDuringBeforeUnload) {
const GURL url2("http://www.yahoo.com");
controller().LoadURL(
url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ int entry2_id = controller().GetPendingEntry()->GetUniqueID();
TestRenderFrameHost* pending_rfh = contents()->GetPendingMainFrame();
EXPECT_TRUE(contents()->cross_navigation_pending());
EXPECT_TRUE(orig_rfh->IsWaitingForBeforeUnloadACK());
@@ -1199,13 +1254,14 @@ TEST_F(WebContentsImplTest, CrossSiteNotPreemptedDuringBeforeUnload) {
// Suppose the first navigation tries to commit now, with a
// FrameMsg_Stop in flight. This should not cancel the pending navigation,
// but it should act as if the beforeunload ack arrived.
- orig_rfh->SendNavigate(1, GURL("chrome://blah"));
+ orig_rfh->SendNavigate(1, entry1_id, true, GURL("chrome://blah"));
EXPECT_TRUE(contents()->cross_navigation_pending());
EXPECT_EQ(orig_rfh, contents()->GetMainFrame());
EXPECT_FALSE(orig_rfh->IsWaitingForBeforeUnloadACK());
// The pending navigation should be able to commit successfully.
- contents()->TestDidNavigate(pending_rfh, 1, url2, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(pending_rfh, 1, entry2_id, true, url2,
+ ui::PAGE_TRANSITION_TYPED);
EXPECT_FALSE(contents()->cross_navigation_pending());
EXPECT_EQ(pending_rfh, contents()->GetMainFrame());
}
@@ -1219,11 +1275,13 @@ TEST_F(WebContentsImplTest, NavigationEntryContentState) {
const GURL url("http://www.google.com");
controller().LoadURL(
url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ int entry_id = controller().GetPendingEntry()->GetUniqueID();
NavigationEntry* entry = controller().GetLastCommittedEntry();
EXPECT_EQ(nullptr, entry);
// Committed entry should have page state after DidNavigate.
- contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(orig_rfh, 1, entry_id, true, url,
+ ui::PAGE_TRANSITION_TYPED);
entry = controller().GetLastCommittedEntry();
EXPECT_TRUE(entry->GetPageState().IsValid());
@@ -1231,17 +1289,21 @@ TEST_F(WebContentsImplTest, NavigationEntryContentState) {
const GURL url2("http://images.google.com");
controller().LoadURL(
url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ entry_id = controller().GetPendingEntry()->GetUniqueID();
entry = controller().GetLastCommittedEntry();
EXPECT_TRUE(entry->GetPageState().IsValid());
// Committed entry should have page state after DidNavigate.
- contents()->TestDidNavigate(orig_rfh, 2, url2, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(orig_rfh, 2, entry_id, true, url2,
+ ui::PAGE_TRANSITION_TYPED);
entry = controller().GetLastCommittedEntry();
EXPECT_TRUE(entry->GetPageState().IsValid());
// Now go back. Committed entry should still have page state.
controller().GoBack();
- contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED);
+ entry_id = controller().GetPendingEntry()->GetUniqueID();
+ contents()->TestDidNavigate(orig_rfh, 1, entry_id, false, url,
+ ui::PAGE_TRANSITION_TYPED);
entry = controller().GetLastCommittedEntry();
EXPECT_TRUE(entry->GetPageState().IsValid());
}
@@ -1252,11 +1314,10 @@ TEST_F(WebContentsImplTest, NavigationEntryContentState) {
TEST_F(WebContentsImplTest, NavigationEntryContentStateNewWindow) {
TestRenderFrameHost* orig_rfh = contents()->GetMainFrame();
- // When opening a new window, it is navigated to about:blank internally.
- // Currently, this results in two DidNavigate events.
+ // Navigate to about:blank.
const GURL url(url::kAboutBlankURL);
- contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED);
- contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(orig_rfh, 1, 0, true, url,
+ ui::PAGE_TRANSITION_TYPED);
// Should have a page state here.
NavigationEntry* entry = controller().GetLastCommittedEntry();
@@ -1272,9 +1333,11 @@ TEST_F(WebContentsImplTest, NavigationEntryContentStateNewWindow) {
const GURL new_url("http://www.google.com");
controller().LoadURL(new_url, Referrer(),
ui::PAGE_TRANSITION_TYPED, std::string());
+ entry = controller().GetPendingEntry();
EXPECT_FALSE(contents()->cross_navigation_pending());
EXPECT_EQ(orig_rfh, contents()->GetMainFrame());
- contents()->TestDidNavigate(orig_rfh, 1, new_url, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(orig_rfh, 2, entry->GetUniqueID(), true, new_url,
+ ui::PAGE_TRANSITION_TYPED);
NavigationEntryImpl* entry_impl2 = NavigationEntryImpl::FromNavigationEntry(
controller().GetLastCommittedEntry());
EXPECT_EQ(site_instance_id, entry_impl2->site_instance()->GetId());
@@ -1293,8 +1356,10 @@ TEST_F(WebContentsImplTest, NavigationExitsFullscreen) {
const GURL url("http://www.google.com");
controller().LoadURL(
url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ int entry_id = controller().GetPendingEntry()->GetUniqueID();
contents()->GetMainFrame()->PrepareForCommit();
- contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(orig_rfh, 1, entry_id, true, url,
+ ui::PAGE_TRANSITION_TYPED);
EXPECT_EQ(orig_rfh, contents()->GetMainFrame());
// Toggle fullscreen mode on (as if initiated via IPC from renderer).
@@ -1311,10 +1376,11 @@ TEST_F(WebContentsImplTest, NavigationExitsFullscreen) {
const GURL url2("http://www.yahoo.com");
controller().LoadURL(
url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ entry_id = controller().GetPendingEntry()->GetUniqueID();
contents()->GetMainFrame()->PrepareForCommit();
TestRenderFrameHost* const pending_rfh = contents()->GetPendingMainFrame();
- contents()->TestDidNavigate(
- pending_rfh, 1, url2, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(pending_rfh, 1, entry_id, true, url2,
+ ui::PAGE_TRANSITION_TYPED);
// Confirm fullscreen has exited.
EXPECT_FALSE(orig_rvh->IsFullscreen());
@@ -1336,15 +1402,19 @@ TEST_F(WebContentsImplTest, HistoryNavigationExitsFullscreen) {
const GURL url("http://www.google.com");
controller().LoadURL(
url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
- contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED);
+ int entry_id = controller().GetPendingEntry()->GetUniqueID();
+ contents()->TestDidNavigate(orig_rfh, 1, entry_id, true, url,
+ ui::PAGE_TRANSITION_TYPED);
EXPECT_EQ(orig_rfh, contents()->GetMainFrame());
// Now, navigate to another page on the same site.
const GURL url2("http://www.google.com/search?q=kittens");
controller().LoadURL(
url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ entry_id = controller().GetPendingEntry()->GetUniqueID();
EXPECT_FALSE(contents()->cross_navigation_pending());
- contents()->TestDidNavigate(orig_rfh, 2, url2, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(orig_rfh, 2, entry_id, true, url2,
+ ui::PAGE_TRANSITION_TYPED);
EXPECT_EQ(orig_rfh, contents()->GetMainFrame());
// Sanity-check: Confirm we're not starting out in fullscreen mode.
@@ -1365,10 +1435,11 @@ TEST_F(WebContentsImplTest, HistoryNavigationExitsFullscreen) {
controller().GoBack();
else
controller().GoForward();
+ entry_id = controller().GetPendingEntry()->GetUniqueID();
EXPECT_FALSE(contents()->cross_navigation_pending());
EXPECT_EQ(orig_rfh, contents()->GetMainFrame());
- contents()->TestDidNavigate(
- orig_rfh, i + 1, url, ui::PAGE_TRANSITION_FORWARD_BACK);
+ contents()->TestDidNavigate(orig_rfh, i + 1, entry_id, false, url,
+ ui::PAGE_TRANSITION_FORWARD_BACK);
// Confirm fullscreen has exited.
EXPECT_FALSE(orig_rvh->IsFullscreen());
@@ -1405,8 +1476,9 @@ TEST_F(WebContentsImplTest, CrashExitsFullscreen) {
const GURL url("http://www.google.com");
controller().LoadURL(
url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
- contents()->TestDidNavigate(
- contents()->GetMainFrame(), 1, url, ui::PAGE_TRANSITION_TYPED);
+ int entry_id = controller().GetPendingEntry()->GetUniqueID();
+ contents()->TestDidNavigate(contents()->GetMainFrame(), 1, entry_id, true,
+ url, ui::PAGE_TRANSITION_TYPED);
// Toggle fullscreen mode on (as if initiated via IPC from renderer).
EXPECT_FALSE(test_rvh()->IsFullscreen());
@@ -1442,12 +1514,13 @@ TEST_F(WebContentsImplTest,
ShowInterstitialFromBrowserWithNewNavigationDontProceed) {
// Navigate to a page.
GURL url1("http://www.google.com");
- contents()->GetMainFrame()->SendNavigate(1, url1);
+ contents()->GetMainFrame()->SendNavigate(1, 0, true, url1);
EXPECT_EQ(1, controller().GetEntryCount());
- // Initiate a browser navigation that will trigger the interstitial
+ // Initiate a browser navigation that will trigger the interstitial.
controller().LoadURL(GURL("http://www.evil.com"), Referrer(),
ui::PAGE_TRANSITION_TYPED, std::string());
+ NavigationEntry* entry = controller().GetPendingEntry();
// Show an interstitial.
TestInterstitialPage::InterstitialState state =
@@ -1458,16 +1531,17 @@ TEST_F(WebContentsImplTest,
new TestInterstitialPage(contents(), true, url2, &state, &deleted);
TestInterstitialPageStateGuard state_guard(interstitial);
interstitial->Show();
+ int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID();
// The interstitial should not show until its navigation has committed.
EXPECT_FALSE(interstitial->is_showing());
EXPECT_FALSE(contents()->ShowingInterstitialPage());
EXPECT_EQ(nullptr, contents()->GetInterstitialPage());
// Let's commit the interstitial navigation.
- interstitial->TestDidNavigate(1, url2);
+ interstitial->TestDidNavigate(1, interstitial_entry_id, true, url2);
EXPECT_TRUE(interstitial->is_showing());
EXPECT_TRUE(contents()->ShowingInterstitialPage());
EXPECT_TRUE(contents()->GetInterstitialPage() == interstitial);
- NavigationEntry* entry = controller().GetVisibleEntry();
+ entry = controller().GetVisibleEntry();
ASSERT_NE(nullptr, entry);
EXPECT_TRUE(entry->GetURL() == url2);
@@ -1489,10 +1563,10 @@ TEST_F(WebContentsImplTest,
// as when clicking on a link in the page) that shows an interstitial and
// creates a new navigation entry, then hiding it without proceeding.
TEST_F(WebContentsImplTest,
- ShowInterstitiaFromRendererlWithNewNavigationDontProceed) {
+ ShowInterstitialFromRendererWithNewNavigationDontProceed) {
// Navigate to a page.
GURL url1("http://www.google.com");
- contents()->GetMainFrame()->SendNavigate(1, url1);
+ contents()->GetMainFrame()->SendNavigate(1, 0, true, url1);
EXPECT_EQ(1, controller().GetEntryCount());
// Show an interstitial (no pending entry, the interstitial would have been
@@ -1505,12 +1579,13 @@ TEST_F(WebContentsImplTest,
new TestInterstitialPage(contents(), true, url2, &state, &deleted);
TestInterstitialPageStateGuard state_guard(interstitial);
interstitial->Show();
+ int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID();
// The interstitial should not show until its navigation has committed.
EXPECT_FALSE(interstitial->is_showing());
EXPECT_FALSE(contents()->ShowingInterstitialPage());
EXPECT_EQ(nullptr, contents()->GetInterstitialPage());
// Let's commit the interstitial navigation.
- interstitial->TestDidNavigate(1, url2);
+ interstitial->TestDidNavigate(1, interstitial_entry_id, true, url2);
EXPECT_TRUE(interstitial->is_showing());
EXPECT_TRUE(contents()->ShowingInterstitialPage());
EXPECT_TRUE(contents()->GetInterstitialPage() == interstitial);
@@ -1538,7 +1613,7 @@ TEST_F(WebContentsImplTest,
TEST_F(WebContentsImplTest, ShowInterstitialNoNewNavigationDontProceed) {
// Navigate to a page.
GURL url1("http://www.google.com");
- contents()->GetMainFrame()->SendNavigate(1, url1);
+ contents()->GetMainFrame()->SendNavigate(1, 0, true, url1);
EXPECT_EQ(1, controller().GetEntryCount());
// Show an interstitial.
@@ -1555,7 +1630,7 @@ TEST_F(WebContentsImplTest, ShowInterstitialNoNewNavigationDontProceed) {
EXPECT_FALSE(contents()->ShowingInterstitialPage());
EXPECT_EQ(nullptr, contents()->GetInterstitialPage());
// Let's commit the interstitial navigation.
- interstitial->TestDidNavigate(1, url2);
+ interstitial->TestDidNavigate(1, 0, true, url2);
EXPECT_TRUE(interstitial->is_showing());
EXPECT_TRUE(contents()->ShowingInterstitialPage());
EXPECT_TRUE(contents()->GetInterstitialPage() == interstitial);
@@ -1585,7 +1660,7 @@ TEST_F(WebContentsImplTest,
ShowInterstitialFromBrowserNewNavigationProceed) {
// Navigate to a page.
GURL url1("http://www.google.com");
- contents()->GetMainFrame()->SendNavigate(1, url1);
+ contents()->GetMainFrame()->SendNavigate(1, 0, true, url1);
EXPECT_EQ(1, controller().GetEntryCount());
// Initiate a browser navigation that will trigger the interstitial
@@ -1601,12 +1676,13 @@ TEST_F(WebContentsImplTest,
new TestInterstitialPage(contents(), true, url2, &state, &deleted);
TestInterstitialPageStateGuard state_guard(interstitial);
interstitial->Show();
+ int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID();
// The interstitial should not show until its navigation has committed.
EXPECT_FALSE(interstitial->is_showing());
EXPECT_FALSE(contents()->ShowingInterstitialPage());
EXPECT_EQ(nullptr, contents()->GetInterstitialPage());
// Let's commit the interstitial navigation.
- interstitial->TestDidNavigate(1, url2);
+ interstitial->TestDidNavigate(1, interstitial_entry_id, true, url2);
EXPECT_TRUE(interstitial->is_showing());
EXPECT_TRUE(contents()->ShowingInterstitialPage());
EXPECT_TRUE(contents()->GetInterstitialPage() == interstitial);
@@ -1626,7 +1702,7 @@ TEST_F(WebContentsImplTest,
// Simulate the navigation to the page, that's when the interstitial gets
// hidden.
GURL url3("http://www.thepage.com");
- contents()->GetMainFrame()->SendNavigate(2, url3);
+ contents()->GetMainFrame()->SendNavigate(2, 0, true, url3);
EXPECT_FALSE(contents()->ShowingInterstitialPage());
EXPECT_EQ(nullptr, contents()->GetInterstitialPage());
@@ -1647,7 +1723,7 @@ TEST_F(WebContentsImplTest,
ShowInterstitialFromRendererNewNavigationProceed) {
// Navigate to a page.
GURL url1("http://www.google.com");
- contents()->GetMainFrame()->SendNavigate(1, url1);
+ contents()->GetMainFrame()->SendNavigate(1, 0, true, url1);
EXPECT_EQ(1, controller().GetEntryCount());
// Show an interstitial.
@@ -1659,12 +1735,13 @@ TEST_F(WebContentsImplTest,
new TestInterstitialPage(contents(), true, url2, &state, &deleted);
TestInterstitialPageStateGuard state_guard(interstitial);
interstitial->Show();
+ int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID();
// The interstitial should not show until its navigation has committed.
EXPECT_FALSE(interstitial->is_showing());
EXPECT_FALSE(contents()->ShowingInterstitialPage());
EXPECT_EQ(nullptr, contents()->GetInterstitialPage());
// Let's commit the interstitial navigation.
- interstitial->TestDidNavigate(1, url2);
+ interstitial->TestDidNavigate(1, interstitial_entry_id, true, url2);
EXPECT_TRUE(interstitial->is_showing());
EXPECT_TRUE(contents()->ShowingInterstitialPage());
EXPECT_TRUE(contents()->GetInterstitialPage() == interstitial);
@@ -1684,7 +1761,7 @@ TEST_F(WebContentsImplTest,
// Simulate the navigation to the page, that's when the interstitial gets
// hidden.
GURL url3("http://www.thepage.com");
- contents()->GetMainFrame()->SendNavigate(2, url3);
+ contents()->GetMainFrame()->SendNavigate(2, 0, true, url3);
EXPECT_FALSE(contents()->ShowingInterstitialPage());
EXPECT_EQ(nullptr, contents()->GetInterstitialPage());
@@ -1704,7 +1781,7 @@ TEST_F(WebContentsImplTest,
TEST_F(WebContentsImplTest, ShowInterstitialNoNewNavigationProceed) {
// Navigate to a page so we have a navigation entry in the controller.
GURL url1("http://www.google.com");
- contents()->GetMainFrame()->SendNavigate(1, url1);
+ contents()->GetMainFrame()->SendNavigate(1, 0, true, url1);
EXPECT_EQ(1, controller().GetEntryCount());
// Show an interstitial.
@@ -1721,7 +1798,7 @@ TEST_F(WebContentsImplTest, ShowInterstitialNoNewNavigationProceed) {
EXPECT_FALSE(contents()->ShowingInterstitialPage());
EXPECT_EQ(nullptr, contents()->GetInterstitialPage());
// Let's commit the interstitial navigation.
- interstitial->TestDidNavigate(1, url2);
+ interstitial->TestDidNavigate(1, 0, true, url2);
EXPECT_TRUE(interstitial->is_showing());
EXPECT_TRUE(contents()->ShowingInterstitialPage());
EXPECT_TRUE(contents()->GetInterstitialPage() == interstitial);
@@ -1758,11 +1835,12 @@ TEST_F(WebContentsImplTest, ShowInterstitialThenNavigate) {
new TestInterstitialPage(contents(), true, url, &state, &deleted);
TestInterstitialPageStateGuard state_guard(interstitial);
interstitial->Show();
- interstitial->TestDidNavigate(1, url);
+ int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID();
+ interstitial->TestDidNavigate(1, interstitial_entry_id, true, url);
// While interstitial showing, navigate to a new URL.
const GURL url2("http://www.yahoo.com");
- contents()->GetMainFrame()->SendNavigate(1, url2);
+ contents()->GetMainFrame()->SendNavigate(1, 1, true, url2);
EXPECT_EQ(TestInterstitialPage::CANCELED, state);
@@ -1774,8 +1852,9 @@ TEST_F(WebContentsImplTest, ShowInterstitialThenNavigate) {
TEST_F(WebContentsImplTest, ShowInterstitialThenGoBack) {
// Navigate to a page so we have a navigation entry in the controller.
GURL url1("http://www.google.com");
- contents()->GetMainFrame()->SendNavigate(1, url1);
+ contents()->GetMainFrame()->SendNavigate(1, 0, true, url1);
EXPECT_EQ(1, controller().GetEntryCount());
+ NavigationEntry* entry = controller().GetLastCommittedEntry();
// Show interstitial.
TestInterstitialPage::InterstitialState state =
@@ -1787,16 +1866,19 @@ TEST_F(WebContentsImplTest, ShowInterstitialThenGoBack) {
&state, &deleted);
TestInterstitialPageStateGuard state_guard(interstitial);
interstitial->Show();
- interstitial->TestDidNavigate(2, interstitial_url);
+ int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID();
+ interstitial->TestDidNavigate(2, interstitial_entry_id, true,
+ interstitial_url);
// While the interstitial is showing, go back.
controller().GoBack();
- contents()->GetMainFrame()->SendNavigate(1, url1);
+ contents()->GetMainFrame()->SendNavigate(1, entry->GetUniqueID(), false,
+ url1);
// Make sure we are back to the original page and that the interstitial is
// gone.
EXPECT_EQ(TestInterstitialPage::CANCELED, state);
- NavigationEntry* entry = controller().GetVisibleEntry();
+ entry = controller().GetVisibleEntry();
ASSERT_TRUE(entry);
EXPECT_EQ(url1.spec(), entry->GetURL().spec());
@@ -1809,8 +1891,9 @@ TEST_F(WebContentsImplTest, ShowInterstitialThenGoBack) {
TEST_F(WebContentsImplTest, ShowInterstitialCrashRendererThenGoBack) {
// Navigate to a page so we have a navigation entry in the controller.
GURL url1("http://www.google.com");
- contents()->GetMainFrame()->SendNavigate(1, url1);
+ contents()->GetMainFrame()->SendNavigate(1, 0, true, url1);
EXPECT_EQ(1, controller().GetEntryCount());
+ NavigationEntry* entry = controller().GetLastCommittedEntry();
// Show interstitial.
TestInterstitialPage::InterstitialState state =
@@ -1822,7 +1905,9 @@ TEST_F(WebContentsImplTest, ShowInterstitialCrashRendererThenGoBack) {
&state, &deleted);
TestInterstitialPageStateGuard state_guard(interstitial);
interstitial->Show();
- interstitial->TestDidNavigate(2, interstitial_url);
+ int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID();
+ interstitial->TestDidNavigate(2, interstitial_entry_id, true,
+ interstitial_url);
// Crash the renderer
main_rfh()->OnMessageReceived(
@@ -1831,12 +1916,13 @@ TEST_F(WebContentsImplTest, ShowInterstitialCrashRendererThenGoBack) {
// While the interstitial is showing, go back.
controller().GoBack();
- contents()->GetMainFrame()->SendNavigate(1, url1);
+ contents()->GetMainFrame()->SendNavigate(1, entry->GetUniqueID(), false,
+ url1);
// Make sure we are back to the original page and that the interstitial is
// gone.
EXPECT_EQ(TestInterstitialPage::CANCELED, state);
- NavigationEntry* entry = controller().GetVisibleEntry();
+ entry = controller().GetVisibleEntry();
ASSERT_TRUE(entry);
EXPECT_EQ(url1.spec(), entry->GetURL().spec());
@@ -1849,7 +1935,7 @@ TEST_F(WebContentsImplTest, ShowInterstitialCrashRendererThenGoBack) {
TEST_F(WebContentsImplTest, ShowInterstitialCrashRendererThenNavigate) {
// Navigate to a page so we have a navigation entry in the controller.
GURL url1("http://www.google.com");
- contents()->GetMainFrame()->SendNavigate(1, url1);
+ contents()->GetMainFrame()->SendNavigate(1, 0, true, url1);
EXPECT_EQ(1, controller().GetEntryCount());
// Show interstitial.
@@ -1862,13 +1948,15 @@ TEST_F(WebContentsImplTest, ShowInterstitialCrashRendererThenNavigate) {
&state, &deleted);
TestInterstitialPageStateGuard state_guard(interstitial);
interstitial->Show();
+ int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID();
// Crash the renderer
main_rfh()->OnMessageReceived(
FrameHostMsg_RenderProcessGone(
0, base::TERMINATION_STATUS_PROCESS_CRASHED, -1));
- interstitial->TestDidNavigate(2, interstitial_url);
+ interstitial->TestDidNavigate(2, interstitial_entry_id, true,
+ interstitial_url);
}
// Test navigating to a page that shows an interstitial, then close the
@@ -1883,7 +1971,8 @@ TEST_F(WebContentsImplTest, ShowInterstitialThenCloseTab) {
new TestInterstitialPage(contents(), true, url, &state, &deleted);
TestInterstitialPageStateGuard state_guard(interstitial);
interstitial->Show();
- interstitial->TestDidNavigate(1, url);
+ int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID();
+ interstitial->TestDidNavigate(1, interstitial_entry_id, true, url);
// Now close the contents.
DeleteContents();
@@ -1905,7 +1994,8 @@ TEST_F(WebContentsImplTest, ShowInterstitialThenCloseAndShutdown) {
new TestInterstitialPage(contents(), true, url, &state, &deleted);
TestInterstitialPageStateGuard state_guard(interstitial);
interstitial->Show();
- interstitial->TestDidNavigate(1, url);
+ int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID();
+ interstitial->TestDidNavigate(1, interstitial_entry_id, true, url);
RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
interstitial->GetMainFrame()->GetRenderViewHost());
@@ -1928,7 +2018,7 @@ TEST_F(WebContentsImplTest, ShowInterstitialThenCloseAndShutdown) {
TEST_F(WebContentsImplTest, ShowInterstitialProceedMultipleCommands) {
// Navigate to a page so we have a navigation entry in the controller.
GURL url1("http://www.google.com");
- contents()->GetMainFrame()->SendNavigate(1, url1);
+ contents()->GetMainFrame()->SendNavigate(1, 0, true, url1);
EXPECT_EQ(1, controller().GetEntryCount());
// Show an interstitial.
@@ -1940,7 +2030,8 @@ TEST_F(WebContentsImplTest, ShowInterstitialProceedMultipleCommands) {
new TestInterstitialPage(contents(), true, url2, &state, &deleted);
TestInterstitialPageStateGuard state_guard(interstitial);
interstitial->Show();
- interstitial->TestDidNavigate(1, url2);
+ int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID();
+ interstitial->TestDidNavigate(1, interstitial_entry_id, true, url2);
// Run a command.
EXPECT_EQ(0, interstitial->command_received_count());
@@ -1963,7 +2054,7 @@ TEST_F(WebContentsImplTest, ShowInterstitialProceedMultipleCommands) {
TEST_F(WebContentsImplTest, ShowInterstitialOnInterstitial) {
// Navigate to a page so we have a navigation entry in the controller.
GURL start_url("http://www.google.com");
- contents()->GetMainFrame()->SendNavigate(1, start_url);
+ contents()->GetMainFrame()->SendNavigate(1, 0, true, start_url);
EXPECT_EQ(1, controller().GetEntryCount());
// Show an interstitial.
@@ -1975,7 +2066,8 @@ TEST_F(WebContentsImplTest, ShowInterstitialOnInterstitial) {
new TestInterstitialPage(contents(), true, url1, &state1, &deleted1);
TestInterstitialPageStateGuard state_guard1(interstitial1);
interstitial1->Show();
- interstitial1->TestDidNavigate(1, url1);
+ int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID();
+ interstitial1->TestDidNavigate(1, interstitial_entry_id, true, url1);
// Now show another interstitial.
TestInterstitialPage::InterstitialState state2 =
@@ -1986,7 +2078,8 @@ TEST_F(WebContentsImplTest, ShowInterstitialOnInterstitial) {
new TestInterstitialPage(contents(), true, url2, &state2, &deleted2);
TestInterstitialPageStateGuard state_guard2(interstitial2);
interstitial2->Show();
- interstitial2->TestDidNavigate(1, url2);
+ interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID();
+ interstitial2->TestDidNavigate(1, interstitial_entry_id, true, url2);
// Showing interstitial2 should have caused interstitial1 to go away.
EXPECT_EQ(TestInterstitialPage::CANCELED, state1);
@@ -1999,7 +2092,7 @@ TEST_F(WebContentsImplTest, ShowInterstitialOnInterstitial) {
// Let's make sure interstitial2 is working as intended.
interstitial2->Proceed();
GURL landing_url("http://www.thepage.com");
- contents()->GetMainFrame()->SendNavigate(2, landing_url);
+ contents()->GetMainFrame()->SendNavigate(2, 0, true, landing_url);
EXPECT_FALSE(contents()->ShowingInterstitialPage());
EXPECT_EQ(nullptr, contents()->GetInterstitialPage());
@@ -2016,7 +2109,7 @@ TEST_F(WebContentsImplTest, ShowInterstitialOnInterstitial) {
TEST_F(WebContentsImplTest, ShowInterstitialProceedShowInterstitial) {
// Navigate to a page so we have a navigation entry in the controller.
GURL start_url("http://www.google.com");
- contents()->GetMainFrame()->SendNavigate(1, start_url);
+ contents()->GetMainFrame()->SendNavigate(1, 0, true, start_url);
EXPECT_EQ(1, controller().GetEntryCount());
// Show an interstitial.
@@ -2028,7 +2121,8 @@ TEST_F(WebContentsImplTest, ShowInterstitialProceedShowInterstitial) {
new TestInterstitialPage(contents(), true, url1, &state1, &deleted1);
TestInterstitialPageStateGuard state_guard1(interstitial1);
interstitial1->Show();
- interstitial1->TestDidNavigate(1, url1);
+ int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID();
+ interstitial1->TestDidNavigate(1, interstitial_entry_id, true, url1);
// Take action. The interstitial won't be hidden until the navigation is
// committed.
@@ -2045,7 +2139,8 @@ TEST_F(WebContentsImplTest, ShowInterstitialProceedShowInterstitial) {
new TestInterstitialPage(contents(), true, url2, &state2, &deleted2);
TestInterstitialPageStateGuard state_guard2(interstitial2);
interstitial2->Show();
- interstitial2->TestDidNavigate(1, url2);
+ interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID();
+ interstitial2->TestDidNavigate(1, interstitial_entry_id, true, url2);
// Showing interstitial2 should have caused interstitial1 to go away.
EXPECT_EQ(TestInterstitialPage::UNDECIDED, state2);
@@ -2056,7 +2151,7 @@ TEST_F(WebContentsImplTest, ShowInterstitialProceedShowInterstitial) {
// Let's make sure interstitial2 is working as intended.
interstitial2->Proceed();
GURL landing_url("http://www.thepage.com");
- contents()->GetMainFrame()->SendNavigate(2, landing_url);
+ contents()->GetMainFrame()->SendNavigate(2, 0, true, landing_url);
RunAllPendingInMessageLoop();
EXPECT_TRUE(deleted2);
@@ -2081,6 +2176,7 @@ TEST_F(WebContentsImplTest, NavigateBeforeInterstitialShows) {
&state, &deleted);
TestInterstitialPageStateGuard state_guard(interstitial);
interstitial->Show();
+ int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID();
// Let's simulate a navigation initiated from the browser before the
// interstitial finishes loading.
@@ -2092,7 +2188,8 @@ TEST_F(WebContentsImplTest, NavigateBeforeInterstitialShows) {
ASSERT_FALSE(deleted);
// Now let's make the interstitial navigation commit.
- interstitial->TestDidNavigate(1, interstitial_url);
+ interstitial->TestDidNavigate(1, interstitial_entry_id, true,
+ interstitial_url);
// After it loaded the interstitial should be gone.
EXPECT_EQ(TestInterstitialPage::CANCELED, state);
@@ -2126,6 +2223,7 @@ TEST_F(WebContentsImplTest, TwoQuickInterstitials) {
&state2, &deleted2);
TestInterstitialPageStateGuard state_guard2(interstitial2);
interstitial2->Show();
+ int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID();
// The first interstitial should have been closed and deleted.
EXPECT_EQ(TestInterstitialPage::CANCELED, state1);
@@ -2137,7 +2235,8 @@ TEST_F(WebContentsImplTest, TwoQuickInterstitials) {
ASSERT_FALSE(deleted2);
// Make the interstitial navigation commit it should be showing.
- interstitial2->TestDidNavigate(1, interstitial_url);
+ interstitial2->TestDidNavigate(1, interstitial_entry_id, true,
+ interstitial_url);
EXPECT_EQ(interstitial2, contents()->GetInterstitialPage());
}
@@ -2164,7 +2263,8 @@ TEST_F(WebContentsImplTest, InterstitialCrasher) {
interstitial =
new TestInterstitialPage(contents(), true, url, &state, &deleted);
interstitial->Show();
- interstitial->TestDidNavigate(1, url);
+ int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID();
+ interstitial->TestDidNavigate(1, interstitial_entry_id, true, url);
// Simulate a renderer crash.
interstitial->TestRenderViewTerminated(
base::TERMINATION_STATUS_PROCESS_CRASHED, -1);
@@ -2193,7 +2293,8 @@ TEST_F(WebContentsImplTest, NewInterstitialDoesNotCancelPendingEntry) {
new TestInterstitialPage(contents(), true, kGURL, &state, &deleted);
TestInterstitialPageStateGuard state_guard(interstitial);
interstitial->Show();
- interstitial->TestDidNavigate(1, kGURL);
+ int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID();
+ interstitial->TestDidNavigate(1, interstitial_entry_id, true, kGURL);
// Initiate a new navigation from the browser that also triggers an
// interstitial.
@@ -2206,7 +2307,8 @@ TEST_F(WebContentsImplTest, NewInterstitialDoesNotCancelPendingEntry) {
new TestInterstitialPage(contents(), true, kGURL, &state2, &deleted2);
TestInterstitialPageStateGuard state_guard2(interstitial2);
interstitial2->Show();
- interstitial2->TestDidNavigate(1, kGURL);
+ interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID();
+ interstitial2->TestDidNavigate(1, interstitial_entry_id, true, kGURL);
// Make sure we still have an entry.
NavigationEntry* entry = contents()->GetController().GetPendingEntry();
@@ -2230,9 +2332,10 @@ TEST_F(WebContentsImplTest, NoJSMessageOnInterstitials) {
// Start a navigation to a page
contents()->GetController().LoadURL(
kGURL, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ int entry_id = controller().GetPendingEntry()->GetUniqueID();
// DidNavigate from the page
- contents()->TestDidNavigate(
- contents()->GetMainFrame(), 1, kGURL, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(contents()->GetMainFrame(), 1, entry_id, true,
+ kGURL, ui::PAGE_TRANSITION_TYPED);
// Simulate showing an interstitial while the page is showing.
TestInterstitialPage::InterstitialState state =
@@ -2242,7 +2345,8 @@ TEST_F(WebContentsImplTest, NoJSMessageOnInterstitials) {
new TestInterstitialPage(contents(), true, kGURL, &state, &deleted);
TestInterstitialPageStateGuard state_guard(interstitial);
interstitial->Show();
- interstitial->TestDidNavigate(1, kGURL);
+ int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID();
+ interstitial->TestDidNavigate(1, interstitial_entry_id, true, kGURL);
// While the interstitial is showing, let's simulate the hidden page
// attempting to show a JS message.
@@ -2259,7 +2363,7 @@ TEST_F(WebContentsImplTest, NoJSMessageOnInterstitials) {
TEST_F(WebContentsImplTest, CopyStateFromAndPruneSourceInterstitial) {
// Navigate to a page.
GURL url1("http://www.google.com");
- contents()->GetMainFrame()->SendNavigate(1, url1);
+ contents()->GetMainFrame()->SendNavigate(1, 0, true, url1);
EXPECT_EQ(1, controller().GetEntryCount());
// Initiate a browser navigation that will trigger the interstitial
@@ -2275,7 +2379,8 @@ TEST_F(WebContentsImplTest, CopyStateFromAndPruneSourceInterstitial) {
new TestInterstitialPage(contents(), true, url2, &state, &deleted);
TestInterstitialPageStateGuard state_guard(interstitial);
interstitial->Show();
- interstitial->TestDidNavigate(1, url2);
+ int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID();
+ interstitial->TestDidNavigate(1, interstitial_entry_id, true, url2);
EXPECT_TRUE(interstitial->is_showing());
EXPECT_EQ(2, controller().GetEntryCount());
@@ -2324,7 +2429,9 @@ TEST_F(WebContentsImplTest, CopyStateFromAndPruneTargetInterstitial) {
&deleted);
TestInterstitialPageStateGuard state_guard(interstitial);
interstitial->Show();
- interstitial->TestDidNavigate(1, url3);
+ int interstitial_entry_id =
+ other_controller.GetTransientEntry()->GetUniqueID();
+ interstitial->TestDidNavigate(1, interstitial_entry_id, true, url3);
EXPECT_TRUE(interstitial->is_showing());
EXPECT_EQ(2, other_controller.GetEntryCount());
@@ -2761,9 +2868,11 @@ TEST_F(WebContentsImplTest, StartStopEventsBalance) {
// The frame should still be loading.
controller().LoadURL(
main_url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ int entry_id = controller().GetPendingEntry()->GetUniqueID();
orig_rfh->OnMessageReceived(
FrameHostMsg_DidStartLoading(orig_rfh->GetRoutingID(), false));
- contents()->TestDidNavigate(orig_rfh, 1, main_url, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigate(orig_rfh, 1, entry_id, true, main_url,
+ ui::PAGE_TRANSITION_TYPED);
EXPECT_FALSE(contents()->cross_navigation_pending());
EXPECT_EQ(orig_rfh, contents()->GetMainFrame());
EXPECT_TRUE(contents()->IsLoading());
@@ -2777,8 +2886,8 @@ TEST_F(WebContentsImplTest, StartStopEventsBalance) {
{
subframe->OnMessageReceived(
FrameHostMsg_DidStartLoading(subframe->GetRoutingID(), true));
- subframe->SendNavigateWithTransition(
- 1, GURL("about:blank"), ui::PAGE_TRANSITION_AUTO_SUBFRAME);
+ subframe->SendNavigateWithTransition(1, 0, false, GURL("about:blank"),
+ ui::PAGE_TRANSITION_AUTO_SUBFRAME);
subframe->OnMessageReceived(
FrameHostMsg_DidStopLoading(subframe->GetRoutingID()));
}
@@ -2788,8 +2897,8 @@ TEST_F(WebContentsImplTest, StartStopEventsBalance) {
{
subframe->OnMessageReceived(
FrameHostMsg_DidStartLoading(subframe->GetRoutingID(), true));
- subframe->SendNavigateWithTransition(
- 1, foo_url, ui::PAGE_TRANSITION_AUTO_SUBFRAME);
+ subframe->SendNavigateWithTransition(1, 0, false, foo_url,
+ ui::PAGE_TRANSITION_AUTO_SUBFRAME);
subframe->OnMessageReceived(
FrameHostMsg_DidStopLoading(subframe->GetRoutingID()));
}
@@ -2814,14 +2923,15 @@ TEST_F(WebContentsImplTest, StartStopEventsBalance) {
load_params.frame_tree_node_id =
subframe->frame_tree_node()->frame_tree_node_id();
controller().LoadURLWithParams(load_params);
+ entry_id = controller().GetPendingEntry()->GetUniqueID();
subframe->OnMessageReceived(
FrameHostMsg_DidStartLoading(subframe->GetRoutingID(), true));
// Commit the navigation in the child frame and send the DidStopLoading
// message.
- contents()->TestDidNavigate(
- subframe, 3, bar_url, ui::PAGE_TRANSITION_MANUAL_SUBFRAME);
+ contents()->TestDidNavigate(subframe, 3, entry_id, true, bar_url,
+ ui::PAGE_TRANSITION_MANUAL_SUBFRAME);
subframe->OnMessageReceived(
FrameHostMsg_DidStopLoading(subframe->GetRoutingID()));
}
@@ -2857,6 +2967,7 @@ TEST_F(WebContentsImplTest, NoEarlyStop) {
// be a pending RenderFrameHost and the WebContents should be loading.
controller().LoadURL(
kUrl2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+ int entry_id = controller().GetPendingEntry()->GetUniqueID();
EXPECT_TRUE(contents()->cross_navigation_pending());
TestRenderFrameHost* pending_rfh = contents()->GetPendingMainFrame();
ASSERT_TRUE(pending_rfh);
@@ -2880,7 +2991,7 @@ TEST_F(WebContentsImplTest, NoEarlyStop) {
// Simulate the commit and DidStopLoading from the renderer-initiated
// navigation in the current RenderFrameHost. There should still be a pending
// RenderFrameHost and the WebContents should still be loading.
- current_rfh->SendNavigate(1, kUrl3);
+ current_rfh->SendNavigate(1, 0, true, kUrl3);
current_rfh->OnMessageReceived(
FrameHostMsg_DidStopLoading(current_rfh->GetRoutingID()));
EXPECT_EQ(contents()->GetPendingMainFrame(), pending_rfh);
@@ -2888,7 +2999,7 @@ TEST_F(WebContentsImplTest, NoEarlyStop) {
// Commit the navigation. The formerly pending RenderFrameHost should now be
// the current RenderFrameHost and the WebContents should still be loading.
- contents()->TestDidNavigate(pending_rfh, 1, kUrl2,
+ contents()->TestDidNavigate(pending_rfh, 1, entry_id, true, kUrl2,
ui::PAGE_TRANSITION_TYPED);
EXPECT_FALSE(contents()->GetPendingMainFrame());
TestRenderFrameHost* new_current_rfh = contents()->GetMainFrame();

Powered by Google App Engine
This is Rietveld 408576698