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

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

Issue 2584513003: PlzNavigate: identify same-page browser-initiated navigation. (Closed)
Patch Set: Fix 2 WebContentsImplTest by assigning a document_sequence_number. Created 3 years, 11 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 e4ddf6e9978bb9338490d596eb20f31795b9e2ce..3e375a8bc832ae09841621fa90d4a4708974efd4 100644
--- a/content/browser/web_contents/web_contents_impl_unittest.cc
+++ b/content/browser/web_contents/web_contents_impl_unittest.cc
@@ -520,8 +520,9 @@ TEST_F(WebContentsImplTest, CrossSiteBoundaries) {
url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
int entry_id = controller().GetPendingEntry()->GetUniqueID();
orig_rfh->PrepareForCommit();
- contents()->TestDidNavigate(orig_rfh, entry_id, true, url,
- ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigateWithSequenceNumber(
+ orig_rfh, entry_id, true, url, Referrer(), ui::PAGE_TRANSITION_TYPED,
+ false, 0, 0);
// 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.
@@ -556,8 +557,9 @@ TEST_F(WebContentsImplTest, CrossSiteBoundaries) {
}
// DidNavigate from the pending page
- contents()->TestDidNavigate(pending_rfh, entry_id, true, url2,
- ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigateWithSequenceNumber(
+ pending_rfh, entry_id, true, url2, Referrer(), ui::PAGE_TRANSITION_TYPED,
+ false, 1, 1);
SiteInstance* instance2 = contents()->GetSiteInstance();
// Keep the number of active frames in pending_rfh's SiteInstance
@@ -594,8 +596,9 @@ TEST_F(WebContentsImplTest, CrossSiteBoundaries) {
}
// DidNavigate from the back action
- contents()->TestDidNavigate(goback_rfh, entry_id, false, url2,
- ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigateWithSequenceNumber(
+ goback_rfh, entry_id, false, url2, Referrer(), ui::PAGE_TRANSITION_TYPED,
+ false, 2, 0);
EXPECT_FALSE(contents()->CrossProcessNavigationPending());
EXPECT_EQ(goback_rfh, main_test_rfh());
EXPECT_EQ(instance1, contents()->GetSiteInstance());
@@ -1131,8 +1134,9 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationBackPreempted) {
int entry_id = controller().GetPendingEntry()->GetUniqueID();
TestRenderFrameHost* webui_rfh = main_test_rfh();
webui_rfh->PrepareForCommit();
- contents()->TestDidNavigate(webui_rfh, entry_id, true, url1,
- ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigateWithSequenceNumber(
+ webui_rfh, entry_id, true, url1, Referrer(), ui::PAGE_TRANSITION_TYPED,
+ false, 0, 0);
NavigationEntry* entry1 = controller().GetLastCommittedEntry();
SiteInstance* instance1 = contents()->GetSiteInstance();
@@ -1157,8 +1161,9 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationBackPreempted) {
webui_rfh->PrepareForCommit();
// DidNavigate from the pending page.
- contents()->TestDidNavigate(google_rfh, entry_id, true, url2,
- ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigateWithSequenceNumber(
+ google_rfh, entry_id, true, url2, Referrer(), ui::PAGE_TRANSITION_TYPED,
+ false, 1, 1);
NavigationEntry* entry2 = controller().GetLastCommittedEntry();
SiteInstance* instance2 = contents()->GetSiteInstance();
@@ -1179,8 +1184,9 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationBackPreempted) {
entry_id = controller().GetPendingEntry()->GetUniqueID();
EXPECT_FALSE(contents()->CrossProcessNavigationPending());
main_test_rfh()->PrepareForCommit();
- contents()->TestDidNavigate(google_rfh, entry_id, true, url3,
- ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigateWithSequenceNumber(
+ google_rfh, entry_id, true, url3, Referrer(), ui::PAGE_TRANSITION_TYPED,
+ false, 2, 2);
NavigationEntry* entry3 = controller().GetLastCommittedEntry();
SiteInstance* instance3 = contents()->GetSiteInstance();
@@ -1212,8 +1218,9 @@ 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, goback_entry->GetUniqueID(), false,
- url2, ui::PAGE_TRANSITION_TYPED);
+ contents()->TestDidNavigateWithSequenceNumber(
+ google_rfh, goback_entry->GetUniqueID(), false, url2, Referrer(),
+ ui::PAGE_TRANSITION_TYPED, false, 3, 1);
// We should commit this page and forget about the second back.
EXPECT_FALSE(contents()->CrossProcessNavigationPending());

Powered by Google App Engine
This is Rietveld 408576698