diff options
author | vkuzkokov <vkuzkokov@chromium.org> | 2015-04-28 05:07:01 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-28 12:07:04 +0000 |
commit | 49180eb13549e440bbd4f66390e32e84699dcdfd (patch) | |
tree | ea34e50a0a150f491d6cfa5cebcc8f7600628885 | |
parent | ee9049e5b2e4ddd2c896ba9c9d991b2d59a00977 (diff) | |
download | chromium_src-49180eb13549e440bbd4f66390e32e84699dcdfd.zip chromium_src-49180eb13549e440bbd4f66390e32e84699dcdfd.tar.gz chromium_src-49180eb13549e440bbd4f66390e32e84699dcdfd.tar.bz2 |
Revert of Classify navigations without page id in parallel to the existing classifier. (patchset #35 id:680001 of https://codereview.chromium.org/1002803002/)
Reason for revert:
Very flaky on ChromeOS debug bots. See crbug.com/481910
Original issue's description:
> Classify navigations without page id in parallel to the existing classifier.
>
> For now, this only happens in debug builds.
>
> BUG=369661
> TEST=NavigationControllerBrowserTest.NavigationTypeClassification_*
> TEST=Every other test on the planet.
>
> Committed: https://crrev.com/d8d93348bbd8c646c337bdaa40fc0c64204fc5ff
> Cr-Commit-Position: refs/heads/master@{#327122}
>
> Reverted: https://crrev.com/5348e920f4119aff9a4eb76c0965725dc85a66cc
> Cr-Revert-Position: refs/heads/master@{#327152}
>
> Committed: https://crrev.com/5671403d44971669e4d81aecf3f002188ce0e95f
> Cr-Commit-Position: refs/heads/master@{#327214}
TBR=phajdan.jr@chromium.org,clamy@chromium.org,creis@chromium.org,hajimehoshi@chromium.org,isherman@chromium.org,jeremyim@chromium.org,mattm@chromium.org,mnaganov@chromium.org,mvanouwerkerk@chromium.org,nasko@chromium.org,stevenjb@chromium.org,bengr@chromium.org,cpu@chromium.org,avi@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=369661
Review URL: https://codereview.chromium.org/1110943003
Cr-Commit-Position: refs/heads/master@{#327269}
41 files changed, 516 insertions, 1277 deletions
diff --git a/chrome/browser/chromeos/login/signin/merge_session_load_page_unittest.cc b/chrome/browser/chromeos/login/signin/merge_session_load_page_unittest.cc index 0ff4379..3157246 100644 --- a/chrome/browser/chromeos/login/signin/merge_session_load_page_unittest.cc +++ b/chrome/browser/chromeos/login/signin/merge_session_load_page_unittest.cc @@ -13,7 +13,6 @@ #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "content/public/browser/interstitial_page.h" #include "content/public/browser/navigation_controller.h" -#include "content/public/browser/navigation_entry.h" #include "content/public/browser/web_contents.h" #include "content/public/test/web_contents_tester.h" @@ -65,14 +64,10 @@ class MergeSessionLoadPageTest : public ChromeRenderViewHostTestHarness { ChromeRenderViewHostTestHarness::TearDown(); } - void Navigate(const char* url, - int page_id, - int nav_entry_id, - bool did_create_new_entry) { - WebContentsTester::For(web_contents()) - ->TestDidNavigate(web_contents()->GetMainFrame(), page_id, nav_entry_id, - did_create_new_entry, GURL(url), - ui::PAGE_TRANSITION_TYPED); + void Navigate(const char* url, int page_id) { + WebContentsTester::For(web_contents())->TestDidNavigate( + web_contents()->GetMainFrame(), page_id, GURL(url), + ui::PAGE_TRANSITION_TYPED); } void ShowInterstitial(const char* url) { @@ -122,7 +117,7 @@ class MergeSessionLoadPageTest : public ChromeRenderViewHostTestHarness { TEST_F(MergeSessionLoadPageTest, MergeSessionPageNotShown) { SetMergeSessionState(OAuth2LoginManager::SESSION_RESTORE_DONE); // Start a load. - Navigate(kURL1, 1, 0, true); + Navigate(kURL1, 1); // Load next page. controller().LoadURL(GURL(kURL2), content::Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); @@ -140,7 +135,7 @@ TEST_F(MergeSessionLoadPageTest, MergeSessionPageNotShownOnTimeout) { base::TimeDelta::FromSeconds(kSessionMergeTimeout + 1)); // Start a load. - Navigate(kURL1, 1, 0, true); + Navigate(kURL1, 1); // Load next page. controller().LoadURL(GURL(kURL2), content::Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); @@ -155,11 +150,10 @@ TEST_F(MergeSessionLoadPageTest, MergeSessionPageShown) { SetMergeSessionState(OAuth2LoginManager::SESSION_RESTORE_IN_PROGRESS); // Start a load. - Navigate(kURL1, 1, 0, true); + Navigate(kURL1, 1); // Load next page. controller().LoadURL(GURL(kURL2), content::Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int pending_id = controller().GetPendingEntry()->GetUniqueID(); // Simulate the load causing an merge session interstitial page // to be shown. @@ -176,7 +170,7 @@ TEST_F(MergeSessionLoadPageTest, MergeSessionPageShown) { EXPECT_EQ(kURL2, web_contents()->GetVisibleURL().spec()); // Commit navigation and the interstitial page is gone. - Navigate(kURL2, 2, pending_id, true); + Navigate(kURL2, 2); EXPECT_FALSE(GetMergeSessionLoadPage()); } diff --git a/chrome/browser/chromeos/offline/offline_load_page_unittest.cc b/chrome/browser/chromeos/offline/offline_load_page_unittest.cc index 8bf9a98..6261d3c 100644 --- a/chrome/browser/chromeos/offline/offline_load_page_unittest.cc +++ b/chrome/browser/chromeos/offline/offline_load_page_unittest.cc @@ -61,14 +61,10 @@ class OfflineLoadPageTest : public ChromeRenderViewHostTestHarness { user_response_ = CANCEL; } - void Navigate(const char* url, - int page_id, - int nav_entry_id, - bool did_create_new_entry) { - WebContentsTester::For(web_contents()) - ->TestDidNavigate(web_contents()->GetMainFrame(), page_id, nav_entry_id, - did_create_new_entry, GURL(url), - ui::PAGE_TRANSITION_TYPED); + void Navigate(const char* url, int page_id) { + WebContentsTester::For(web_contents())->TestDidNavigate( + web_contents()->GetMainFrame(), page_id, GURL(url), + ui::PAGE_TRANSITION_TYPED); } void ShowInterstitial(const char* url) { @@ -95,7 +91,7 @@ void TestOfflineLoadPage::NotifyBlockingPageComplete(bool proceed) { TEST_F(OfflineLoadPageTest, OfflinePageProceed) { // Start a load. - Navigate(kURL1, 1, 0, true); + Navigate(kURL1, 1); // Load next page. controller().LoadURL(GURL(kURL2), content::Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); @@ -117,14 +113,14 @@ TEST_F(OfflineLoadPageTest, OfflinePageProceed) { EXPECT_EQ(kURL2, web_contents()->GetVisibleURL().spec()); // Commit navigation and the interstitial page is gone. - Navigate(kURL2, 2, 0, true); + Navigate(kURL2, 2); EXPECT_FALSE(GetOfflineLoadPage()); } // Tests showing an offline page and not proceeding. TEST_F(OfflineLoadPageTest, OfflinePageDontProceed) { // Start a load. - Navigate(kURL1, 1, 0, true); + Navigate(kURL1, 1); controller().LoadURL(GURL(kURL2), content::Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); diff --git a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc index 6775087..37e8406 100644 --- a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc +++ b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc @@ -32,7 +32,6 @@ #include "components/infobars/core/infobar.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/navigation_details.h" -#include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_service.h" @@ -225,9 +224,8 @@ void GeolocationPermissionContextTests::AddNewTab(const GURL& url) { content::WebContents* new_tab = CreateTestWebContents(); new_tab->GetController().LoadURL( url, content::Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - content::NavigationEntry* entry = new_tab->GetController().GetPendingEntry(); content::RenderFrameHostTester::For(new_tab->GetMainFrame()) - ->SendNavigate(extra_tabs_.size() + 1, entry->GetUniqueID(), true, url); + ->SendNavigate(extra_tabs_.size() + 1, url); // Set up required helpers, and make this be as "tabby" as the code requires. #if defined(ENABLE_EXTENSIONS) diff --git a/chrome/browser/rlz/rlz_unittest.cc b/chrome/browser/rlz/rlz_unittest.cc index 5539649..0a0f7a2 100644 --- a/chrome/browser/rlz/rlz_unittest.cc +++ b/chrome/browser/rlz/rlz_unittest.cc @@ -270,11 +270,9 @@ void RlzLibTest::SimulateHomepageUsage() { content::RenderFrameHostTester::For(main_rfh()); // Simulate a navigation to homepage first. - rfht->SendNavigateWithTransition( - 0, 0, true, home_url, ui::PAGE_TRANSITION_HOME_PAGE); + rfht->SendNavigateWithTransition(0, home_url, ui::PAGE_TRANSITION_HOME_PAGE); // Then simulate a search from homepage. - rfht->SendNavigateWithTransition( - 1, 0, true, search_url, ui::PAGE_TRANSITION_LINK); + rfht->SendNavigateWithTransition(1, search_url, ui::PAGE_TRANSITION_LINK); } void RlzLibTest::SimulateAppListUsage() { diff --git a/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc b/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc index 0cd880c..9e92f20 100644 --- a/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc +++ b/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc @@ -25,7 +25,6 @@ #include "components/history/core/browser/history_backend.h" #include "components/history/core/browser/history_service.h" #include "content/public/browser/navigation_controller.h" -#include "content/public/browser/navigation_entry.h" #include "content/public/browser/web_contents.h" #include "content/public/common/referrer.h" #include "content/public/test/test_browser_thread.h" @@ -133,8 +132,6 @@ class BrowserFeatureExtractorTest : public ChromeRenderViewHostTestHarness { web_contents()->GetController().LoadURL( url, content::Referrer(referrer, blink::WebReferrerPolicyDefault), type, std::string()); - int pending_id = - web_contents()->GetController().GetPendingEntry()->GetUniqueID(); static int page_id = 0; content::RenderFrameHost* rfh = @@ -144,7 +141,7 @@ class BrowserFeatureExtractorTest : public ChromeRenderViewHostTestHarness { } WebContentsTester::For(web_contents())->ProceedWithCrossSiteNavigation(); WebContentsTester::For(web_contents())->TestDidNavigateWithReferrer( - rfh, ++page_id, pending_id, true, url, + rfh, ++page_id, url, content::Referrer(referrer, blink::WebReferrerPolicyDefault), type); } diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc index cdc185a..536953a 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc @@ -120,36 +120,10 @@ class SafeBrowsingBlockingPageTest : public ChromeRenderViewHostTestHarness { user_response_ = CANCEL; } - void Navigate(const char* url, - int page_id, - int nav_entry_id, - bool did_create_new_entry) { - NavigateInternal(url, page_id, nav_entry_id, did_create_new_entry, false); - } - - void NavigateCrossSite(const char* url, - int page_id, - int nav_entry_id, - bool did_create_new_entry) { - NavigateInternal(url, page_id, nav_entry_id, did_create_new_entry, true); - } - - void NavigateInternal(const char* url, - int page_id, - int nav_entry_id, - bool did_create_new_entry, - bool is_cross_site) { - // The pending RVH should commit for cross-site navigations. - content::RenderFrameHost* render_frame_host = - is_cross_site - ? content::WebContentsTester::For(web_contents()) - ->GetPendingMainFrame() - : web_contents()->GetMainFrame(); - - content::WebContentsTester::For(web_contents()) - ->TestDidNavigate(render_frame_host, page_id, nav_entry_id, - did_create_new_entry, GURL(url), - ui::PAGE_TRANSITION_TYPED); + void Navigate(const char* url, int page_id) { + WebContentsTester::For(web_contents())->TestDidNavigate( + web_contents()->GetMainFrame(), page_id, GURL(url), + ui::PAGE_TRANSITION_TYPED); } void GoBack(bool is_cross_site) { @@ -165,9 +139,7 @@ class SafeBrowsingBlockingPageTest : public ChromeRenderViewHostTestHarness { WebContentsTester::For(web_contents())->TestDidNavigate( rfh, entry->GetPageID(), - entry->GetUniqueID(), - false, - entry->GetURL(), + GURL(entry->GetURL()), ui::PAGE_TRANSITION_TYPED); } @@ -252,7 +224,8 @@ TEST_F(SafeBrowsingBlockingPageTest, MalwarePageDontProceed) { // Simulate the load causing a safe browsing interstitial to be shown. ShowInterstitial(false, kBadURL); - SafeBrowsingBlockingPage* sb_interstitial = GetSafeBrowsingBlockingPage(); + SafeBrowsingBlockingPage* sb_interstitial = + GetSafeBrowsingBlockingPage(); ASSERT_TRUE(sb_interstitial); base::RunLoop().RunUntilIdle(); @@ -283,11 +256,11 @@ TEST_F(SafeBrowsingBlockingPageTest, MalwarePageProceed) { // Start a load. controller().LoadURL(GURL(kBadURL), content::Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int pending_id = controller().GetPendingEntry()->GetUniqueID(); // Simulate the load causing a safe browsing interstitial to be shown. ShowInterstitial(false, kBadURL); - SafeBrowsingBlockingPage* sb_interstitial = GetSafeBrowsingBlockingPage(); + SafeBrowsingBlockingPage* sb_interstitial = + GetSafeBrowsingBlockingPage(); ASSERT_TRUE(sb_interstitial); // Simulate the user clicking "proceed". @@ -296,7 +269,7 @@ TEST_F(SafeBrowsingBlockingPageTest, MalwarePageProceed) { // The interstitial is shown until the navigation commits. ASSERT_TRUE(InterstitialPage::GetInterstitialPage(web_contents())); // Commit the navigation. - Navigate(kBadURL, 1, pending_id, true); + Navigate(kBadURL, 1); // The interstitial should be gone now. ASSERT_FALSE(InterstitialPage::GetInterstitialPage(web_contents())); @@ -315,15 +288,16 @@ TEST_F(SafeBrowsingBlockingPageTest, PageWithMalwareResourceDontProceed) { prefs::kSafeBrowsingExtendedReportingEnabled, true); // Navigate somewhere. - Navigate(kGoogleURL, 1, 0, true); + Navigate(kGoogleURL, 1); // Navigate somewhere else. - Navigate(kGoodURL, 2, 0, true); + Navigate(kGoodURL, 2); // Simulate that page loading a bad-resource triggering an interstitial. ShowInterstitial(true, kBadURL); - SafeBrowsingBlockingPage* sb_interstitial = GetSafeBrowsingBlockingPage(); + SafeBrowsingBlockingPage* sb_interstitial = + GetSafeBrowsingBlockingPage(); ASSERT_TRUE(sb_interstitial); // Simulate the user clicking "don't proceed". @@ -351,12 +325,13 @@ TEST_F(SafeBrowsingBlockingPageTest, PageWithMalwareResourceProceed) { prefs::kSafeBrowsingExtendedReportingEnabled, true); // Navigate somewhere. - Navigate(kGoodURL, 1, 0, true); + Navigate(kGoodURL, 1); // Simulate that page loading a bad-resource triggering an interstitial. ShowInterstitial(true, kBadURL); - SafeBrowsingBlockingPage* sb_interstitial = GetSafeBrowsingBlockingPage(); + SafeBrowsingBlockingPage* sb_interstitial = + GetSafeBrowsingBlockingPage(); ASSERT_TRUE(sb_interstitial); // Simulate the user clicking "proceed". @@ -385,10 +360,10 @@ TEST_F(SafeBrowsingBlockingPageTest, prefs::kSafeBrowsingExtendedReportingEnabled, true); // Navigate somewhere. - Navigate(kGoogleURL, 1, 0, true); + Navigate(kGoogleURL, 1); // Navigate somewhere else. - Navigate(kGoodURL, 2, 0, true); + Navigate(kGoodURL, 2); // Simulate that page loading a bad-resource triggering an interstitial. ShowInterstitial(true, kBadURL); @@ -398,7 +373,8 @@ TEST_F(SafeBrowsingBlockingPageTest, ShowInterstitial(true, kBadURL2); ShowInterstitial(true, kBadURL3); - SafeBrowsingBlockingPage* sb_interstitial = GetSafeBrowsingBlockingPage(); + SafeBrowsingBlockingPage* sb_interstitial = + GetSafeBrowsingBlockingPage(); ASSERT_TRUE(sb_interstitial); // Simulate the user clicking "don't proceed". @@ -427,10 +403,10 @@ TEST_F(SafeBrowsingBlockingPageTest, prefs::kSafeBrowsingExtendedReportingEnabled, true); // Navigate somewhere. - Navigate(kGoogleURL, 1, 0, true); + Navigate(kGoogleURL, 1); // Navigate somewhere else. - Navigate(kGoodURL, 2, 0, true); + Navigate(kGoodURL, 2); // Simulate that page loading a bad-resource triggering an interstitial. ShowInterstitial(true, kBadURL); @@ -440,7 +416,8 @@ TEST_F(SafeBrowsingBlockingPageTest, ShowInterstitial(true, kBadURL2); ShowInterstitial(true, kBadURL3); - SafeBrowsingBlockingPage* sb_interstitial = GetSafeBrowsingBlockingPage(); + SafeBrowsingBlockingPage* sb_interstitial = + GetSafeBrowsingBlockingPage(); ASSERT_TRUE(sb_interstitial); // Proceed through the 1st interstitial. @@ -476,7 +453,8 @@ TEST_F(SafeBrowsingBlockingPageTest, // Tests showing a blocking page for a page that contains multiple malware // subresources and proceeding through the multiple interstitials. -TEST_F(SafeBrowsingBlockingPageTest, PageWithMultipleMalwareResourceProceed) { +TEST_F(SafeBrowsingBlockingPageTest, + PageWithMultipleMalwareResourceProceed) { // Enable malware reports. Profile* profile = Profile::FromBrowserContext( web_contents()->GetBrowserContext()); @@ -484,7 +462,7 @@ TEST_F(SafeBrowsingBlockingPageTest, PageWithMultipleMalwareResourceProceed) { prefs::kSafeBrowsingExtendedReportingEnabled, true); // Navigate somewhere else. - Navigate(kGoodURL, 1, 0, true); + Navigate(kGoodURL, 1); // Simulate that page loading a bad-resource triggering an interstitial. ShowInterstitial(true, kBadURL); @@ -494,7 +472,8 @@ TEST_F(SafeBrowsingBlockingPageTest, PageWithMultipleMalwareResourceProceed) { ShowInterstitial(true, kBadURL2); ShowInterstitial(true, kBadURL3); - SafeBrowsingBlockingPage* sb_interstitial = GetSafeBrowsingBlockingPage(); + SafeBrowsingBlockingPage* sb_interstitial = + GetSafeBrowsingBlockingPage(); ASSERT_TRUE(sb_interstitial); // Proceed through the 1st interstitial. @@ -536,19 +515,19 @@ TEST_F(SafeBrowsingBlockingPageTest, NavigatingBackAndForth) { prefs::kSafeBrowsingExtendedReportingEnabled, true); // Navigate somewhere. - Navigate(kGoodURL, 1, 0, true); + Navigate(kGoodURL, 1); // Now navigate to a bad page triggerring an interstitial. controller().LoadURL(GURL(kBadURL), content::Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int pending_id = controller().GetPendingEntry()->GetUniqueID(); ShowInterstitial(false, kBadURL); - SafeBrowsingBlockingPage* sb_interstitial = GetSafeBrowsingBlockingPage(); + SafeBrowsingBlockingPage* sb_interstitial = + GetSafeBrowsingBlockingPage(); ASSERT_TRUE(sb_interstitial); // Proceed, then navigate back. ProceedThroughInterstitial(sb_interstitial); - Navigate(kBadURL, 2, pending_id, true); // Commit the navigation. + Navigate(kBadURL, 2); // Commit the navigation. GoBack(true); // We are back on the good page. @@ -559,15 +538,13 @@ TEST_F(SafeBrowsingBlockingPageTest, NavigatingBackAndForth) { // Navigate forward to the malware URL. web_contents()->GetController().GoForward(); - pending_id = controller().GetPendingEntry()->GetUniqueID(); ShowInterstitial(false, kBadURL); sb_interstitial = GetSafeBrowsingBlockingPage(); ASSERT_TRUE(sb_interstitial); // Let's proceed and make sure everything is OK (bug 17627). ProceedThroughInterstitial(sb_interstitial); - // Commit the navigation. - NavigateCrossSite(kBadURL, 2, pending_id, false); + Navigate(kBadURL, 2); // Commit the navigation. sb_interstitial = GetSafeBrowsingBlockingPage(); ASSERT_FALSE(sb_interstitial); ASSERT_EQ(2, controller().GetEntryCount()); @@ -593,7 +570,8 @@ TEST_F(SafeBrowsingBlockingPageTest, ProceedThenDontProceed) { // Simulate the load causing a safe browsing interstitial to be shown. ShowInterstitial(false, kBadURL); - SafeBrowsingBlockingPage* sb_interstitial = GetSafeBrowsingBlockingPage(); + SafeBrowsingBlockingPage* sb_interstitial = + GetSafeBrowsingBlockingPage(); ASSERT_TRUE(sb_interstitial); base::RunLoop().RunUntilIdle(); @@ -629,7 +607,8 @@ TEST_F(SafeBrowsingBlockingPageTest, MalwareReportsDisabled) { // Simulate the load causing a safe browsing interstitial to be shown. ShowInterstitial(false, kBadURL); - SafeBrowsingBlockingPage* sb_interstitial = GetSafeBrowsingBlockingPage(); + SafeBrowsingBlockingPage* sb_interstitial = + GetSafeBrowsingBlockingPage(); ASSERT_TRUE(sb_interstitial); base::RunLoop().RunUntilIdle(); @@ -663,7 +642,8 @@ TEST_F(SafeBrowsingBlockingPageTest, MalwareReportsToggling) { // Simulate the load causing a safe browsing interstitial to be shown. ShowInterstitial(false, kBadURL); - SafeBrowsingBlockingPage* sb_interstitial = GetSafeBrowsingBlockingPage(); + SafeBrowsingBlockingPage* sb_interstitial = + GetSafeBrowsingBlockingPage(); ASSERT_TRUE(sb_interstitial); base::RunLoop().RunUntilIdle(); diff --git a/chrome/browser/translate/translate_manager_render_view_host_unittest.cc b/chrome/browser/translate/translate_manager_render_view_host_unittest.cc index 4eb0792..7772956b 100644 --- a/chrome/browser/translate/translate_manager_render_view_host_unittest.cc +++ b/chrome/browser/translate/translate_manager_render_view_host_unittest.cc @@ -840,11 +840,8 @@ TEST_F(TranslateManagerRenderViewHostTest, ReloadFromLocationBar) { NavEntryCommittedObserver nav_observer(web_contents()); web_contents()->GetController().LoadURL( url, content::Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int pending_id = - web_contents()->GetController().GetPendingEntry()->GetUniqueID(); content::RenderFrameHostTester::For(web_contents()->GetMainFrame()) - ->SendNavigateWithTransition(0, pending_id, false, url, - ui::PAGE_TRANSITION_TYPED); + ->SendNavigateWithTransition(0, url, ui::PAGE_TRANSITION_TYPED); // Test that we are really getting a same page navigation, the test would be // useless if it was not the case. @@ -897,12 +894,12 @@ TEST_F(TranslateManagerRenderViewHostTest, CloseInfoBarInSubframeNavigation) { // Simulate a sub-frame auto-navigating. subframe_tester->SendNavigateWithTransition( - 0, 0, false, GURL("http://pub.com"), ui::PAGE_TRANSITION_AUTO_SUBFRAME); + 0, GURL("http://pub.com"), ui::PAGE_TRANSITION_AUTO_SUBFRAME); EXPECT_TRUE(GetTranslateInfoBar() == NULL); // Simulate the user navigating in a sub-frame. subframe_tester->SendNavigateWithTransition( - 1, 0, true, GURL("http://pub.com"), ui::PAGE_TRANSITION_MANUAL_SUBFRAME); + 1, GURL("http://pub.com"), ui::PAGE_TRANSITION_MANUAL_SUBFRAME); EXPECT_TRUE(GetTranslateInfoBar() == NULL); // Navigate out of page, a new infobar should show. diff --git a/chrome/browser/ui/autofill/generated_credit_card_bubble_controller_unittest.cc b/chrome/browser/ui/autofill/generated_credit_card_bubble_controller_unittest.cc index 41f3950..7454e2a 100644 --- a/chrome/browser/ui/autofill/generated_credit_card_bubble_controller_unittest.cc +++ b/chrome/browser/ui/autofill/generated_credit_card_bubble_controller_unittest.cc @@ -15,8 +15,6 @@ #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_profile.h" #include "components/autofill/core/browser/autofill_test_utils.h" -#include "content/public/browser/navigation_details.h" -#include "content/public/browser/navigation_entry.h" #include "content/public/browser/web_contents.h" #include "content/public/test/test_browser_thread_bundle.h" #include "content/public/test/web_contents_tester.h" @@ -78,19 +76,9 @@ class GeneratedCreditCardBubbleControllerTest : public testing::Test { BackingCard()); } - void NavigateWithTransition(ui::PageTransition transition) { - content::LoadCommittedDetails details; - content::FrameNavigateParams params; - - // The transition is in two places; fill in both. - scoped_ptr<content::NavigationEntry> navigation_entry( - content::NavigationEntry::Create()); - navigation_entry->SetTransitionType(transition); - params.transition = transition; - details.entry = navigation_entry.get(); - - ASSERT_NE(nullptr, controller()); - controller()->DidNavigateMainFrame(details, params); + void NavigateWithTransition(ui::PageTransition trans) { + content::WebContentsTester::For(test_web_contents_.get())->TestDidNavigate( + test_web_contents_->GetMainFrame(), 1, GURL("about:blank"), trans); } private: diff --git a/chrome/test/base/browser_with_test_window_test.cc b/chrome/test/base/browser_with_test_window_test.cc index 245c9b9..09f57d5 100644 --- a/chrome/test/base/browser_with_test_window_test.cc +++ b/chrome/test/base/browser_with_test_window_test.cc @@ -165,16 +165,12 @@ void BrowserWithTestWindowTest::CommitPendingLoad( if (controller->GetPendingEntryIndex() >= 0) { test_rfh_tester->SendNavigateWithTransition( controller->GetPendingEntry()->GetPageID(), - controller->GetPendingEntry()->GetUniqueID(), - false, controller->GetPendingEntry()->GetURL(), controller->GetPendingEntry()->GetTransitionType()); } else { test_rfh_tester->SendNavigateWithTransition( controller->GetWebContents()->GetMaxPageIDForSiteInstance( test_rfh->GetSiteInstance()) + 1, - controller->GetPendingEntry()->GetUniqueID(), - true, controller->GetPendingEntry()->GetURL(), controller->GetPendingEntry()->GetTransitionType()); } diff --git a/components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_blocking_page_unittest.cc b/components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_blocking_page_unittest.cc index 64d5076..0effde6 100644 --- a/components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_blocking_page_unittest.cc +++ b/components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_blocking_page_unittest.cc @@ -104,56 +104,29 @@ class DataReductionProxyDebugBlockingPageTest user_response_ = CANCEL; } - void Navigate(const char* url, - int page_id, - int nav_entry_id, - bool did_create_new_entry) { - NavigateInternal(url, page_id, nav_entry_id, did_create_new_entry, false); - } - - void NavigateCrossSite(const char* url, - int page_id, - int nav_entry_id, - bool did_create_new_entry) { - NavigateInternal(url, page_id, nav_entry_id, did_create_new_entry, true); - } - - void NavigateInternal(const char* url, - int page_id, - int nav_entry_id, - bool did_create_new_entry, - bool is_cross_site) { - // The pending RVH should commit for cross-site navigations. - content::RenderFrameHost* render_frame_host = - is_cross_site - ? content::WebContentsTester::For(web_contents()) - ->GetPendingMainFrame() - : web_contents()->GetMainFrame(); - - content::WebContentsTester::For(web_contents()) - ->TestDidNavigate(render_frame_host, page_id, nav_entry_id, - did_create_new_entry, GURL(url), - ui::PAGE_TRANSITION_TYPED); + void Navigate(const char* url, int page_id) { + content::WebContentsTester::For(web_contents())->TestDidNavigate( + web_contents()->GetMainFrame(), page_id, GURL(url), + ui::PAGE_TRANSITION_TYPED); } void GoBack(bool is_cross_site) { - content::NavigationEntry* entry = - web_contents()->GetController().GetEntryAtOffset(-1); - ASSERT_TRUE(entry); - web_contents()->GetController().GoBack(); - - // The pending RVH should commit for cross-site navigations. - content::RenderFrameHost* render_frame_host = - is_cross_site - ? content::WebContentsTester::For(web_contents()) - ->GetPendingMainFrame() - : web_contents()->GetMainFrame(); - - content::WebContentsTester::For(web_contents()) - ->TestDidNavigate(render_frame_host, entry->GetPageID(), - entry->GetUniqueID(), false, GURL(entry->GetURL()), - ui::PAGE_TRANSITION_TYPED); - } + content::NavigationEntry* entry = + web_contents()->GetController().GetEntryAtOffset(-1); + ASSERT_TRUE(entry); + web_contents()->GetController().GoBack(); + + // The pending RVH should commit for cross-site navigations. + content::RenderFrameHost* render_frame_host = is_cross_site ? + content::WebContentsTester::For( + web_contents())->GetPendingMainFrame() : + web_contents()->GetMainFrame(); + content::WebContentsTester::For(web_contents())->TestDidNavigate( + render_frame_host, + entry->GetPageID(), + GURL(entry->GetURL()), + ui::PAGE_TRANSITION_TYPED); + } void ShowInterstitial(bool is_subresource, const char* url) { DataReductionProxyDebugUIManager::BypassResource resource; @@ -256,7 +229,6 @@ TEST_F(DataReductionProxyDebugBlockingPageTest, BypassPageProceed) { // Start a load. controller().LoadURL(GURL(kBypassURL), content::Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int pending_id = controller().GetPendingEntry()->GetUniqueID(); // Simulate the load causing an interstitial to be shown. ShowInterstitial(false, kBypassURL); @@ -272,7 +244,7 @@ TEST_F(DataReductionProxyDebugBlockingPageTest, BypassPageProceed) { // The interstitial is shown until the navigation commits. ASSERT_TRUE(GetDataReductionProxyDebugBlockingPage()); // Commit the navigation. - Navigate(kBypassURL, 1, pending_id, true); + Navigate(kBypassURL, 1); // The interstitial should be gone now. EXPECT_EQ(OK, user_response()); ASSERT_FALSE(GetDataReductionProxyDebugBlockingPage()); @@ -282,10 +254,10 @@ TEST_F(DataReductionProxyDebugBlockingPageTest, BypassPageProceed) { // and not proceeding. TEST_F(DataReductionProxyDebugBlockingPageTest, BypassSubresourceDontProceed) { // Navigate somewhere. - Navigate(kGoogleURL, 1, 0, true); + Navigate(kGoogleURL, 1); // Navigate somewhere else. - Navigate(kOtherURL, 2, 0, true); + Navigate(kOtherURL, 2); // Simulate that page loading a bypass-resource triggering an interstitial. ShowInterstitial(true, kBypassURL); @@ -311,7 +283,7 @@ TEST_F(DataReductionProxyDebugBlockingPageTest, BypassSubresourceDontProceed) { // and proceeding. TEST_F(DataReductionProxyDebugBlockingPageTest, BypassSubresourceProceed) { // Navigate somewhere. - Navigate(kGoogleURL, 1, 0, true); + Navigate(kGoogleURL, 1); // Simulate that page loading a bypass-resource triggering an interstitial. ShowInterstitial(true, kBypassURL); @@ -338,15 +310,15 @@ TEST_F(DataReductionProxyDebugBlockingPageTest, BypassSubresourceProceed) { TEST_F(DataReductionProxyDebugBlockingPageTest, BypassMultipleSubresourcesDontProceed) { // Navigate somewhere. - Navigate(kGoogleURL, 1, 0, true); + Navigate(kGoogleURL, 1); // Navigate somewhere else. - Navigate(kOtherURL, 2, 0, true); + Navigate(kOtherURL, 2); // Simulate that page loading a bypass-resource triggering an interstitial. ShowInterstitial(true, kBypassURL); - // More bypassed resources loading causing more interstitials. The new + // More bypassedd resources loading causing more interstitials. The new // interstitials should be queued. ShowInterstitial(true, kBypassURL2); ShowInterstitial(true, kBypassURL3); @@ -360,7 +332,7 @@ TEST_F(DataReductionProxyDebugBlockingPageTest, EXPECT_EQ(CANCEL, user_response()); EXPECT_FALSE(GetDataReductionProxyDebugBlockingPage()); - // The user did not proceed, the controller should be back to the first page, + // The user did not proceed, the controler should be back to the first page, // the 2nd one should have been removed from the navigation controller. ASSERT_EQ(1, controller().GetEntryCount()); EXPECT_EQ(kGoogleURL, controller().GetActiveEntry()->GetURL().spec()); @@ -372,7 +344,7 @@ TEST_F(DataReductionProxyDebugBlockingPageTest, TEST_F(DataReductionProxyDebugBlockingPageTest, BypassMultipleSubresourcesProceed) { // Navigate somewhere. - Navigate(kGoogleURL, 1, 0, true); + Navigate(kGoogleURL, 1); // Simulate that page loading a bypass-resource triggering an interstitial. ShowInterstitial(true, kBypassURL); @@ -399,12 +371,11 @@ TEST_F(DataReductionProxyDebugBlockingPageTest, // controller entries are OK. TEST_F(DataReductionProxyDebugBlockingPageTest, NavigatingBackAndForth) { // Navigate somewhere. - Navigate(kGoogleURL, 1, 0, true); + Navigate(kGoogleURL, 1); // Now navigate to a bypassed page triggerring an interstitial. controller().LoadURL(GURL(kBypassURL), content::Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int pending_id = controller().GetPendingEntry()->GetUniqueID(); ShowInterstitial(false, kBypassURL); DataReductionProxyDebugBlockingPage* interstitial = GetDataReductionProxyDebugBlockingPage(); @@ -412,7 +383,7 @@ TEST_F(DataReductionProxyDebugBlockingPageTest, NavigatingBackAndForth) { // Proceed through the 1st interstitial. ProceedThroughInterstitial(interstitial); - Navigate(kBypassURL, 2, pending_id, true); // Commit navigation. + Navigate(kBypassURL, 2); // Commit the navigation. GoBack(true); // We are back on the first page. @@ -423,15 +394,13 @@ TEST_F(DataReductionProxyDebugBlockingPageTest, NavigatingBackAndForth) { // Navigate forward to the bypassed URL. web_contents()->GetController().GoForward(); - pending_id = controller().GetPendingEntry()->GetUniqueID(); ShowInterstitial(false, kBypassURL); interstitial = GetDataReductionProxyDebugBlockingPage(); ASSERT_TRUE(interstitial); // Let's proceed and make sure everything is OK. ProceedThroughInterstitial(interstitial); - // Commit the navigation. - NavigateCrossSite(kBypassURL, 2, pending_id, false); + Navigate(kBypassURL, 2); // Commit the navigation. interstitial = GetDataReductionProxyDebugBlockingPage(); ASSERT_FALSE(interstitial); ASSERT_EQ(2, controller().GetEntryCount()); diff --git a/content/browser/devtools/devtools_manager_unittest.cc b/content/browser/devtools/devtools_manager_unittest.cc index 7dcb3a7..5231d5e 100644 --- a/content/browser/devtools/devtools_manager_unittest.cc +++ b/content/browser/devtools/devtools_manager_unittest.cc @@ -251,10 +251,9 @@ TEST_F(DevToolsManagerTest, ReattachOnCancelPendingNavigation) { const GURL url("http://www.google.com"); controller().LoadURL( url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int pending_id = controller().GetPendingEntry()->GetUniqueID(); contents()->GetMainFrame()->PrepareForCommit(); - contents()->TestDidNavigate(contents()->GetMainFrame(), 1, pending_id, true, - url, ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate( + contents()->GetMainFrame(), 1, url, ui::PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->CrossProcessNavigationPending()); TestDevToolsClientHost client_host; @@ -273,10 +272,9 @@ TEST_F(DevToolsManagerTest, ReattachOnCancelPendingNavigation) { // Interrupt pending navigation and navigate back to the original site. controller().LoadURL( url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - pending_id = controller().GetPendingEntry()->GetUniqueID(); contents()->GetMainFrame()->PrepareForCommit(); - contents()->TestDidNavigate(contents()->GetMainFrame(), 1, pending_id, false, - url, ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate( + contents()->GetMainFrame(), 1, url, ui::PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->CrossProcessNavigationPending()); EXPECT_EQ(client_host.agent_host(), DevToolsAgentHost::GetOrCreateFor(web_contents()).get()); diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc index 1953f51..8c9f033 100644 --- a/content/browser/frame_host/navigation_controller_impl.cc +++ b/content/browser/frame_host/navigation_controller_impl.cc @@ -819,13 +819,6 @@ bool NavigationControllerImpl::RendererDidNavigate( // Do navigation-type specific actions. These will make and commit an entry. details->type = ClassifyNavigation(rfh, params); - if (!base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kSitePerProcess)) { - // For site-per-process, both ClassifyNavigation methods get it wrong (see - // http://crbug.com/464014) so don't worry about a mismatch if that's the - // case. - DCHECK_EQ(details->type, ClassifyNavigationWithoutPageID(rfh, params)); - } // is_in_page must be computed before the entry gets committed. details->is_in_page = AreURLsInPageNavigation(rfh->GetLastCommittedURL(), @@ -1070,121 +1063,6 @@ NavigationType NavigationControllerImpl::ClassifyNavigation( return NAVIGATION_TYPE_EXISTING_PAGE; } -NavigationType NavigationControllerImpl::ClassifyNavigationWithoutPageID( - RenderFrameHostImpl* rfh, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params) const { - if (params.did_create_new_entry) { - // A new entry. We may or may not have a pending entry for the page, and - // this may or may not be the main frame. - if (ui::PageTransitionIsMainFrame(params.transition)) { - // TODO(avi): I want to use |if (!rfh->GetParent())| here but lots of unit - // tests fake auto subframe commits by sending the main frame a - // PAGE_TRANSITION_AUTO_SUBFRAME transition. Fix those, and adjust here. - return NAVIGATION_TYPE_NEW_PAGE; - } - - // When this is a new subframe navigation, we should have a committed page - // in which it's a subframe. This may not be the case when an iframe is - // navigated on a popup navigated to about:blank (the iframe would be - // written into the popup by script on the main page). For these cases, - // there isn't any navigation stuff we can do, so just ignore it. - if (!GetLastCommittedEntry()) - return NAVIGATION_TYPE_NAV_IGNORE; - - // Valid subframe navigation. - return NAVIGATION_TYPE_NEW_SUBFRAME; - } - - // We only clear the session history when navigating to a new page. - DCHECK(!params.history_list_was_cleared); - - if (!ui::PageTransitionIsMainFrame(params.transition)) { - // All manual subframes would be did_create_new_entry and handled above, so - // we know this is auto. - if (GetLastCommittedEntry()) { - return NAVIGATION_TYPE_AUTO_SUBFRAME; - } else { - // We ignore subframes created in non-committed pages; we'd appreciate if - // people stopped doing that. - return NAVIGATION_TYPE_NAV_IGNORE; - } - } - - if (params.nav_entry_id == 0) { - // This is a renderer-initiated navigation (nav_entry_id == 0), but didn't - // create a new page. - - // Just like above in the did_create_new_entry case, it's possible to - // scribble onto an uncommitted page. Again, there isn't any navigation - // stuff that we can do, so ignore it here as well. - if (!GetLastCommittedEntry()) - return NAVIGATION_TYPE_NAV_IGNORE; - - if (params.was_within_same_page) { - // This is history.replaceState(), which is renderer-initiated yet within - // the same page. - return NAVIGATION_TYPE_IN_PAGE; - } else { - // This is history.reload() or a client-side redirect. - return NAVIGATION_TYPE_EXISTING_PAGE; - } - } - - if (pending_entry_ && pending_entry_index_ == -1 && - pending_entry_->GetUniqueID() == params.nav_entry_id) { - // In this case, we have a pending entry for a load of a new URL but Blink - // didn't do a new navigation (params.did_create_new_entry). This happens - // when you press enter in the URL bar to reload. We will create a pending - // entry, but Blink will convert it to a reload since it's the same page and - // not create a new entry for it (the user doesn't want to have a new - // back/forward entry when they do this). Therefore we want to just ignore - // the pending entry and go back to where we were (the "existing entry"). - return NAVIGATION_TYPE_SAME_PAGE; - } - - if (params.intended_as_new_entry) { - // This was intended to be a navigation to a new entry but the pending entry - // got cleared in the meanwhile. Classify as EXISTING_PAGE because we may or - // may not have a pending entry. - return NAVIGATION_TYPE_EXISTING_PAGE; - } - - if (params.url_is_unreachable && failed_pending_entry_id_ != 0 && - params.nav_entry_id == failed_pending_entry_id_) { - // If the renderer was going to a new pending entry that got cleared because - // of an error, this is the case of the user trying to retry a failed load - // by pressing return. Classify as EXISTING_PAGE because we probably don't - // have a pending entry. - return NAVIGATION_TYPE_EXISTING_PAGE; - } - - // Now we know that the notification is for an existing page. Find that entry. - int existing_entry_index = GetEntryIndexWithUniqueID(params.nav_entry_id); - if (existing_entry_index == -1) { - // The page was not found. It could have been pruned because of the limit on - // back/forward entries (not likely since we'll usually tell it to navigate - // to such entries). It could also mean that the renderer is smoking crack. - // TODO(avi): Crash the renderer like we do in the old ClassifyNavigation? - NOTREACHED() << "Could not find nav entry with id " << params.nav_entry_id; - return NAVIGATION_TYPE_NAV_IGNORE; - } - - // Any top-level navigations with the same base (minus the reference fragment) - // are in-page navigations. (We weeded out subframe navigations above.) Most - // of the time this doesn't matter since Blink doesn't tell us about subframe - // navigations that don't actually navigate, but it can happen when there is - // an encoding override (it always sends a navigation request). - NavigationEntryImpl* existing_entry = entries_[existing_entry_index].get(); - if (AreURLsInPageNavigation(existing_entry->GetURL(), params.url, - params.was_within_same_page, rfh)) { - return NAVIGATION_TYPE_IN_PAGE; - } - - // Since we weeded out "new" navigations above, we know this is an existing - // (back/forward) navigation. - return NAVIGATION_TYPE_EXISTING_PAGE; -} - void NavigationControllerImpl::RendererDidNavigateToNewPage( RenderFrameHostImpl* rfh, const FrameHostMsg_DidCommitProvisionalLoad_Params& params, @@ -1946,15 +1824,6 @@ int NavigationControllerImpl::GetEntryIndexWithPageID( return -1; } -int NavigationControllerImpl::GetEntryIndexWithUniqueID( - int nav_entry_id) const { - for (int i = static_cast<int>(entries_.size()) - 1; i >= 0; --i) { - if (entries_[i]->GetUniqueID() == nav_entry_id) - return i; - } - return -1; -} - NavigationEntryImpl* NavigationControllerImpl::GetTransientEntry() const { if (transient_entry_index_ == -1) return NULL; diff --git a/content/browser/frame_host/navigation_controller_impl.h b/content/browser/frame_host/navigation_controller_impl.h index 85469401..da3bbd3 100644 --- a/content/browser/frame_host/navigation_controller_impl.h +++ b/content/browser/frame_host/navigation_controller_impl.h @@ -107,9 +107,6 @@ class CONTENT_EXPORT NavigationControllerImpl int GetEntryIndexWithPageID(SiteInstance* instance, int32 page_id) const; - // Return the index of the entry with the given unique id, or -1 if not found. - int GetEntryIndexWithUniqueID(int nav_entry_id) const; - // Return the entry with the corresponding instance and page_id, or NULL if // not found. NavigationEntryImpl* GetEntryWithPageID( @@ -234,12 +231,6 @@ class CONTENT_EXPORT NavigationControllerImpl NavigationType ClassifyNavigation( RenderFrameHostImpl* rfh, const FrameHostMsg_DidCommitProvisionalLoad_Params& params) const; - // This does the same as above (hopefully), but does so without any use of - // deprecated page id values. Once it bakes and is verified to behave the - // same, it will replace it. http://crbug.com/369661 - NavigationType ClassifyNavigationWithoutPageID( - RenderFrameHostImpl* rfh, - const FrameHostMsg_DidCommitProvisionalLoad_Params& params) const; // Causes the controller to load the specified entry. The function assumes // ownership of the pointer since it is put in the navigation list. diff --git a/content/browser/frame_host/navigation_controller_impl_browsertest.cc b/content/browser/frame_host/navigation_controller_impl_browsertest.cc index 01d1c34..7a89b26 100644 --- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc +++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc @@ -1070,96 +1070,4 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, ResourceDispatcherHost::Get()->SetDelegate(nullptr); } -namespace { - -class FailureWatcher : public WebContentsObserver { - public: - // Observes failure for the specified |node|. - explicit FailureWatcher(FrameTreeNode* node) - : WebContentsObserver( - node->current_frame_host()->delegate()->GetAsWebContents()), - frame_tree_node_id_(node->frame_tree_node_id()), - message_loop_runner_(new MessageLoopRunner) {} - - void Wait() { - message_loop_runner_->Run(); - } - - private: - void DidFailLoad(RenderFrameHost* render_frame_host, - const GURL& validated_url, - int error_code, - const base::string16& error_description) override { - RenderFrameHostImpl* rfh = - static_cast<RenderFrameHostImpl*>(render_frame_host); - if (rfh->frame_tree_node()->frame_tree_node_id() != frame_tree_node_id_) - return; - - message_loop_runner_->Quit(); - } - - void DidFailProvisionalLoad( - RenderFrameHost* render_frame_host, - const GURL& validated_url, - int error_code, - const base::string16& error_description) override { - RenderFrameHostImpl* rfh = - static_cast<RenderFrameHostImpl*>(render_frame_host); - if (rfh->frame_tree_node()->frame_tree_node_id() != frame_tree_node_id_) - return; - - message_loop_runner_->Quit(); - } - - // The id of the FrameTreeNode whose navigations to observe. - int frame_tree_node_id_; - - // The MessageLoopRunner used to spin the message loop. - scoped_refptr<MessageLoopRunner> message_loop_runner_; -}; - -} // namespace - -IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, - StopCausesFailureDespiteJavaScriptURL) { - NavigationControllerImpl& controller = - static_cast<NavigationControllerImpl&>( - shell()->web_contents()->GetController()); - - FrameTreeNode* root = - static_cast<WebContentsImpl*>(shell()->web_contents())-> - GetFrameTree()->root(); - - // Start with a normal page. - GURL url1(embedded_test_server()->GetURL( - "/navigation_controller/simple_page_1.html")); - EXPECT_TRUE(NavigateToURL(shell(), url1)); - - // Have the user decide to go to a different page which is very slow. - StallDelegate stall_delegate; - ResourceDispatcherHost::Get()->SetDelegate(&stall_delegate); - GURL url2(embedded_test_server()->GetURL( - "/navigation_controller/simple_page_2.html")); - controller.LoadURL(url2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); - - // That should be the pending entry. - NavigationEntryImpl* entry = controller.GetPendingEntry(); - ASSERT_NE(nullptr, entry); - EXPECT_EQ(url2, entry->GetURL()); - - // Loading a JavaScript URL shouldn't affect the ability to stop. - { - FailureWatcher watcher(root); - GURL js("javascript:(function(){})()"); - controller.LoadURL(js, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); - // This LoadURL ends up purging the pending entry, which is why this is - // tricky. - EXPECT_EQ(nullptr, controller.GetPendingEntry()); - shell()->web_contents()->Stop(); - watcher.Wait(); - } - - ResourceDispatcherHost::Get()->SetDelegate(nullptr); -} - } // namespace content diff --git a/content/browser/frame_host/navigation_controller_impl_unittest.cc b/content/browser/frame_host/navigation_controller_impl_unittest.cc index 4a27b9a..b44a1b0 100644 --- a/content/browser/frame_host/navigation_controller_impl_unittest.cc +++ b/content/browser/frame_host/navigation_controller_impl_unittest.cc @@ -317,7 +317,7 @@ TEST_F(NavigationControllerTest, GoToOffset) { main_test_rfh()->SendRendererInitiatedNavigationRequest(urls[0], true); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, 0, true, urls[0]); + main_test_rfh()->SendNavigate(0, urls[0]); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; EXPECT_EQ(urls[0], controller.GetVisibleEntry()->GetVirtualURL()); @@ -328,7 +328,7 @@ TEST_F(NavigationControllerTest, GoToOffset) { for (int i = 1; i <= 4; ++i) { main_test_rfh()->SendRendererInitiatedNavigationRequest(urls[i], true); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(i, 0, true, urls[i]); + main_test_rfh()->SendNavigate(i, urls[i]); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; EXPECT_EQ(urls[i], controller.GetVisibleEntry()->GetVirtualURL()); @@ -360,12 +360,11 @@ TEST_F(NavigationControllerTest, GoToOffset) { for (int test = 0; test < NUM_TESTS; ++test) { int offset = test_offsets[test]; controller.GoToOffset(offset); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); url_index += offset; // Check that the GoToOffset will land on the expected page. EXPECT_EQ(urls[url_index], controller.GetPendingEntry()->GetVirtualURL()); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(url_index, entry_id, false, urls[url_index]); + main_test_rfh()->SendNavigate(url_index, urls[url_index]); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; // Check that we can go to any valid offset into the history. @@ -387,7 +386,6 @@ TEST_F(NavigationControllerTest, LoadURL) { controller.LoadURL( url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); // Creating a pending notification should not have issued any of the // notifications we're listening for. EXPECT_EQ(0U, notifications.size()); @@ -411,7 +409,7 @@ TEST_F(NavigationControllerTest, LoadURL) { EXPECT_EQ(0U, notifications.size()); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry_id, true, url1); + main_test_rfh()->SendNavigate(0, url1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -433,7 +431,6 @@ TEST_F(NavigationControllerTest, LoadURL) { // Load another... controller.LoadURL( url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - entry_id = controller.GetPendingEntry()->GetUniqueID(); // The load should now be pending. EXPECT_EQ(controller.GetEntryCount(), 1); @@ -452,7 +449,7 @@ TEST_F(NavigationControllerTest, LoadURL) { // Simulate the beforeunload ack for the cross-site transition, and then the // commit. main_test_rfh()->PrepareForCommit(); - contents()->GetPendingMainFrame()->SendNavigate(1, entry_id, true, url2); + contents()->GetPendingMainFrame()->SendNavigate(1, url2); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -492,22 +489,20 @@ TEST_F(NavigationControllerTest, LoadURLSameTime) { controller.LoadURL( url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry_id, true, url1); + main_test_rfh()->SendNavigate(0, url1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; // Load another... controller.LoadURL( url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - entry_id = controller.GetPendingEntry()->GetUniqueID(); // Simulate the beforeunload ack for the cross-site transition, and then the // commit. main_test_rfh()->PrepareForCommit(); - contents()->GetPendingMainFrame()->SendNavigate(1, entry_id, true, url2); + contents()->GetPendingMainFrame()->SendNavigate(1, url2); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -624,10 +619,9 @@ TEST_F(NavigationControllerTest, LoadURL_SamePage) { controller.LoadURL( url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); EXPECT_EQ(0U, notifications.size()); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry_id, true, url1); + main_test_rfh()->SendNavigate(0, url1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -637,10 +631,9 @@ TEST_F(NavigationControllerTest, LoadURL_SamePage) { controller.LoadURL( url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - entry_id = controller.GetPendingEntry()->GetUniqueID(); EXPECT_EQ(0U, notifications.size()); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry_id, false, url1); + main_test_rfh()->SendNavigate(0, url1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -674,8 +667,6 @@ TEST_F(NavigationControllerTest, LoadURL_SamePage_DifferentMethod) { url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); FrameHostMsg_DidCommitProvisionalLoad_Params params; params.page_id = 0; - params.nav_entry_id = controller.GetPendingEntry()->GetUniqueID(); - params.did_create_new_entry = true; params.url = url1; params.transition = ui::PAGE_TRANSITION_TYPED; params.is_post = true; @@ -693,8 +684,7 @@ TEST_F(NavigationControllerTest, LoadURL_SamePage_DifferentMethod) { controller.LoadURL( url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, controller.GetPendingEntry()->GetUniqueID(), - false, url1); + main_test_rfh()->SendNavigate(0, url1); // We should not have produced a new session history entry. ASSERT_EQ(controller.GetVisibleEntry(), entry); @@ -715,10 +705,9 @@ TEST_F(NavigationControllerTest, LoadURL_Discarded) { controller.LoadURL( url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); EXPECT_EQ(0U, notifications.size()); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry_id, true, url1); + main_test_rfh()->SendNavigate(0, url1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -756,17 +745,16 @@ TEST_F(NavigationControllerTest, LoadURL_NoPending) { const GURL kExistingURL1("http://eh"); controller.LoadURL( kExistingURL1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry_id, true, kExistingURL1); + main_test_rfh()->SendNavigate(0, kExistingURL1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; // Do a new navigation without making a pending one. const GURL kNewURL("http://see"); - main_test_rfh()->NavigateAndCommitRendererInitiated(99, true, kNewURL); + main_test_rfh()->NavigateAndCommitRendererInitiated(99, kNewURL); - // There should no longer be any pending entry, and the second navigation we + // There should no longer be any pending entry, and the third navigation we // just made should be committed. EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -788,9 +776,8 @@ TEST_F(NavigationControllerTest, LoadURL_NewPending) { const GURL kExistingURL1("http://eh"); controller.LoadURL( kExistingURL1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry_id, true, kExistingURL1); + main_test_rfh()->SendNavigate(0, kExistingURL1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -807,7 +794,7 @@ TEST_F(NavigationControllerTest, LoadURL_NewPending) { const GURL kNewURL("http://see"); main_test_rfh()->SendRendererInitiatedNavigationRequest(kNewURL, true); main_test_rfh()->PrepareForCommit(); - contents()->GetMainFrame()->SendNavigate(3, 0, true, kNewURL); + contents()->GetMainFrame()->SendNavigate(3, kNewURL); // There should no longer be any pending entry, and the third navigation we // just made should be committed. @@ -830,18 +817,16 @@ TEST_F(NavigationControllerTest, LoadURL_ExistingPending) { const GURL kExistingURL1("http://foo/eh"); controller.LoadURL( kExistingURL1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry_id, true, kExistingURL1); + main_test_rfh()->SendNavigate(0, kExistingURL1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; const GURL kExistingURL2("http://foo/bee"); controller.LoadURL( kExistingURL2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(1, entry_id, true, kExistingURL2); + main_test_rfh()->SendNavigate(1, kExistingURL2); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -856,9 +841,9 @@ TEST_F(NavigationControllerTest, LoadURL_ExistingPending) { const GURL kNewURL("http://foo/see"); main_test_rfh()->SendRendererInitiatedNavigationRequest(kNewURL, true); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(3, 0, true, kNewURL); + main_test_rfh()->SendNavigate(3, kNewURL); - // There should no longer be any pending entry, and the new navigation we + // There should no longer be any pending entry, and the third navigation we // just made should be committed. EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -879,11 +864,10 @@ TEST_F(NavigationControllerTest, LoadURL_PrivilegedPending) { const GURL kExistingURL1("http://privileged"); controller.LoadURL( kExistingURL1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); // Pretend it has bindings so we can tell if we incorrectly copy it. main_test_rfh()->GetRenderViewHost()->AllowBindings(2); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry_id, true, kExistingURL1); + main_test_rfh()->SendNavigate(0, kExistingURL1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -891,10 +875,9 @@ TEST_F(NavigationControllerTest, LoadURL_PrivilegedPending) { const GURL kExistingURL2("http://foo/eh"); controller.LoadURL( kExistingURL2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); TestRenderFrameHost* foo_rfh = contents()->GetPendingMainFrame(); - foo_rfh->SendNavigate(1, entry_id, true, kExistingURL2); + foo_rfh->SendNavigate(1, kExistingURL2); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -911,9 +894,9 @@ TEST_F(NavigationControllerTest, LoadURL_PrivilegedPending) { const GURL kNewURL("http://foo/bee"); foo_rfh->SendRendererInitiatedNavigationRequest(kNewURL, true); foo_rfh->PrepareForCommit(); - foo_rfh->SendNavigate(3, 0, true, kNewURL); + foo_rfh->SendNavigate(3, kNewURL); - // There should no longer be any pending entry, and the new navigation we + // There should no longer be any pending entry, and the third navigation we // just made should be committed. EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -935,24 +918,21 @@ TEST_F(NavigationControllerTest, LoadURL_BackPreemptsPending) { const GURL kExistingURL1("http://foo/eh"); controller.LoadURL( kExistingURL1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry_id, true, kExistingURL1); + main_test_rfh()->SendNavigate(0, kExistingURL1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; const GURL kExistingURL2("http://foo/bee"); controller.LoadURL( kExistingURL2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(1, entry_id, true, kExistingURL2); + main_test_rfh()->SendNavigate(1, kExistingURL2); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; // A back navigation comes in from the renderer... controller.GoToOffset(-1); - entry_id = controller.GetPendingEntry()->GetUniqueID(); // ...while the user tries to navigate to a new page... const GURL kNewURL("http://foo/see"); @@ -964,7 +944,7 @@ TEST_F(NavigationControllerTest, LoadURL_BackPreemptsPending) { // ...and the back navigation commits. main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry_id, false, kExistingURL1); + main_test_rfh()->SendNavigate(0, kExistingURL1); // There should no longer be any pending entry, and the back navigation should // be committed. @@ -1002,10 +982,10 @@ TEST_F(NavigationControllerTest, LoadURL_IgnorePreemptsPending) { EXPECT_EQ(1, delegate->navigation_state_change_count()); // Before that commits, a document.write and location.reload can cause the - // renderer to send a FrameNavigate with page_id -1 and nav_entry_id 0. + // renderer to send a FrameNavigate with page_id -1. main_test_rfh()->SendRendererInitiatedNavigationRequest(kExistingURL, true); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(-1, 0, false, kExistingURL); + main_test_rfh()->SendNavigate(-1, kExistingURL); // This should clear the pending entry and notify of a navigation state // change, so that we do not keep displaying kNewURL. @@ -1081,9 +1061,8 @@ TEST_F(NavigationControllerTest, LoadURL_RedirectAbortDoesntShowPendingURL) { const GURL kExistingURL("http://foo/eh"); controller.LoadURL(kExistingURL, content::Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(1, entry_id, true, kExistingURL); + main_test_rfh()->SendNavigate(1, kExistingURL); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -1155,16 +1134,14 @@ TEST_F(NavigationControllerTest, LoadURL_WithBindings) { url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); EXPECT_EQ(NavigationEntryImpl::kInvalidBindings, controller.GetPendingEntry()->bindings()); - int entry1_id = controller.GetPendingEntry()->GetUniqueID(); // Commit. TestRenderFrameHost* orig_rfh = contents()->GetMainFrame(); orig_rfh->PrepareForCommit(); - orig_rfh->SendNavigate(0, entry1_id, true, url1); + orig_rfh->SendNavigate(0, url1); EXPECT_EQ(controller.GetEntryCount(), 1); EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); EXPECT_EQ(0, controller.GetLastCommittedEntry()->bindings()); - entry1_id = controller.GetLastCommittedEntry()->GetUniqueID(); // Manually increase the number of active frames in the SiteInstance // that orig_rfh belongs to, to prevent it from being destroyed when @@ -1177,11 +1154,10 @@ TEST_F(NavigationControllerTest, LoadURL_WithBindings) { // privileged url. controller.LoadURL( url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); orig_rfh->PrepareForCommit(); TestRenderFrameHost* new_rfh = contents()->GetPendingMainFrame(); new_rfh->GetRenderViewHost()->AllowBindings(1); - new_rfh->SendNavigate(1, entry_id, true, url2); + new_rfh->SendNavigate(1, url2); // The second load should be committed, and bindings should be remembered. EXPECT_EQ(controller.GetEntryCount(), 2); @@ -1192,7 +1168,7 @@ TEST_F(NavigationControllerTest, LoadURL_WithBindings) { // Going back, the first entry should still appear unprivileged. controller.GoBack(); new_rfh->PrepareForCommit(); - orig_rfh->SendNavigate(0, entry1_id, false, url1); + orig_rfh->SendNavigate(0, url1); EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); EXPECT_EQ(0, controller.GetLastCommittedEntry()->bindings()); } @@ -1206,16 +1182,13 @@ TEST_F(NavigationControllerTest, Reload) { controller.LoadURL( url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); EXPECT_EQ(0U, notifications.size()); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry_id, true, url1); + main_test_rfh()->SendNavigate(0, url1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; ASSERT_TRUE(controller.GetVisibleEntry()); controller.GetVisibleEntry()->SetTitle(base::ASCIIToUTF16("Title")); - entry_id = controller.GetLastCommittedEntry()->GetUniqueID(); - controller.Reload(true); EXPECT_EQ(0U, notifications.size()); @@ -1236,7 +1209,7 @@ TEST_F(NavigationControllerTest, Reload) { EXPECT_TRUE(controller.GetVisibleEntry()->GetTitle().empty()); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry_id, false, url1); + main_test_rfh()->SendNavigate(0, url1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -1265,18 +1238,16 @@ TEST_F(NavigationControllerTest, Reload_GeneratesNewPage) { controller.LoadURL( url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry_id, true, url1); + main_test_rfh()->SendNavigate(0, url1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; - entry_id = controller.GetLastCommittedEntry()->GetUniqueID(); controller.Reload(true); EXPECT_EQ(0U, notifications.size()); main_test_rfh()->PrepareForCommitWithServerRedirect(url2); - main_test_rfh()->SendNavigate(1, entry_id, true, url2); + main_test_rfh()->SendNavigate(1, url2); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -1299,9 +1270,8 @@ TEST_F(NavigationControllerTest, ReloadWithGuest) { const GURL url1("http://foo1"); controller.LoadURL( url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry_id, true, url1); + main_test_rfh()->SendNavigate(0, url1); ASSERT_TRUE(controller.GetVisibleEntry()); // Make the entry believe its RenderProcessHost is a guest. @@ -1334,14 +1304,12 @@ TEST_F(NavigationControllerTest, ReloadOriginalRequestURL) { // Load up the original URL, but get redirected. controller.LoadURL( original_url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); EXPECT_EQ(0U, notifications.size()); main_test_rfh()->PrepareForCommitWithServerRedirect(final_url); - main_test_rfh()->SendNavigateWithOriginalRequestURL(0, entry_id, true, - final_url, original_url); + main_test_rfh()->SendNavigateWithOriginalRequestURL( + 0, final_url, original_url); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; - entry_id = controller.GetLastCommittedEntry()->GetUniqueID(); // The NavigationEntry should save both the original URL and the final // redirected URL. @@ -1371,7 +1339,7 @@ TEST_F(NavigationControllerTest, ReloadOriginalRequestURL) { // Send that the navigation has proceeded; say it got redirected again. main_test_rfh()->PrepareForCommitWithServerRedirect(final_url); - main_test_rfh()->SendNavigate(0, entry_id, false, final_url); + main_test_rfh()->SendNavigate(0, final_url); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -1397,15 +1365,13 @@ TEST_F(NavigationControllerTest, ResetEntryValuesAfterCommit) { const GURL url0("http://foo/0"); controller.LoadURL( url0, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry_id, true, url0); + main_test_rfh()->SendNavigate(0, url0); // Set up the pending entry. const GURL url1("http://foo/1"); controller.LoadURL( url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - entry_id = controller.GetPendingEntry()->GetUniqueID(); // Set up some sample values. const unsigned char* raw_data = @@ -1431,7 +1397,7 @@ TEST_F(NavigationControllerTest, ResetEntryValuesAfterCommit) { // Fake a commit response. main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(1, entry_id, true, url1); + main_test_rfh()->SendNavigate(1, url1); // Certain values that are only used for pending entries get reset after // commit. @@ -1451,7 +1417,6 @@ TEST_F(NavigationControllerTest, RedirectsAreNotResetByCommit) { const GURL url2("http://foo2"); controller.LoadURL( url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); // Set up some redirect values. std::vector<GURL> redirects; @@ -1465,8 +1430,7 @@ TEST_F(NavigationControllerTest, RedirectsAreNotResetByCommit) { // Normal navigation will preserve redirects in the committed entry. main_test_rfh()->PrepareForCommitWithServerRedirect(url2); - main_test_rfh()->SendNavigateWithRedirects(0, entry_id, true, url1, - redirects); + main_test_rfh()->SendNavigateWithRedirects(0, url1, redirects); NavigationEntryImpl* committed_entry = controller.GetLastCommittedEntry(); ASSERT_EQ(1U, committed_entry->GetRedirectChain().size()); EXPECT_EQ(url2, committed_entry->GetRedirectChain()[0]); @@ -1479,17 +1443,16 @@ TEST_F(NavigationControllerTest, Back) { RegisterForAllNavNotifications(¬ifications, &controller); const GURL url1("http://foo1"); - main_test_rfh()->NavigateAndCommitRendererInitiated(0, true, url1); + main_test_rfh()->NavigateAndCommitRendererInitiated(0, url1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; const GURL url2("http://foo2"); - main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, url2); + main_test_rfh()->NavigateAndCommitRendererInitiated(1, url2); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; controller.GoBack(); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); EXPECT_EQ(0U, notifications.size()); // We should now have a pending navigation to go back. @@ -1502,14 +1465,14 @@ TEST_F(NavigationControllerTest, Back) { EXPECT_FALSE(controller.CanGoToOffset(-1)); EXPECT_TRUE(controller.CanGoForward()); EXPECT_TRUE(controller.CanGoToOffset(1)); - EXPECT_FALSE(controller.CanGoToOffset(2)); // Cannot go forward 2 steps. + EXPECT_FALSE(controller.CanGoToOffset(2)); // Cannot go foward 2 steps. // Timestamp for entry 1 should be on or after that of entry 0. EXPECT_FALSE(controller.GetEntryAtIndex(0)->GetTimestamp().is_null()); EXPECT_GE(controller.GetEntryAtIndex(1)->GetTimestamp(), controller.GetEntryAtIndex(0)->GetTimestamp()); - main_test_rfh()->SendNavigate(0, entry_id, false, url2); + main_test_rfh()->NavigateAndCommitRendererInitiated(0, url2); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -1543,18 +1506,15 @@ TEST_F(NavigationControllerTest, Back_GeneratesNewPage) { controller.LoadURL( url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry1_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry1_id, true, url1); + main_test_rfh()->SendNavigate(0, url1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; - entry1_id = controller.GetLastCommittedEntry()->GetUniqueID(); controller.LoadURL( url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(1, entry_id, true, url2); + main_test_rfh()->SendNavigate(1, url2); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -1571,7 +1531,7 @@ TEST_F(NavigationControllerTest, Back_GeneratesNewPage) { EXPECT_TRUE(controller.CanGoForward()); main_test_rfh()->PrepareForCommitWithServerRedirect(url3); - main_test_rfh()->SendNavigate(2, entry1_id, true, url3); + main_test_rfh()->SendNavigate(2, url3); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -1597,12 +1557,12 @@ TEST_F(NavigationControllerTest, Back_NewPending) { const GURL kUrl3("http://foo3"); // First navigate two places so we have some back history. - main_test_rfh()->NavigateAndCommitRendererInitiated(0, true, kUrl1); + main_test_rfh()->NavigateAndCommitRendererInitiated(0, kUrl1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; // controller.LoadURL(kUrl2, ui::PAGE_TRANSITION_TYPED); - main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, kUrl2); + main_test_rfh()->NavigateAndCommitRendererInitiated(1, kUrl2); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -1630,20 +1590,19 @@ TEST_F(NavigationControllerTest, Back_OtherBackPending) { // First navigate three places so we have some back history. main_test_rfh()->SendRendererInitiatedNavigationRequest(kUrl1, true); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, 0, true, kUrl1); + main_test_rfh()->SendNavigate(0, kUrl1); main_test_rfh()->SendRendererInitiatedNavigationRequest(kUrl2, true); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(1, 0, true, kUrl2); + main_test_rfh()->SendNavigate(1, kUrl2); main_test_rfh()->SendRendererInitiatedNavigationRequest(kUrl3, true); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(2, 0, true, kUrl3); + main_test_rfh()->SendNavigate(2, kUrl3); // With nothing pending, say we get a renderer back navigation request to the // second entry. controller.GoToOffset(-1); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(1, entry_id, false, kUrl2); + main_test_rfh()->SendNavigate(1, kUrl2); // We know all the entries have the same site instance, so we can just grab // a random one for looking up other entries. @@ -1658,9 +1617,8 @@ TEST_F(NavigationControllerTest, Back_OtherBackPending) { // Now go forward to the last item again and say it was committed. controller.GoForward(); - entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(2, entry_id, false, kUrl3); + main_test_rfh()->SendNavigate(2, kUrl3); // Now start going back one to the second page. It will be pending. controller.GoBack(); @@ -1670,9 +1628,8 @@ TEST_F(NavigationControllerTest, Back_OtherBackPending) { // Now have the renderer request a navigation back to the first page. This // will not match the pending one. controller.GoToOffset(-2); - entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry_id, false, kUrl1); + main_test_rfh()->SendNavigate(0, kUrl1); // The committed navigation should clear the pending entry. EXPECT_EQ(-1, controller.GetPendingEntryIndex()); @@ -1693,21 +1650,19 @@ TEST_F(NavigationControllerTest, Forward) { main_test_rfh()->SendRendererInitiatedNavigationRequest(url1, true); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, 0, true, url1); - NavigationEntry* entry1 = controller.GetLastCommittedEntry(); + main_test_rfh()->SendNavigate(0, url1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; main_test_rfh()->SendRendererInitiatedNavigationRequest(url2, true); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(1, 0, true, url2); - NavigationEntry* entry2 = controller.GetLastCommittedEntry(); + main_test_rfh()->SendNavigate(1, url2); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; controller.GoBack(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry1->GetUniqueID(), false, url1); + main_test_rfh()->SendNavigate(0, url1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -1732,7 +1687,7 @@ TEST_F(NavigationControllerTest, Forward) { controller.GetEntryAtIndex(1)->GetTimestamp()); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(1, entry2->GetUniqueID(), false, url2); + main_test_rfh()->SendNavigate(1, url2); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -1766,20 +1721,18 @@ TEST_F(NavigationControllerTest, Forward_GeneratesNewPage) { main_test_rfh()->SendRendererInitiatedNavigationRequest(url1, true); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, 0, true, url1); + main_test_rfh()->SendNavigate(0, url1); EXPECT_EQ(1U, navigation_entry_committed_counter_); - NavigationEntry* entry1 = controller.GetLastCommittedEntry(); navigation_entry_committed_counter_ = 0; main_test_rfh()->SendRendererInitiatedNavigationRequest(url2, true); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(1, 0, true, url2); + main_test_rfh()->SendNavigate(1, url2); EXPECT_EQ(1U, navigation_entry_committed_counter_); - NavigationEntry* entry2 = controller.GetLastCommittedEntry(); navigation_entry_committed_counter_ = 0; controller.GoBack(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry1->GetUniqueID(), false, url1); + main_test_rfh()->SendNavigate(0, url1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -1796,7 +1749,7 @@ TEST_F(NavigationControllerTest, Forward_GeneratesNewPage) { EXPECT_FALSE(controller.CanGoForward()); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(2, entry2->GetUniqueID(), true, url3); + main_test_rfh()->SendNavigate(2, url3); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_LIST_PRUNED)); @@ -1823,14 +1776,11 @@ TEST_F(NavigationControllerTest, Redirect) { // First request. controller.LoadURL( url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); EXPECT_EQ(0U, notifications.size()); FrameHostMsg_DidCommitProvisionalLoad_Params params; params.page_id = 0; - params.nav_entry_id = entry_id; - params.did_create_new_entry = true; params.url = url2; params.transition = ui::PAGE_TRANSITION_SERVER_REDIRECT; params.redirects.push_back(GURL("http://foo1")); @@ -1850,15 +1800,10 @@ TEST_F(NavigationControllerTest, Redirect) { // Second request. controller.LoadURL( url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - entry_id = controller.GetPendingEntry()->GetUniqueID(); EXPECT_TRUE(controller.GetPendingEntry()); EXPECT_EQ(controller.GetPendingEntryIndex(), -1); EXPECT_EQ(url1, controller.GetVisibleEntry()->GetURL()); - - params.nav_entry_id = entry_id; - params.did_create_new_entry = false; - EXPECT_EQ(0U, notifications.size()); EXPECT_TRUE(controller.RendererDidNavigate(main_test_rfh(), params, &details)); @@ -1891,15 +1836,12 @@ TEST_F(NavigationControllerTest, PostThenRedirect) { // First request as POST. controller.LoadURL( url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); controller.GetVisibleEntry()->SetHasPostData(true); EXPECT_EQ(0U, notifications.size()); FrameHostMsg_DidCommitProvisionalLoad_Params params; params.page_id = 0; - params.nav_entry_id = entry_id; - params.did_create_new_entry = true; params.url = url2; params.transition = ui::PAGE_TRANSITION_SERVER_REDIRECT; params.redirects.push_back(GURL("http://foo1")); @@ -1919,14 +1861,11 @@ TEST_F(NavigationControllerTest, PostThenRedirect) { // Second request. controller.LoadURL( url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - entry_id = controller.GetPendingEntry()->GetUniqueID(); EXPECT_TRUE(controller.GetPendingEntry()); EXPECT_EQ(controller.GetPendingEntryIndex(), -1); EXPECT_EQ(url1, controller.GetVisibleEntry()->GetURL()); - params.nav_entry_id = entry_id; - params.did_create_new_entry = false; params.is_post = false; EXPECT_EQ(0U, notifications.size()); @@ -1960,7 +1899,6 @@ TEST_F(NavigationControllerTest, ImmediateRedirect) { // First request controller.LoadURL( url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); EXPECT_TRUE(controller.GetPendingEntry()); EXPECT_EQ(controller.GetPendingEntryIndex(), -1); @@ -1968,8 +1906,6 @@ TEST_F(NavigationControllerTest, ImmediateRedirect) { FrameHostMsg_DidCommitProvisionalLoad_Params params; params.page_id = 0; - params.nav_entry_id = entry_id; - params.did_create_new_entry = true; params.url = url2; params.transition = ui::PAGE_TRANSITION_SERVER_REDIRECT; params.redirects.push_back(GURL("http://foo1")); @@ -2007,15 +1943,13 @@ TEST_F(NavigationControllerTest, NewSubframe) { RegisterForAllNavNotifications(¬ifications, &controller); const GURL url1("http://foo1"); - main_test_rfh()->NavigateAndCommitRendererInitiated(0, true, url1); + main_test_rfh()->NavigateAndCommitRendererInitiated(0, url1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; const GURL url2("http://foo2"); FrameHostMsg_DidCommitProvisionalLoad_Params params; params.page_id = 1; - params.nav_entry_id = 0; - params.did_create_new_entry = true; params.url = url2; params.transition = ui::PAGE_TRANSITION_MANUAL_SUBFRAME; params.should_update_history = false; @@ -2051,7 +1985,7 @@ TEST_F(NavigationControllerTest, AutoSubframe) { RegisterForAllNavNotifications(¬ifications, &controller); const GURL url1("http://foo/1"); - main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, url1); + main_test_rfh()->NavigateAndCommitRendererInitiated(1, url1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -2064,8 +1998,6 @@ TEST_F(NavigationControllerTest, AutoSubframe) { { FrameHostMsg_DidCommitProvisionalLoad_Params params; params.page_id = 1; - params.nav_entry_id = 0; - params.did_create_new_entry = false; params.url = url2; params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; params.should_update_history = false; @@ -2152,17 +2084,14 @@ TEST_F(NavigationControllerTest, BackSubframe) { // Main page. const GURL url1("http://foo1"); - main_test_rfh()->NavigateAndCommitRendererInitiated(0, true, url1); + main_test_rfh()->NavigateAndCommitRendererInitiated(0, url1); EXPECT_EQ(1U, navigation_entry_committed_counter_); - NavigationEntry* entry1 = controller.GetLastCommittedEntry(); navigation_entry_committed_counter_ = 0; // First manual subframe navigation. const GURL url2("http://foo2"); FrameHostMsg_DidCommitProvisionalLoad_Params params; params.page_id = 1; - params.nav_entry_id = 0; - params.did_create_new_entry = true; params.url = url2; params.transition = ui::PAGE_TRANSITION_MANUAL_SUBFRAME; params.should_update_history = false; @@ -2174,7 +2103,6 @@ TEST_F(NavigationControllerTest, BackSubframe) { LoadCommittedDetails details; EXPECT_TRUE(controller.RendererDidNavigate(main_test_rfh(), params, &details)); - NavigationEntry* entry2 = controller.GetLastCommittedEntry(); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; EXPECT_EQ(2, controller.GetEntryCount()); @@ -2182,8 +2110,6 @@ TEST_F(NavigationControllerTest, BackSubframe) { // Second manual subframe navigation should also make a new entry. const GURL url3("http://foo3"); params.page_id = 2; - params.nav_entry_id = 0; - params.did_create_new_entry = true; params.url = url3; params.transition = ui::PAGE_TRANSITION_MANUAL_SUBFRAME; EXPECT_TRUE(controller.RendererDidNavigate(main_test_rfh(), params, @@ -2196,8 +2122,6 @@ TEST_F(NavigationControllerTest, BackSubframe) { // Go back one. controller.GoBack(); params.page_id = 1; - params.nav_entry_id = entry2->GetUniqueID(); - params.did_create_new_entry = false; params.url = url2; params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; EXPECT_TRUE(controller.RendererDidNavigate(main_test_rfh(), params, @@ -2212,8 +2136,6 @@ TEST_F(NavigationControllerTest, BackSubframe) { // Go back one more. controller.GoBack(); params.page_id = 0; - params.nav_entry_id = entry1->GetUniqueID(); - params.did_create_new_entry = false; params.url = url1; params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; EXPECT_TRUE(controller.RendererDidNavigate(main_test_rfh(), params, @@ -2234,15 +2156,15 @@ TEST_F(NavigationControllerTest, LinkClick) { const GURL url1("http://foo1"); const GURL url2("http://foo2"); - main_test_rfh()->NavigateAndCommitRendererInitiated(0, true, url1); + main_test_rfh()->NavigateAndCommitRendererInitiated(0, url1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; - main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, url2); + main_test_rfh()->NavigateAndCommitRendererInitiated(1, url2); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; - // Should have produced a new session history entry. + // Should not have produced a new session history entry. EXPECT_EQ(controller.GetEntryCount(), 2); EXPECT_EQ(controller.GetLastCommittedEntryIndex(), 1); EXPECT_EQ(controller.GetPendingEntryIndex(), -1); @@ -2259,7 +2181,7 @@ TEST_F(NavigationControllerTest, InPage) { // Main page. const GURL url1("http://foo"); - main_test_rfh()->NavigateAndCommitRendererInitiated(0, true, url1); + main_test_rfh()->NavigateAndCommitRendererInitiated(0, url1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -2267,8 +2189,6 @@ TEST_F(NavigationControllerTest, InPage) { // hint provided in the params. FrameHostMsg_DidCommitProvisionalLoad_Params self_params; self_params.page_id = 0; - self_params.nav_entry_id = 0; - self_params.did_create_new_entry = false; self_params.url = url1; self_params.transition = ui::PAGE_TRANSITION_LINK; self_params.should_update_history = false; @@ -2280,7 +2200,6 @@ TEST_F(NavigationControllerTest, InPage) { LoadCommittedDetails details; EXPECT_TRUE(controller.RendererDidNavigate(main_test_rfh(), self_params, &details)); - NavigationEntry* entry1 = controller.GetLastCommittedEntry(); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; EXPECT_TRUE(details.is_in_page); @@ -2291,8 +2210,6 @@ TEST_F(NavigationControllerTest, InPage) { const GURL url2("http://foo#a"); FrameHostMsg_DidCommitProvisionalLoad_Params params; params.page_id = 1; - params.nav_entry_id = 0; - params.did_create_new_entry = true; params.url = url2; params.transition = ui::PAGE_TRANSITION_LINK; params.should_update_history = false; @@ -2304,7 +2221,6 @@ TEST_F(NavigationControllerTest, InPage) { // This should generate a new entry. EXPECT_TRUE(controller.RendererDidNavigate(main_test_rfh(), params, &details)); - NavigationEntry* entry2 = controller.GetLastCommittedEntry(); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; EXPECT_TRUE(details.is_in_page); @@ -2316,8 +2232,6 @@ TEST_F(NavigationControllerTest, InPage) { controller.GoBack(); back_params.url = url1; back_params.page_id = 0; - back_params.nav_entry_id = entry1->GetUniqueID(); - back_params.did_create_new_entry = false; EXPECT_TRUE(controller.RendererDidNavigate(main_test_rfh(), back_params, &details)); EXPECT_EQ(1U, navigation_entry_committed_counter_); @@ -2327,13 +2241,11 @@ TEST_F(NavigationControllerTest, InPage) { EXPECT_EQ(0, controller.GetCurrentEntryIndex()); EXPECT_EQ(back_params.url, controller.GetVisibleEntry()->GetURL()); - // Go forward. + // Go forward FrameHostMsg_DidCommitProvisionalLoad_Params forward_params(params); controller.GoForward(); forward_params.url = url2; forward_params.page_id = 1; - forward_params.nav_entry_id = entry2->GetUniqueID(); - forward_params.did_create_new_entry = false; EXPECT_TRUE(controller.RendererDidNavigate(main_test_rfh(), forward_params, &details)); EXPECT_EQ(1U, navigation_entry_committed_counter_); @@ -2360,8 +2272,6 @@ TEST_F(NavigationControllerTest, InPage) { // Finally, navigate to an unrelated URL to make sure in_page is not sticky. const GURL url3("http://bar"); params.page_id = 2; - params.nav_entry_id = 0; - params.did_create_new_entry = true; params.url = url3; navigation_entry_committed_counter_ = 0; EXPECT_TRUE(controller.RendererDidNavigate(main_test_rfh(), params, @@ -2380,7 +2290,7 @@ TEST_F(NavigationControllerTest, InPage_Replace) { // Main page. const GURL url1("http://foo"); - main_test_rfh()->NavigateAndCommitRendererInitiated(0, true, url1); + main_test_rfh()->NavigateAndCommitRendererInitiated(0, url1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -2388,8 +2298,6 @@ TEST_F(NavigationControllerTest, InPage_Replace) { const GURL url2("http://foo#a"); FrameHostMsg_DidCommitProvisionalLoad_Params params; params.page_id = 0; // Same page_id - params.nav_entry_id = 0; - params.did_create_new_entry = false; params.url = url2; params.transition = ui::PAGE_TRANSITION_LINK; params.should_update_history = false; @@ -2423,7 +2331,7 @@ TEST_F(NavigationControllerTest, ClientRedirectAfterInPageNavigation) { // Load an initial page. { const GURL url("http://foo/"); - main_test_rfh()->NavigateAndCommitRendererInitiated(0, true, url); + main_test_rfh()->NavigateAndCommitRendererInitiated(0, url); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; } @@ -2431,7 +2339,7 @@ TEST_F(NavigationControllerTest, ClientRedirectAfterInPageNavigation) { // Navigate to a new page. { const GURL url("http://foo2/"); - main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, url); + main_test_rfh()->NavigateAndCommitRendererInitiated(1, url); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; } @@ -2441,8 +2349,6 @@ TEST_F(NavigationControllerTest, ClientRedirectAfterInPageNavigation) { const GURL url("http://foo2/#a"); FrameHostMsg_DidCommitProvisionalLoad_Params params; params.page_id = 1; // Same page_id - params.nav_entry_id = 0; - params.did_create_new_entry = false; params.url = url; params.transition = ui::PAGE_TRANSITION_LINK; params.redirects.push_back(url); @@ -2468,8 +2374,6 @@ TEST_F(NavigationControllerTest, ClientRedirectAfterInPageNavigation) { const GURL url("http://foo3/"); FrameHostMsg_DidCommitProvisionalLoad_Params params; params.page_id = 2; // New page_id - params.nav_entry_id = 0; - params.did_create_new_entry = true; params.url = url; params.transition = ui::PAGE_TRANSITION_CLIENT_REDIRECT; params.redirects.push_back(GURL("http://foo2/#a")); @@ -2493,9 +2397,8 @@ TEST_F(NavigationControllerTest, ClientRedirectAfterInPageNavigation) { { const GURL url("http://foo2/"); controller.GoBack(); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(1, entry_id, false, url); + main_test_rfh()->SendNavigate(1, url); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; EXPECT_EQ(url, controller.GetVisibleEntry()->GetURL()); @@ -2508,8 +2411,6 @@ TEST_F(NavigationControllerTest, PushStateWithoutPreviousEntry) FrameHostMsg_DidCommitProvisionalLoad_Params params; GURL url("http://foo"); params.page_id = 1; - params.nav_entry_id = 0; - params.did_create_new_entry = true; params.url = url; params.page_state = PageState::CreateFromURL(url); params.was_within_same_page = true; @@ -2564,9 +2465,8 @@ TEST_F(NavigationControllerTest, EnforceMaxNavigationCount) { GURL url(base::StringPrintf("http://www.a.com/%d", url_index)); controller.LoadURL( url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(url_index, entry_id, true, url); + main_test_rfh()->SendNavigate(url_index, url); } EXPECT_EQ(controller.GetEntryCount(), kMaxEntryCount); @@ -2578,9 +2478,8 @@ TEST_F(NavigationControllerTest, EnforceMaxNavigationCount) { GURL url(base::StringPrintf("http://www.a.com/%d", url_index)); controller.LoadURL( url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(url_index, entry_id, true, url); + main_test_rfh()->SendNavigate(url_index, url); url_index++; // We should have got a pruned navigation. @@ -2591,21 +2490,20 @@ TEST_F(NavigationControllerTest, EnforceMaxNavigationCount) { // We expect http://www.a.com/0 to be gone. EXPECT_EQ(controller.GetEntryCount(), kMaxEntryCount); EXPECT_EQ(controller.GetEntryAtIndex(0)->GetURL(), - GURL("http://www.a.com/1")); + GURL("http:////www.a.com/1")); // More navigations. for (int i = 0; i < 3; i++) { - url = GURL(base::StringPrintf("http://www.a.com/%d", url_index)); + url = GURL(base::StringPrintf("http:////www.a.com/%d", url_index)); controller.LoadURL( url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(url_index, entry_id, true, url); + main_test_rfh()->SendNavigate(url_index, url); url_index++; } EXPECT_EQ(controller.GetEntryCount(), kMaxEntryCount); EXPECT_EQ(controller.GetEntryAtIndex(0)->GetURL(), - GURL("http://www.a.com/4")); + GURL("http:////www.a.com/4")); NavigationControllerImpl::set_max_entry_count_for_testing(original_count); } @@ -2659,8 +2557,6 @@ TEST_F(NavigationControllerTest, RestoreNavigate) { // Say we navigated to that entry. FrameHostMsg_DidCommitProvisionalLoad_Params params; params.page_id = 0; - params.nav_entry_id = our_controller.GetPendingEntry()->GetUniqueID(); - params.did_create_new_entry = false; params.url = url; params.transition = ui::PAGE_TRANSITION_LINK; params.should_update_history = false; @@ -2709,7 +2605,6 @@ TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) { // Before navigating to the restored entry, it should have a restore_type // and no SiteInstance. - entry = our_controller.GetEntryAtIndex(0); EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION_EXITED_CLEANLY, our_controller.GetEntryAtIndex(0)->restore_type()); EXPECT_FALSE(our_controller.GetEntryAtIndex(0)->site_instance()); @@ -2739,8 +2634,6 @@ TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) { // Now the pending restored entry commits. FrameHostMsg_DidCommitProvisionalLoad_Params params; params.page_id = 0; - params.nav_entry_id = entry->GetUniqueID(); - params.did_create_new_entry = false; params.url = url; params.transition = ui::PAGE_TRANSITION_LINK; params.should_update_history = false; @@ -2769,21 +2662,19 @@ TEST_F(NavigationControllerTest, Interstitial) { const GURL url1("http://foo"); controller.LoadURL( url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry_id, true, url1); + main_test_rfh()->SendNavigate(0, url1); // Now navigate somewhere with an interstitial. const GURL url2("http://bar"); controller.LoadURL(url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - entry_id = controller.GetPendingEntry()->GetUniqueID(); controller.GetPendingEntry()->set_page_type(PAGE_TYPE_INTERSTITIAL); // At this point the interstitial will be displayed and the load will still // be pending. If the user continues, the load will commit. main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(1, entry_id, true, url2); + main_test_rfh()->SendNavigate(1, url2); // The page should be a normal page again. EXPECT_EQ(url2, controller.GetLastCommittedEntry()->GetURL()); @@ -2803,29 +2694,24 @@ TEST_F(NavigationControllerTest, RemoveEntry) { controller.LoadURL( url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry_id, true, url1); + main_test_rfh()->SendNavigate(0, url1); controller.LoadURL( url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(1, entry_id, true, url2); + main_test_rfh()->SendNavigate(1, url2); controller.LoadURL( url3, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(2, entry_id, true, url3); + main_test_rfh()->SendNavigate(2, url3); controller.LoadURL( url4, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(3, entry_id, true, url4); + main_test_rfh()->SendNavigate(3, url4); controller.LoadURL( url5, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(4, entry_id, true, url5); + main_test_rfh()->SendNavigate(4, url5); // Try to remove the last entry. Will fail because it is the current entry. EXPECT_FALSE(controller.RemoveEntryAtIndex(controller.GetEntryCount() - 1)); @@ -2835,13 +2721,12 @@ TEST_F(NavigationControllerTest, RemoveEntry) { // Go back, but don't commit yet. Check that we can't delete the current // and pending entries. controller.GoBack(); - entry_id = controller.GetPendingEntry()->GetUniqueID(); EXPECT_FALSE(controller.RemoveEntryAtIndex(controller.GetEntryCount() - 1)); EXPECT_FALSE(controller.RemoveEntryAtIndex(controller.GetEntryCount() - 2)); // Now commit and delete the last entry. main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(3, entry_id, false, url4); + main_test_rfh()->SendNavigate(3, url4); EXPECT_TRUE(controller.RemoveEntryAtIndex(controller.GetEntryCount() - 1)); EXPECT_EQ(4, controller.GetEntryCount()); EXPECT_EQ(3, controller.GetLastCommittedEntryIndex()); @@ -2871,24 +2756,20 @@ TEST_F(NavigationControllerTest, RemoveEntryWithPending) { controller.LoadURL( url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry_id, true, url1); + main_test_rfh()->SendNavigate(0, url1); controller.LoadURL( url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(1, entry_id, true, url2); + main_test_rfh()->SendNavigate(1, url2); controller.LoadURL( url3, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(2, entry_id, true, url3); + main_test_rfh()->SendNavigate(2, url3); // Go back, but don't commit yet. Check that we can't delete the current // and pending entries. controller.GoBack(); - entry_id = controller.GetPendingEntry()->GetUniqueID(); EXPECT_FALSE(controller.RemoveEntryAtIndex(2)); EXPECT_FALSE(controller.RemoveEntryAtIndex(1)); @@ -2903,7 +2784,7 @@ TEST_F(NavigationControllerTest, RemoveEntryWithPending) { // Now commit and ensure we land on the right entry. main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(1, entry_id, false, url2); + main_test_rfh()->SendNavigate(1, url2); EXPECT_EQ(2, controller.GetEntryCount()); EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); EXPECT_FALSE(controller.GetPendingEntry()); @@ -2925,14 +2806,12 @@ TEST_F(NavigationControllerTest, TransientEntry) { controller.LoadURL( url0, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry_id, true, url0); + main_test_rfh()->SendNavigate(0, url0); controller.LoadURL( url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(1, entry_id, true, url1); + main_test_rfh()->SendNavigate(1, url1); notifications.Reset(); @@ -2958,9 +2837,8 @@ TEST_F(NavigationControllerTest, TransientEntry) { // Navigate. controller.LoadURL( url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(2, entry_id, true, url2); + main_test_rfh()->SendNavigate(2, url2); // We should have navigated, transient entry should be gone. EXPECT_EQ(url2, controller.GetVisibleEntry()->GetURL()); @@ -2973,7 +2851,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL()); main_test_rfh()->SendRendererInitiatedNavigationRequest(url3, true); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(3, 0, true, url3); + main_test_rfh()->SendNavigate(3, url3); // Transient entry should be gone. EXPECT_EQ(url3, controller.GetVisibleEntry()->GetURL()); EXPECT_EQ(controller.GetEntryCount(), 4); @@ -2981,13 +2859,12 @@ TEST_F(NavigationControllerTest, TransientEntry) { // Initiate a navigation, add a transient then commit navigation. controller.LoadURL( url4, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - entry_id = controller.GetPendingEntry()->GetUniqueID(); transient_entry = new NavigationEntryImpl; transient_entry->SetURL(transient_url); controller.SetTransientEntry(transient_entry); EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL()); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(4, entry_id, true, url4); + main_test_rfh()->SendNavigate(4, url4); EXPECT_EQ(url4, controller.GetVisibleEntry()->GetURL()); EXPECT_EQ(controller.GetEntryCount(), 5); @@ -3005,9 +2882,8 @@ TEST_F(NavigationControllerTest, TransientEntry) { // Suppose the page requested a history navigation backward. controller.GoToOffset(-1); - entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(3, entry_id, false, url3); + main_test_rfh()->SendNavigate(3, url3); // Add a transient and go to an entry before the current one. transient_entry = new NavigationEntryImpl; @@ -3015,14 +2891,13 @@ TEST_F(NavigationControllerTest, TransientEntry) { controller.SetTransientEntry(transient_entry); EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL()); controller.GoToIndex(1); - entry_id = controller.GetPendingEntry()->GetUniqueID(); // The navigation should have been initiated, transient entry should be gone. EXPECT_FALSE(controller.GetTransientEntry()); EXPECT_EQ(url1, controller.GetPendingEntry()->GetURL()); // Visible entry does not update for history navigations until commit. EXPECT_EQ(url3, controller.GetVisibleEntry()->GetURL()); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(1, entry_id, false, url1); + main_test_rfh()->SendNavigate(1, url1); EXPECT_EQ(url1, controller.GetVisibleEntry()->GetURL()); // Add a transient and go to an entry after the current one. @@ -3031,14 +2906,13 @@ TEST_F(NavigationControllerTest, TransientEntry) { controller.SetTransientEntry(transient_entry); EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL()); controller.GoToIndex(3); - entry_id = controller.GetPendingEntry()->GetUniqueID(); // The navigation should have been initiated, transient entry should be gone. // Because of the transient entry that is removed, going to index 3 makes us // land on url2 (which is visible after the commit). EXPECT_EQ(url2, controller.GetPendingEntry()->GetURL()); EXPECT_EQ(url1, controller.GetVisibleEntry()->GetURL()); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(2, entry_id, false, url2); + main_test_rfh()->SendNavigate(2, url2); EXPECT_EQ(url2, controller.GetVisibleEntry()->GetURL()); // Add a transient and go forward. @@ -3048,13 +2922,12 @@ TEST_F(NavigationControllerTest, TransientEntry) { EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL()); EXPECT_TRUE(controller.CanGoForward()); controller.GoForward(); - entry_id = controller.GetPendingEntry()->GetUniqueID(); // We should have navigated, transient entry should be gone. EXPECT_FALSE(controller.GetTransientEntry()); EXPECT_EQ(url3, controller.GetPendingEntry()->GetURL()); EXPECT_EQ(url2, controller.GetVisibleEntry()->GetURL()); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(3, entry_id, false, url3); + main_test_rfh()->SendNavigate(3, url3); EXPECT_EQ(url3, controller.GetVisibleEntry()->GetURL()); // Add a transient and do an in-page navigation, replacing the current entry. @@ -3065,7 +2938,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { main_test_rfh()->SendRendererInitiatedNavigationRequest(url3_ref, false); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(3, 0, false, url3_ref); + main_test_rfh()->SendNavigate(3, url3_ref); // Transient entry should be gone. EXPECT_FALSE(controller.GetTransientEntry()); EXPECT_EQ(url3_ref, controller.GetVisibleEntry()->GetURL()); @@ -3089,9 +2962,8 @@ TEST_F(NavigationControllerTest, ReloadTransient) { // Load |url0|, and start a pending navigation to |url1|. controller.LoadURL( url0, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry_id, true, url0); + main_test_rfh()->SendNavigate(0, url0); controller.LoadURL( url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); @@ -3106,7 +2978,6 @@ TEST_F(NavigationControllerTest, ReloadTransient) { // the transient entry for |transient_url|, and start a navigation to // |transient_url|. controller.Reload(true); - entry_id = controller.GetPendingEntry()->GetUniqueID(); EXPECT_FALSE(controller.GetTransientEntry()); EXPECT_TRUE(controller.GetPendingEntry()); EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL()); @@ -3115,7 +2986,7 @@ TEST_F(NavigationControllerTest, ReloadTransient) { // Load of |transient_url| completes. main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(1, entry_id, true, transient_url); + main_test_rfh()->SendNavigate(1, transient_url); ASSERT_EQ(controller.GetEntryCount(), 2); EXPECT_EQ(controller.GetEntryAtIndex(0)->GetURL(), url0); EXPECT_EQ(controller.GetEntryAtIndex(1)->GetURL(), transient_url); @@ -3154,7 +3025,7 @@ TEST_F(NavigationControllerTest, RendererInitiatedPendingEntries) { EXPECT_EQ(url2, controller.GetPendingEntry()->GetVirtualURL()); // Once it commits, the URL and virtual URL should reflect the actual page. - main_test_rfh()->SendNavigate(0, 0, true, url2); + main_test_rfh()->SendNavigate(0, url2); EXPECT_EQ(url2, controller.GetLastCommittedEntry()->GetURL()); EXPECT_EQ(url2, controller.GetLastCommittedEntry()->GetVirtualURL()); @@ -3174,7 +3045,7 @@ TEST_F(NavigationControllerTest, RendererInitiatedPendingEntries) { main_test_rfh()->PrepareForCommit(); navigator->DidStartProvisionalLoad(main_test_rfh(), url2, false); EXPECT_TRUE(controller.GetPendingEntry()->should_replace_entry()); - main_test_rfh()->SendNavigate(0, 0, false, url2); + main_test_rfh()->SendNavigate(0, url2); EXPECT_EQ(url2, controller.GetLastCommittedEntry()->GetURL()); } @@ -3193,18 +3064,16 @@ TEST_F(NavigationControllerTest, DontShowRendererURLUntilCommit) { // should update before commit. controller.LoadURL( url0, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); EXPECT_EQ(url0, controller.GetPendingEntry()->GetURL()); EXPECT_EQ(url0, controller.GetVisibleEntry()->GetURL()); main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry_id, true, url0); + main_test_rfh()->SendNavigate(0, url0); // For link clicks (renderer-initiated navigations), the pending entry should // update before commit but the visible should not. NavigationController::LoadURLParams load_url_params(url1); load_url_params.is_renderer_initiated = true; controller.LoadURLWithParams(load_url_params); - entry_id = controller.GetPendingEntry()->GetUniqueID(); EXPECT_EQ(url0, controller.GetVisibleEntry()->GetURL()); EXPECT_EQ(url1, controller.GetPendingEntry()->GetURL()); EXPECT_TRUE(controller.GetPendingEntry()->is_renderer_initiated()); @@ -3212,7 +3081,7 @@ TEST_F(NavigationControllerTest, DontShowRendererURLUntilCommit) { // After commit, both visible should be updated, there should be no pending // entry, and we should no longer treat the entry as renderer-initiated. main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(1, entry_id, true, url1); + main_test_rfh()->SendNavigate(1, url1); EXPECT_EQ(url1, controller.GetVisibleEntry()->GetURL()); EXPECT_FALSE(controller.GetPendingEntry()); EXPECT_FALSE(controller.GetLastCommittedEntry()->is_renderer_initiated()); @@ -3370,7 +3239,6 @@ TEST_F(NavigationControllerTest, DontShowRendererURLInNewTabAfterCommit) { load_url_params.transition_type = ui::PAGE_TRANSITION_LINK; load_url_params.is_renderer_initiated = true; controller.LoadURLWithParams(load_url_params); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); EXPECT_EQ(url1, controller.GetVisibleEntry()->GetURL()); EXPECT_TRUE(controller.GetPendingEntry()->is_renderer_initiated()); EXPECT_TRUE(controller.IsInitialNavigation()); @@ -3378,7 +3246,7 @@ TEST_F(NavigationControllerTest, DontShowRendererURLInNewTabAfterCommit) { // Simulate a commit and then starting a new pending navigation. main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(0, entry_id, true, url1); + main_test_rfh()->SendNavigate(0, url1); NavigationController::LoadURLParams load_url2_params(url2); load_url2_params.transition_type = ui::PAGE_TRANSITION_LINK; load_url2_params.is_renderer_initiated = true; @@ -3408,15 +3276,16 @@ TEST_F(NavigationControllerTest, IsInPageNavigation) { // was the first document in the given frame, but we don't have enough // information to identify that case currently. const GURL blank_url(url::kAboutBlankURL); - main_test_rfh()->NavigateAndCommitRendererInitiated(0, true, blank_url); + main_test_rfh()->NavigateAndCommitRendererInitiated(0, blank_url); EXPECT_TRUE(controller.IsURLInPageNavigation(url, true, main_test_rfh())); // Navigate to URL with no refs. - main_test_rfh()->NavigateAndCommitRendererInitiated(0, false, url); + main_test_rfh()->NavigateAndCommitRendererInitiated(0, url); // Reloading the page is not an in-page navigation. - EXPECT_FALSE(controller.IsURLInPageNavigation(url, false, main_test_rfh())); + EXPECT_FALSE(controller.IsURLInPageNavigation(url, false, + main_test_rfh())); const GURL other_url("http://www.google.com/add.html"); EXPECT_FALSE(controller.IsURLInPageNavigation(other_url, false, main_test_rfh())); @@ -3425,7 +3294,7 @@ TEST_F(NavigationControllerTest, IsInPageNavigation) { main_test_rfh())); // Navigate to URL with refs. - main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, url_with_ref); + main_test_rfh()->NavigateAndCommitRendererInitiated(1, url_with_ref); // Reloading the page is not an in-page navigation. EXPECT_FALSE(controller.IsURLInPageNavigation(url_with_ref, false, @@ -3463,14 +3332,14 @@ TEST_F(NavigationControllerTest, IsInPageNavigation) { EXPECT_TRUE(prefs.allow_universal_access_from_file_urls); // Allow in page navigation if existing URL is file scheme. const GURL file_url("file:///foo/index.html"); - main_test_rfh()->NavigateAndCommitRendererInitiated(0, false, file_url); + main_test_rfh()->NavigateAndCommitRendererInitiated(0, file_url); EXPECT_EQ(0, rph->bad_msg_count()); EXPECT_TRUE(controller.IsURLInPageNavigation(different_origin_url, true, main_test_rfh())); EXPECT_EQ(0, rph->bad_msg_count()); // Don't honor allow_universal_access_from_file_urls if existing URL is // not file scheme. - main_test_rfh()->NavigateAndCommitRendererInitiated(0, false, url); + main_test_rfh()->NavigateAndCommitRendererInitiated(0, url); EXPECT_FALSE(controller.IsURLInPageNavigation(different_origin_url, true, main_test_rfh())); EXPECT_EQ(1, rph->bad_msg_count()); @@ -3497,7 +3366,7 @@ TEST_F(NavigationControllerTest, SameSubframe) { NavigationControllerImpl& controller = controller_impl(); // Navigate the main frame. const GURL url("http://www.google.com/"); - main_test_rfh()->NavigateAndCommitRendererInitiated(0, true, url); + main_test_rfh()->NavigateAndCommitRendererInitiated(0, url); // We should be at the first navigation entry. EXPECT_EQ(controller.GetEntryCount(), 1); @@ -3507,8 +3376,6 @@ TEST_F(NavigationControllerTest, SameSubframe) { const GURL subframe("http://www.google.com/#"); FrameHostMsg_DidCommitProvisionalLoad_Params params; params.page_id = 0; - params.nav_entry_id = 0; - params.did_create_new_entry = false; params.url = subframe; params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; params.should_update_history = false; @@ -3654,8 +3521,6 @@ TEST_F(NavigationControllerTest, SubframeWhilePending) { const GURL url1_sub("http://foo/subframe"); FrameHostMsg_DidCommitProvisionalLoad_Params params; params.page_id = controller.GetLastCommittedEntry()->GetPageID(); - params.nav_entry_id = 0; - params.did_create_new_entry = false; params.url = url1_sub; params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; params.should_update_history = false; @@ -3953,8 +3818,8 @@ TEST_F(NavigationControllerTest, CopyStateFromAndPruneTargetPending2) { // Simulate a client redirect, which has the same page ID as entry 2a. other_controller.LoadURL( url2b, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); - NavigationEntry* entry = other_controller.GetPendingEntry(); - entry->SetPageID(other_controller.GetLastCommittedEntry()->GetPageID()); + other_controller.GetPendingEntry()->SetPageID( + other_controller.GetLastCommittedEntry()->GetPageID()); other_contents->ExpectSetHistoryOffsetAndLength(1, 2); other_controller.CopyStateFromAndPrune(&controller, false); @@ -3973,9 +3838,7 @@ TEST_F(NavigationControllerTest, CopyStateFromAndPruneTargetPending2) { EXPECT_EQ(url2b, other_controller.GetPendingEntry()->GetURL()); // Let the pending entry commit. - other_contents->TestDidNavigate(other_contents->GetMainFrame(), - entry->GetPageID(), 0, false, url2b, - ui::PAGE_TRANSITION_LINK); + other_contents->CommitPendingNavigation(); // The max page ID map should be copied over and updated with the max page ID // from the current tab. @@ -4336,7 +4199,6 @@ TEST_F(NavigationControllerTest, PruneAllButLastCommittedForPendingNotInList) { // Create a pending entry that is not in the entry list. controller.LoadURL( url3, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller.GetPendingEntry()->GetUniqueID(); EXPECT_TRUE(controller.GetPendingEntry()); EXPECT_EQ(2, controller.GetEntryCount()); @@ -4353,7 +4215,7 @@ TEST_F(NavigationControllerTest, PruneAllButLastCommittedForPendingNotInList) { // Try to commit the pending entry. main_test_rfh()->PrepareForCommit(); - main_test_rfh()->SendNavigate(2, entry_id, true, url3); + main_test_rfh()->SendNavigate(2, url3); EXPECT_EQ(-1, controller.GetPendingEntryIndex()); EXPECT_FALSE(controller.GetPendingEntry()); EXPECT_EQ(2, controller.GetEntryCount()); @@ -4395,7 +4257,7 @@ TEST_F(NavigationControllerTest, IsInitialNavigation) { // After commit, it stays false. const GURL url1("http://foo1"); - main_test_rfh()->NavigateAndCommitRendererInitiated(0, true, url1); + main_test_rfh()->NavigateAndCommitRendererInitiated(0, url1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; EXPECT_FALSE(controller.IsInitialNavigation()); @@ -4418,8 +4280,7 @@ TEST_F(NavigationControllerTest, ClearFaviconOnRedirect) { TestNotificationTracker notifications; RegisterForAllNavNotifications(¬ifications, &controller); - main_test_rfh()->NavigateAndCommitRendererInitiated( - 0, true, kPageWithFavicon); + main_test_rfh()->NavigateAndCommitRendererInitiated(0, kPageWithFavicon); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -4438,10 +4299,9 @@ TEST_F(NavigationControllerTest, ClearFaviconOnRedirect) { false); main_test_rfh()->PrepareForCommit(); main_test_rfh()->SendNavigateWithTransition( - 0, // same page ID. - 0, // nav_entry_id - false, // no new entry - kPageWithoutFavicon, ui::PAGE_TRANSITION_CLIENT_REDIRECT); + 0, // same page ID. + kPageWithoutFavicon, + ui::PAGE_TRANSITION_CLIENT_REDIRECT); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -4463,7 +4323,7 @@ TEST_F(NavigationControllerTest, BackNavigationDoesNotClearFavicon) { TestNotificationTracker notifications; RegisterForAllNavNotifications(¬ifications, &controller); - main_test_rfh()->NavigateAndCommitRendererInitiated(0, true, kUrl1); + main_test_rfh()->NavigateAndCommitRendererInitiated(0, kUrl1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -4477,13 +4337,14 @@ TEST_F(NavigationControllerTest, BackNavigationDoesNotClearFavicon) { favicon_status.valid = true; // Navigate to another page and go back to the original page. - main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, kUrl2); + main_test_rfh()->NavigateAndCommitRendererInitiated(1, kUrl2); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; main_test_rfh()->SendRendererInitiatedNavigationRequest(kUrl1, false); main_test_rfh()->PrepareForCommit(); main_test_rfh()->SendNavigateWithTransition( - 0, controller.GetEntryAtIndex(0)->GetUniqueID(), false, kUrl1, + 0, + kUrl1, ui::PAGE_TRANSITION_FORWARD_BACK); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -4584,8 +4445,7 @@ TEST_F(NavigationControllerTest, MAYBE_PurgeScreenshot) { TEST_F(NavigationControllerTest, PushStateUpdatesTitleAndFavicon) { // Navigate. - main_test_rfh()->NavigateAndCommitRendererInitiated( - 1, true, GURL("http://foo")); + main_test_rfh()->NavigateAndCommitRendererInitiated(1, GURL("http://foo")); // Set title and favicon. base::string16 title(base::ASCIIToUTF16("Title")); @@ -4599,8 +4459,6 @@ TEST_F(NavigationControllerTest, PushStateUpdatesTitleAndFavicon) { FrameHostMsg_DidCommitProvisionalLoad_Params params; GURL kUrl2("http://foo#foo"); params.page_id = 2; - params.nav_entry_id = 0; - params.did_create_new_entry = true; params.url = kUrl2; params.page_state = PageState::CreateFromURL(kUrl2); params.was_within_same_page = true; @@ -4679,8 +4537,6 @@ TEST_F(NavigationControllerTest, PostThenReplaceStateThenReload) { GURL url("http://foo"); FrameHostMsg_DidCommitProvisionalLoad_Params params; params.page_id = 1; - params.nav_entry_id = 0; - params.did_create_new_entry = true; params.url = url; params.transition = ui::PAGE_TRANSITION_FORM_SUBMIT; params.gesture = NavigationGestureUser; @@ -4695,8 +4551,6 @@ TEST_F(NavigationControllerTest, PostThenReplaceStateThenReload) { // history.replaceState() is called. GURL replace_url("http://foo#foo"); params.page_id = 1; - params.nav_entry_id = 0; - params.did_create_new_entry = false; params.url = replace_url; params.transition = ui::PAGE_TRANSITION_LINK; params.gesture = NavigationGestureUser; @@ -4718,8 +4572,6 @@ TEST_F(NavigationControllerTest, UnreachableURLGivesErrorPage) { GURL url("http://foo"); FrameHostMsg_DidCommitProvisionalLoad_Params params; params.page_id = 1; - params.nav_entry_id = 0; - params.did_create_new_entry = true; params.url = url; params.transition = ui::PAGE_TRANSITION_LINK; params.gesture = NavigationGestureUser; @@ -4728,8 +4580,7 @@ TEST_F(NavigationControllerTest, UnreachableURLGivesErrorPage) { params.is_post = true; params.post_id = 2; params.url_is_unreachable = true; - - // Navigate to new page. + // Navigate to new page { LoadCommittedDetails details; controller_impl().RendererDidNavigate(main_test_rfh(), params, &details); @@ -4740,7 +4591,6 @@ TEST_F(NavigationControllerTest, UnreachableURLGivesErrorPage) { // Navigate to existing page. { - params.did_create_new_entry = false; LoadCommittedDetails details; controller_impl().RendererDidNavigate(main_test_rfh(), params, &details); EXPECT_EQ(PAGE_TYPE_ERROR, @@ -4753,7 +4603,6 @@ TEST_F(NavigationControllerTest, UnreachableURLGivesErrorPage) { // same-page transition. controller_impl().LoadURL( url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - params.nav_entry_id = controller_impl().GetPendingEntry()->GetUniqueID(); params.transition = ui::PAGE_TRANSITION_TYPED; { LoadCommittedDetails details; diff --git a/content/browser/frame_host/navigation_entry_impl.cc b/content/browser/frame_host/navigation_entry_impl.cc index fb0d41f..7e930dc 100644 --- a/content/browser/frame_host/navigation_entry_impl.cc +++ b/content/browser/frame_host/navigation_entry_impl.cc @@ -412,7 +412,6 @@ StartNavigationParams NavigationEntryImpl::ConstructStartNavigationParams() RequestNavigationParams NavigationEntryImpl::ConstructRequestNavigationParams( base::TimeTicks navigation_start, - bool intended_as_new_entry, int pending_history_list_offset, int current_history_list_offset, int current_history_list_length) const { @@ -437,9 +436,8 @@ RequestNavigationParams NavigationEntryImpl::ConstructRequestNavigationParams( return RequestNavigationParams( GetIsOverridingUserAgent(), navigation_start, redirects, GetCanLoadLocalResources(), base::Time::Now(), GetPageState(), - GetPageID(), GetUniqueID(), intended_as_new_entry, pending_offset_to_send, - current_offset_to_send, current_length_to_send, - should_clear_history_list()); + GetPageID(), pending_offset_to_send, current_offset_to_send, + current_length_to_send, should_clear_history_list()); } void NavigationEntryImpl::ResetForCommit() { diff --git a/content/browser/frame_host/navigation_entry_impl.h b/content/browser/frame_host/navigation_entry_impl.h index f665819..4f47b8a 100644 --- a/content/browser/frame_host/navigation_entry_impl.h +++ b/content/browser/frame_host/navigation_entry_impl.h @@ -131,7 +131,6 @@ class CONTENT_EXPORT NavigationEntryImpl StartNavigationParams ConstructStartNavigationParams() const; RequestNavigationParams ConstructRequestNavigationParams( base::TimeTicks navigation_start, - bool intended_as_new_entry, int pending_offset_to_send, int current_offset_to_send, int current_length_to_send) const; diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc index cd443de..f46eecb 100644 --- a/content/browser/frame_host/navigation_request.cc +++ b/content/browser/frame_host/navigation_request.cc @@ -90,9 +90,7 @@ scoped_ptr<NavigationRequest> NavigationRequest::CreateBrowserInitiated( BeginNavigationParams(method, headers.ToString(), LoadFlagFromNavigationType(navigation_type), false), entry.ConstructRequestNavigationParams( - navigation_start, - controller->GetPendingEntryIndex() == -1, - controller->GetIndexOfEntry(&entry), + navigation_start, controller->GetIndexOfEntry(&entry), controller->GetLastCommittedEntryIndex(), controller->GetEntryCount()), request_body, true, &entry)); diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc index d3f94c7..91c3a6d 100644 --- a/content/browser/frame_host/navigator_impl.cc +++ b/content/browser/frame_host/navigator_impl.cc @@ -328,9 +328,7 @@ bool NavigatorImpl::NavigateToEntry( entry.ConstructCommonNavigationParams(navigation_type), entry.ConstructStartNavigationParams(), entry.ConstructRequestNavigationParams( - navigation_start, - controller_->GetPendingEntryIndex() == -1, - controller_->GetIndexOfEntry(&entry), + navigation_start, controller_->GetIndexOfEntry(&entry), controller_->GetLastCommittedEntryIndex(), controller_->GetEntryCount())); } else { diff --git a/content/browser/frame_host/navigator_impl_unittest.cc b/content/browser/frame_host/navigator_impl_unittest.cc index 8dc64af..d265010 100644 --- a/content/browser/frame_host/navigator_impl_unittest.cc +++ b/content/browser/frame_host/navigator_impl_unittest.cc @@ -50,17 +50,12 @@ class NavigatorTestWithBrowserSideNavigation return static_cast<TestNavigationURLLoader*>(request->loader_for_testing()); } - // Requests a navigation of the specified FrameTreeNode to the specified URL; - // returns the unique ID of the pending NavigationEntry. - int RequestNavigation(FrameTreeNode* node, const GURL& url) { - return RequestNavigationWithParameters(node, url, Referrer(), - ui::PAGE_TRANSITION_LINK); + void RequestNavigation(FrameTreeNode* node, const GURL& url) { + RequestNavigationWithParameters(node, url, Referrer(), + ui::PAGE_TRANSITION_LINK); } - // Requests a navigation of the specified FrameTreeNode to the specified URL, - // using other specified parameters; returns the unique ID of the pending - // NavigationEntry. - int RequestNavigationWithParameters( + void RequestNavigationWithParameters( FrameTreeNode* node, const GURL& url, const Referrer& referrer, @@ -71,7 +66,6 @@ class NavigatorTestWithBrowserSideNavigation load_params.transition_type = transition_type; controller().LoadURLWithParams(load_params); - return controller().GetPendingEntry()->GetUniqueID(); } TestRenderFrameHost* GetSpeculativeRenderFrameHost(FrameTreeNode* node) { @@ -111,7 +105,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, // Start a browser-initiated navigation. int32 site_instance_id = main_test_rfh()->GetSiteInstance()->GetId(); FrameTreeNode* node = main_test_rfh()->frame_tree_node(); - int entry_id = RequestNavigation(node, kUrl); + RequestNavigation(node, kUrl); NavigationRequest* request = node->navigation_request(); ASSERT_TRUE(request); EXPECT_EQ(kUrl, request->common_params().url); @@ -132,7 +126,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, EXPECT_EQ(NavigationRequest::RESPONSE_STARTED, request->state()); // Commit the navigation. - main_test_rfh()->SendNavigate(0, entry_id, true, kUrl); + main_test_rfh()->SendNavigate(0, kUrl); EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, main_test_rfh()->rfh_state()); EXPECT_EQ(SiteInstanceImpl::GetSiteForURL(browser_context(), kUrl), main_test_rfh()->GetSiteInstance()->GetSiteURL()); @@ -185,7 +179,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, EXPECT_EQ(NavigationRequest::RESPONSE_STARTED, request->state()); // Commit the navigation. - main_test_rfh()->SendNavigate(1, 0, true, kUrl2); + main_test_rfh()->SendNavigate(0, kUrl2); EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, main_test_rfh()->rfh_state()); EXPECT_EQ(SiteInstanceImpl::GetSiteForURL(browser_context(), kUrl2), main_test_rfh()->GetSiteInstance()->GetSiteURL()); @@ -230,7 +224,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, EXPECT_EQ(NavigationRequest::RESPONSE_STARTED, request->state()); // Commit the navigation. - main_test_rfh()->SendNavigate(1, 0, true, kUrl2); + main_test_rfh()->SendNavigate(0, kUrl2); EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, main_test_rfh()->rfh_state()); EXPECT_EQ(kUrl2, contents()->GetLastCommittedURL()); EXPECT_FALSE(node->navigation_request()); @@ -420,7 +414,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, CrossSiteNavigation) { // Navigate to a different site. process()->sink().ClearMessages(); - int entry_id = RequestNavigation(node, kUrl2); + RequestNavigation(node, kUrl2); NavigationRequest* main_request = node->navigation_request(); ASSERT_TRUE(main_request); EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); @@ -439,7 +433,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, CrossSiteNavigation) { EXPECT_FALSE(DidRenderFrameHostRequestCommit(main_test_rfh())); EXPECT_TRUE(contents()->CrossProcessNavigationPending()); - speculative_rfh->SendNavigate(0, entry_id, true, kUrl2); + speculative_rfh->SendNavigate(0, kUrl2); RenderFrameHostImpl* final_rfh = main_test_rfh(); EXPECT_EQ(speculative_rfh, final_rfh); @@ -461,7 +455,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, RedirectCrossSite) { // Navigate to a URL on the same site. process()->sink().ClearMessages(); - int entry_id = RequestNavigation(node, kUrl1); + RequestNavigation(node, kUrl1); main_test_rfh()->SendBeforeUnloadACK(true); NavigationRequest* main_request = node->navigation_request(); ASSERT_TRUE(main_request); @@ -484,7 +478,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, RedirectCrossSite) { EXPECT_TRUE(DidRenderFrameHostRequestCommit(final_speculative_rfh)); // Commit the navigation. - final_speculative_rfh->SendNavigate(0, entry_id, true, kUrl2); + final_speculative_rfh->SendNavigate(0, kUrl2); RenderFrameHostImpl* final_rfh = main_test_rfh(); ASSERT_TRUE(final_rfh); EXPECT_NE(rfh, final_rfh); @@ -529,7 +523,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, // Request navigation to the 2nd URL; the NavigationRequest must have been // replaced by a new one with a different URL. - int entry_id = RequestNavigation(node, kUrl2); + RequestNavigation(node, kUrl2); main_test_rfh()->SendBeforeUnloadACK(true); NavigationRequest* request2 = node->navigation_request(); ASSERT_TRUE(request2); @@ -553,7 +547,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, EXPECT_FALSE(DidRenderFrameHostRequestCommit(main_test_rfh())); // Commit the navigation. - speculative_rfh->SendNavigate(0, entry_id, true, kUrl2); + speculative_rfh->SendNavigate(0, kUrl2); // Confirm that the commit corresponds to the new request. ASSERT_TRUE(main_test_rfh()); @@ -614,7 +608,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, EXPECT_TRUE(DidRenderFrameHostRequestCommit(main_test_rfh())); // Commit the navigation. - main_test_rfh()->SendNavigate(1, 0, true, kUrl2); + main_test_rfh()->SendNavigate(0, kUrl2); // Confirm that the commit corresponds to the new request. ASSERT_TRUE(main_test_rfh()); @@ -662,7 +656,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, EXPECT_TRUE(DidRenderFrameHostRequestCommit(main_test_rfh())); // Commit the navigation. - main_test_rfh()->SendNavigate(1, 0, true, kUrl1); + main_test_rfh()->SendNavigate(0, kUrl1); EXPECT_EQ(kUrl1, contents()->GetLastCommittedURL()); } @@ -680,7 +674,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, // Start a browser-initiated navigation to the 1st URL. process()->sink().ClearMessages(); - int entry_id = RequestNavigation(node, kUrl1); + RequestNavigation(node, kUrl1); NavigationRequest* request1 = node->navigation_request(); ASSERT_TRUE(request1); EXPECT_EQ(kUrl1, request1->common_params().url); @@ -710,7 +704,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, EXPECT_FALSE(DidRenderFrameHostRequestCommit(main_test_rfh())); // Commit the navigation. - speculative_rfh->SendNavigate(0, entry_id, true, kUrl1); + speculative_rfh->SendNavigate(0, kUrl1); EXPECT_EQ(kUrl1, contents()->GetLastCommittedURL()); } @@ -758,7 +752,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, EXPECT_TRUE(DidRenderFrameHostRequestCommit(main_test_rfh())); // Commit the navigation. - main_test_rfh()->SendNavigate(1, 0, true, kUrl2); + main_test_rfh()->SendNavigate(0, kUrl2); EXPECT_EQ(kUrl2, contents()->GetLastCommittedURL()); // The SiteInstance did not change. @@ -774,7 +768,6 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, Reload) { FrameTreeNode* node = main_test_rfh()->frame_tree_node(); controller().Reload(false); - int entry_id = controller().GetPendingEntry()->GetUniqueID(); // A NavigationRequest should have been generated. NavigationRequest* main_request = node->navigation_request(); ASSERT_TRUE(main_request != NULL); @@ -783,7 +776,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, Reload) { main_test_rfh()->PrepareForCommit(); EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); - main_test_rfh()->SendNavigate(0, entry_id, false, kUrl); + main_test_rfh()->SendNavigate(0, kUrl); EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); // Now do a shift+reload. @@ -809,7 +802,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, // Begin navigating to another site. const GURL kUrl("http://google.com/"); process()->sink().ClearMessages(); - int entry_id = RequestNavigation(node, kUrl); + RequestNavigation(node, kUrl); EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); // Receive the beforeUnload ACK. @@ -834,7 +827,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, EXPECT_FALSE(node->render_manager()->pending_frame_host()); // Invoke OnDidCommitProvisionalLoad. - speculative_rfh->SendNavigate(0, entry_id, true, kUrl); + speculative_rfh->SendNavigate(0, kUrl); EXPECT_EQ(site_instance_id, main_test_rfh()->GetSiteInstance()->GetId()); EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); EXPECT_FALSE(node->render_manager()->pending_frame_host()); @@ -853,7 +846,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, // Begin navigating to another site. const GURL kUrl("http://google.com/"); process()->sink().ClearMessages(); - int entry_id = RequestNavigation(node, kUrl); + RequestNavigation(node, kUrl); EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); // Receive the beforeUnload ACK. @@ -902,7 +895,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, EXPECT_NE(site_instance_id, redirect_site_instance_id); // Invoke OnDidCommitProvisionalLoad. - speculative_rfh->SendNavigate(0, entry_id, true, kUrlRedirect); + speculative_rfh->SendNavigate(0, kUrlRedirect); // Check that the speculative RenderFrameHost was swapped in. EXPECT_EQ(redirect_site_instance_id, @@ -938,7 +931,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, // should be reused. process()->sink().ClearMessages(); rfh1->GetProcess()->sink().ClearMessages(); - int entry_id = RequestNavigation(node, kUrl1); + RequestNavigation(node, kUrl1); EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); main_test_rfh()->SendBeforeUnloadACK(true); @@ -955,7 +948,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, EXPECT_TRUE(DidRenderFrameHostRequestCommit(rfh1)); EXPECT_FALSE(DidRenderFrameHostRequestCommit(main_test_rfh())); - rfh1->SendNavigate(1, entry_id, true, kUrl1); + rfh1->SendNavigate(1, kUrl1); EXPECT_EQ(rfh1, main_test_rfh()); EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); EXPECT_FALSE(rfhm->IsOnSwappedOutList(rfh1)); @@ -971,7 +964,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, DataUrls) { FrameTreeNode* node = main_test_rfh()->frame_tree_node(); // Navigate to a data url. - int entry_id = RequestNavigation(node, kUrl2); + RequestNavigation(node, kUrl2); NavigationRequest* navigation_request = node->navigation_request(); ASSERT_TRUE(navigation_request); EXPECT_EQ(NavigationRequest::WAITING_FOR_RENDERER_RESPONSE, @@ -985,7 +978,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, DataUrls) { EXPECT_FALSE(navigation_request->loader_for_testing()); TestRenderFrameHost* speculative_rfh = GetSpeculativeRenderFrameHost(node); ASSERT_TRUE(speculative_rfh); - speculative_rfh->SendNavigate(0, entry_id, true, kUrl2); + speculative_rfh->SendNavigate(0, kUrl2); EXPECT_EQ(main_test_rfh(), speculative_rfh); // Go back to the initial site. diff --git a/content/browser/frame_host/render_frame_host_manager_unittest.cc b/content/browser/frame_host/render_frame_host_manager_unittest.cc index 8088ea8..c5ea0e6 100644 --- a/content/browser/frame_host/render_frame_host_manager_unittest.cc +++ b/content/browser/frame_host/render_frame_host_manager_unittest.cc @@ -262,7 +262,6 @@ class RenderFrameHostManagerTest : public RenderViewHostImplTestHarness { // for us. controller().LoadURL( url, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); - int entry_id = controller().GetPendingEntry()->GetUniqueID(); // Simulate the BeforeUnload_ACK that is received from the current renderer // for a cross-site navigation. @@ -289,7 +288,7 @@ class RenderFrameHostManagerTest : public RenderViewHostImplTestHarness { // state is being checked. RenderFrameHostDeletedObserver rfh_observer(old_rfh); RenderViewHostDeletedObserver rvh_observer(old_rfh->GetRenderViewHost()); - active_rfh->SendNavigate(max_page_id + 1, entry_id, true, url); + active_rfh->SendNavigate(max_page_id + 1, url); // Make sure that we start to run the unload handler at the time of commit. bool expecting_rfh_shutdown = false; @@ -352,7 +351,6 @@ class RenderFrameHostManagerTest : public RenderViewHostImplTestHarness { // Navigate to a cross-site URL. contents()->GetController().LoadURL( kDestUrl, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); - int entry_id = contents()->GetController().GetPendingEntry()->GetUniqueID(); contents()->GetMainFrame()->PrepareForCommit(); EXPECT_TRUE(contents()->CrossProcessNavigationPending()); @@ -368,7 +366,7 @@ class RenderFrameHostManagerTest : public RenderViewHostImplTestHarness { // BeforeUnload finishes. ntp_rfh->SendBeforeUnloadACK(true); - dest_rfh->SendNavigate(101, entry_id, true, kDestUrl); + dest_rfh->SendNavigate(101, kDestUrl); ntp_rfh->OnSwappedOut(); EXPECT_TRUE(ntp_rfh->is_swapped_out()); @@ -437,23 +435,21 @@ TEST_F(RenderFrameHostManagerTest, NewTabPageProcesses) { // we use the committed one. contents2->GetController().LoadURL( kChromeUrl, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); - int entry_id = contents2->GetController().GetPendingEntry()->GetUniqueID(); contents2->GetMainFrame()->PrepareForCommit(); TestRenderFrameHost* ntp_rfh2 = contents2->GetMainFrame(); EXPECT_FALSE(contents2->CrossProcessNavigationPending()); - ntp_rfh2->SendNavigate(100, entry_id, true, kChromeUrl); + ntp_rfh2->SendNavigate(100, kChromeUrl); // The second one is the opposite, creating a cross-site transition and // requiring a beforeunload ack. contents2->GetController().LoadURL( kDestUrl, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); - entry_id = contents2->GetController().GetPendingEntry()->GetUniqueID(); contents2->GetMainFrame()->PrepareForCommit(); EXPECT_TRUE(contents2->CrossProcessNavigationPending()); TestRenderFrameHost* dest_rfh2 = contents2->GetPendingMainFrame(); ASSERT_TRUE(dest_rfh2); - dest_rfh2->SendNavigate(101, entry_id, true, kDestUrl); + dest_rfh2->SendNavigate(101, kDestUrl); // The two RFH's should be different in every way. EXPECT_NE(contents()->GetMainFrame()->GetProcess(), dest_rfh2->GetProcess()); @@ -469,10 +465,8 @@ TEST_F(RenderFrameHostManagerTest, NewTabPageProcesses) { contents2->GetController().LoadURL( kChromeUrl, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); - entry_id = contents2->GetController().GetPendingEntry()->GetUniqueID(); contents2->GetMainFrame()->PrepareForCommit(); - contents2->GetPendingMainFrame()->SendNavigate(102, entry_id, true, - kChromeUrl); + contents2->GetPendingMainFrame()->SendNavigate(102, kChromeUrl); EXPECT_NE(contents()->GetMainFrame()->GetSiteInstance(), contents2->GetMainFrame()->GetSiteInstance()); @@ -603,11 +597,9 @@ TEST_F(RenderFrameHostManagerTest, UpdateFaviconURLWhilePendingSwapOut) { // Navigate to a cross-site URL and commit the new page. controller().LoadURL( kDestUrl, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); - int entry_id = controller().GetPendingEntry()->GetUniqueID(); contents()->GetMainFrame()->PrepareForCommit(); TestRenderFrameHost* rfh2 = contents()->GetPendingMainFrame(); - contents()->TestDidNavigate(rfh2, 1, entry_id, true, kDestUrl, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(rfh2, 1, kDestUrl, ui::PAGE_TRANSITION_TYPED); EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh2->rfh_state()); EXPECT_EQ(RenderFrameHostImpl::STATE_PENDING_SWAP_OUT, rfh1->rfh_state()); @@ -861,7 +853,6 @@ TEST_F(RenderFrameHostManagerTest, AlwaysSendEnableViewSourceMode) { // GetURL() call. controller().LoadURL( kViewSourceUrl, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller().GetPendingEntry()->GetUniqueID(); // Simulate response from RenderFrame for DispatchBeforeUnload. contents()->GetMainFrame()->PrepareForCommit(); @@ -870,7 +861,7 @@ TEST_F(RenderFrameHostManagerTest, AlwaysSendEnableViewSourceMode) { RenderFrameHost* last_rfh = contents()->GetPendingMainFrame(); int32 new_id = contents()->GetMaxPageIDForSiteInstance(last_rfh->GetSiteInstance()) + 1; - contents()->GetPendingMainFrame()->SendNavigate(new_id, entry_id, true, kUrl); + contents()->GetPendingMainFrame()->SendNavigate(new_id, kUrl); EXPECT_EQ(1, controller().GetLastCommittedEntryIndex()); NavigationEntry* last_committed = controller().GetLastCommittedEntry(); @@ -888,7 +879,6 @@ TEST_F(RenderFrameHostManagerTest, AlwaysSendEnableViewSourceMode) { // Navigate, again. controller().LoadURL( kViewSourceUrl, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - entry_id = controller().GetPendingEntry()->GetUniqueID(); contents()->GetMainFrame()->PrepareForCommit(); // The same RenderViewHost should be reused. @@ -896,7 +886,7 @@ TEST_F(RenderFrameHostManagerTest, AlwaysSendEnableViewSourceMode) { EXPECT_EQ(last_rfh, contents()->GetMainFrame()); // The renderer sends a commit. - contents()->GetMainFrame()->SendNavigate(new_id, entry_id, false, kUrl); + contents()->GetMainFrame()->SendNavigate(new_id, kUrl); EXPECT_EQ(1, controller().GetLastCommittedEntryIndex()); EXPECT_FALSE(controller().GetPendingEntry()); @@ -1197,9 +1187,7 @@ TEST_F(RenderFrameHostManagerTest, PageDoesBackAndReload) { // Before that RFH has committed, the evil page reloads itself. FrameHostMsg_DidCommitProvisionalLoad_Params params; - params.page_id = 0; - params.nav_entry_id = 0; - params.did_create_new_entry = false; + params.page_id = 1; params.url = kUrl2; params.transition = ui::PAGE_TRANSITION_CLIENT_REDIRECT; params.should_update_history = false; @@ -1279,8 +1267,7 @@ TEST_F(RenderFrameHostManagerTest, NavigateAfterMissingSwapOutACK) { // The back navigation commits. const NavigationEntry* entry1 = contents()->GetController().GetPendingEntry(); - rfh1->SendNavigate(entry1->GetPageID(), entry1->GetUniqueID(), false, - entry1->GetURL()); + rfh1->SendNavigate(entry1->GetPageID(), entry1->GetURL()); EXPECT_TRUE(rfh2->IsWaitingForUnloadACK()); EXPECT_EQ(RenderFrameHostImpl::STATE_PENDING_SWAP_OUT, rfh2->rfh_state()); @@ -1288,8 +1275,7 @@ TEST_F(RenderFrameHostManagerTest, NavigateAfterMissingSwapOutACK) { contents()->GetController().GoForward(); contents()->GetMainFrame()->PrepareForCommit(); const NavigationEntry* entry2 = contents()->GetController().GetPendingEntry(); - rfh2->SendNavigate(entry2->GetPageID(), entry2->GetUniqueID(), false, - entry2->GetURL()); + rfh2->SendNavigate(entry2->GetPageID(), entry2->GetURL()); EXPECT_EQ(rfh2, main_test_rfh()); EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh2->rfh_state()); EXPECT_EQ(RenderFrameHostImpl::STATE_PENDING_SWAP_OUT, rfh1->rfh_state()); @@ -1468,8 +1454,7 @@ TEST_F(RenderFrameHostManagerTest, DisownOpenerDuringNavigation) { // The back navigation commits. const NavigationEntry* entry1 = contents()->GetController().GetPendingEntry(); - rfh1->SendNavigate(entry1->GetPageID(), entry1->GetUniqueID(), false, - entry1->GetURL()); + rfh1->SendNavigate(entry1->GetPageID(), entry1->GetURL()); // Ensure the opener is still cleared. EXPECT_FALSE(contents()->HasOpener()); @@ -1502,8 +1487,7 @@ TEST_F(RenderFrameHostManagerTest, DisownOpenerAfterNavigation) { contents()->GetController().GoBack(); contents()->GetMainFrame()->PrepareForCommit(); const NavigationEntry* entry1 = contents()->GetController().GetPendingEntry(); - rfh1->SendNavigate(entry1->GetPageID(), entry1->GetUniqueID(), false, - entry1->GetURL()); + rfh1->SendNavigate(entry1->GetPageID(), entry1->GetURL()); // Disown the opener from rfh2. rfh2->DidDisownOpener(); @@ -1777,7 +1761,6 @@ TEST_F(RenderFrameHostManagerTest, DeleteFrameAfterSwapOutACK) { // Navigate to new site, simulating onbeforeunload approval. controller().LoadURL( kUrl2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); - int entry_id = controller().GetPendingEntry()->GetUniqueID(); contents()->GetMainFrame()->PrepareForCommit(); EXPECT_TRUE(contents()->CrossProcessNavigationPending()); EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); @@ -1790,8 +1773,7 @@ TEST_F(RenderFrameHostManagerTest, DeleteFrameAfterSwapOutACK) { EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); // The new page commits. - contents()->TestDidNavigate(rfh2, 1, entry_id, true, kUrl2, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(rfh2, 1, kUrl2, ui::PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->CrossProcessNavigationPending()); EXPECT_EQ(rfh2, contents()->GetMainFrame()); EXPECT_TRUE(contents()->GetPendingMainFrame() == NULL); @@ -1827,15 +1809,13 @@ TEST_F(RenderFrameHostManagerTest, SwapOutFrameAfterSwapOutACK) { // Navigate to new site, simulating onbeforeunload approval. controller().LoadURL( kUrl2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); - int entry_id = controller().GetPendingEntry()->GetUniqueID(); contents()->GetMainFrame()->PrepareForCommit(); EXPECT_TRUE(contents()->CrossProcessNavigationPending()); EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); TestRenderFrameHost* rfh2 = contents()->GetPendingMainFrame(); // The new page commits. - contents()->TestDidNavigate(rfh2, 1, entry_id, true, kUrl2, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(rfh2, 1, kUrl2, ui::PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->CrossProcessNavigationPending()); EXPECT_EQ(rfh2, contents()->GetMainFrame()); EXPECT_TRUE(contents()->GetPendingMainFrame() == NULL); @@ -1872,14 +1852,12 @@ TEST_F(RenderFrameHostManagerTest, // Navigate to new site, simulating onbeforeunload approval. controller().LoadURL( kUrl2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); - int entry_id = controller().GetPendingEntry()->GetUniqueID(); rfh1->PrepareForCommit(); EXPECT_TRUE(contents()->CrossProcessNavigationPending()); TestRenderFrameHost* rfh2 = contents()->GetPendingMainFrame(); // The new page commits. - contents()->TestDidNavigate(rfh2, 1, entry_id, true, kUrl2, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(rfh2, 1, kUrl2, ui::PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->CrossProcessNavigationPending()); EXPECT_EQ(rfh2, contents()->GetMainFrame()); EXPECT_TRUE(contents()->GetPendingMainFrame() == NULL); diff --git a/content/browser/renderer_host/render_view_host_unittest.cc b/content/browser/renderer_host/render_view_host_unittest.cc index d3bb34a..39930dc 100644 --- a/content/browser/renderer_host/render_view_host_unittest.cc +++ b/content/browser/renderer_host/render_view_host_unittest.cc @@ -64,8 +64,7 @@ class RenderViewHostTest : public RenderViewHostImplTestHarness { // All about URLs reported by the renderer should get rewritten to about:blank. // See RenderViewHost::OnNavigate for a discussion. TEST_F(RenderViewHostTest, FilterAbout) { - main_test_rfh()->NavigateAndCommitRendererInitiated( - 1, true, GURL("about:cache")); + main_test_rfh()->NavigateAndCommitRendererInitiated(1, GURL("about:cache")); ASSERT_TRUE(controller().GetVisibleEntry()); EXPECT_EQ(GURL(url::kAboutBlankURL), controller().GetVisibleEntry()->GetURL()); @@ -235,14 +234,15 @@ TEST_F(RenderViewHostTest, NavigationWithBadHistoryItemFiles) { EXPECT_EQ(0, process()->bad_msg_count()); main_test_rfh()->SendRendererInitiatedNavigationRequest(url, false); main_test_rfh()->PrepareForCommit(); - contents()->GetMainFrame()->SendNavigateWithFile(1, 1, true, url, file_path); + contents()->GetMainFrame()->SendNavigateWithFile(1, url, file_path); EXPECT_EQ(1, process()->bad_msg_count()); ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( process()->GetID(), file_path); main_test_rfh()->SendRendererInitiatedNavigationRequest(url, false); main_test_rfh()->PrepareForCommit(); - contents()->GetMainFrame()->SendNavigateWithFile(2, 2, true, url, file_path); + contents()->GetMainFrame()->SendNavigateWithFile(process()->GetID(), url, + file_path); EXPECT_EQ(1, process()->bad_msg_count()); } diff --git a/content/browser/web_contents/aura/overscroll_navigation_overlay_unittest.cc b/content/browser/web_contents/aura/overscroll_navigation_overlay_unittest.cc index 9844e6c..8b6c784 100644 --- a/content/browser/web_contents/aura/overscroll_navigation_overlay_unittest.cc +++ b/content/browser/web_contents/aura/overscroll_navigation_overlay_unittest.cc @@ -253,9 +253,8 @@ TEST_F(OverscrollNavigationOverlayTest, CancelAfterSuccessfulNavigation) { EXPECT_EQ(GetOverlay()->direction_, OverscrollNavigationOverlay::NONE); EXPECT_TRUE(contents()->CrossProcessNavigationPending()); - NavigationEntry* pending = contents()->GetController().GetPendingEntry(); main_test_rfh()->SendNavigate( - 0, pending->GetUniqueID(), false, pending->GetURL()); + 1, contents()->GetController().GetPendingEntry()->GetURL()); EXPECT_EQ(contents()->GetURL(), third()); } @@ -269,9 +268,8 @@ TEST_F(OverscrollNavigationOverlayTest, Navigation_PaintUpdate) { // for the previous page, so we should still be observing. EXPECT_TRUE(GetOverlay()->web_contents()); - NavigationEntry* pending = contents()->GetController().GetPendingEntry(); main_test_rfh()->SendNavigate( - 0, pending->GetUniqueID(), false, pending->GetURL()); + 1, contents()->GetController().GetPendingEntry()->GetURL()); ReceivePaintUpdate(); // Navigation was committed and the paint update was received - we should no @@ -293,9 +291,8 @@ TEST_F(OverscrollNavigationOverlayTest, Navigation_LoadingUpdate) { contents()->TestSetIsLoading(true); contents()->TestSetIsLoading(false); EXPECT_FALSE(GetOverlay()->web_contents()); - NavigationEntry* pending = contents()->GetController().GetPendingEntry(); main_test_rfh()->SendNavigate( - 0, pending->GetUniqueID(), false, pending->GetURL()); + 1, contents()->GetController().GetPendingEntry()->GetURL()); EXPECT_EQ(contents()->GetURL(), third()); } diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc index bc0a10a..3a82a88 100644 --- a/content/browser/web_contents/web_contents_impl_unittest.cc +++ b/content/browser/web_contents/web_contents_impl_unittest.cc @@ -159,13 +159,9 @@ class TestInterstitialPage : public InterstitialPageImpl { CommandReceived(); } - void TestDidNavigate(int page_id, - int nav_entry_id, - bool did_create_new_entry, - const GURL& url) { + void TestDidNavigate(int page_id, const GURL& url) { FrameHostMsg_DidCommitProvisionalLoad_Params params; - InitNavigateParams(¶ms, page_id, nav_entry_id, did_create_new_entry, - url, ui::PAGE_TRANSITION_TYPED); + InitNavigateParams(¶ms, page_id, url, ui::PAGE_TRANSITION_TYPED); DidNavigate(GetMainFrame()->GetRenderViewHost(), params); } @@ -354,8 +350,8 @@ TEST_F(WebContentsImplTest, UpdateTitle) { NavigationControllerImpl& cont = static_cast<NavigationControllerImpl&>(controller()); FrameHostMsg_DidCommitProvisionalLoad_Params params; - InitNavigateParams(¶ms, 0, 0, true, GURL(url::kAboutBlankURL), - ui::PAGE_TRANSITION_TYPED); + InitNavigateParams( + ¶ms, 0, GURL(url::kAboutBlankURL), ui::PAGE_TRANSITION_TYPED); LoadCommittedDetails details; cont.RendererDidNavigate(contents()->GetMainFrame(), params, &details); @@ -397,15 +393,13 @@ 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(¶ms, 0, entry_id, true, kGURL, - ui::PAGE_TRANSITION_TYPED); + InitNavigateParams(¶ms, 0, kGURL, ui::PAGE_TRANSITION_TYPED); LoadCommittedDetails details; cont.RendererDidNavigate(contents()->GetMainFrame(), params, &details); // Also check title and url. @@ -445,7 +439,6 @@ 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(); main_test_rfh()->PrepareForCommit(); EXPECT_FALSE(contents()->CrossProcessNavigationPending()); EXPECT_EQ(instance1, orig_rfh->GetSiteInstance()); @@ -457,8 +450,7 @@ TEST_F(WebContentsImplTest, SimpleNavigation) { site_instance()); // DidNavigate from the page - contents()->TestDidNavigate(orig_rfh, 1, entry_id, true, url, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->CrossProcessNavigationPending()); EXPECT_EQ(orig_rfh, contents()->GetMainFrame()); EXPECT_EQ(instance1, orig_rfh->GetSiteInstance()); @@ -493,10 +485,8 @@ 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, entry_id, true, url, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rfh, 1, 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. @@ -511,7 +501,6 @@ 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(); @@ -533,8 +522,8 @@ TEST_F(WebContentsImplTest, CrossSiteBoundaries) { } // DidNavigate from the pending page - contents()->TestDidNavigate(pending_rfh, 1, entry_id, true, url2, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate( + pending_rfh, 1, url2, ui::PAGE_TRANSITION_TYPED); SiteInstance* instance2 = contents()->GetSiteInstance(); // Keep the number of active frames in pending_rfh's SiteInstance @@ -557,7 +546,6 @@ 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(); @@ -575,8 +563,7 @@ TEST_F(WebContentsImplTest, CrossSiteBoundaries) { } // DidNavigate from the back action - contents()->TestDidNavigate(goback_rfh, 1, entry_id, false, url2, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(goback_rfh, 1, url2, ui::PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->CrossProcessNavigationPending()); EXPECT_EQ(goback_rfh, contents()->GetMainFrame()); EXPECT_EQ(instance1, contents()->GetSiteInstance()); @@ -605,10 +592,8 @@ 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, entry_id, true, url, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->CrossProcessNavigationPending()); EXPECT_EQ(orig_rfh->GetRenderViewHost(), contents()->GetRenderViewHost()); @@ -622,7 +607,6 @@ 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()->CrossProcessNavigationPending()); @@ -631,8 +615,7 @@ TEST_F(WebContentsImplTest, CrossSiteBoundariesAfterCrash) { EXPECT_EQ(orig_rvh_delete_count, 1); // DidNavigate from the new page - contents()->TestDidNavigate(new_rfh, 1, entry_id, true, url2, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(new_rfh, 1, url2, ui::PAGE_TRANSITION_TYPED); SiteInstance* instance2 = contents()->GetSiteInstance(); EXPECT_FALSE(contents()->CrossProcessNavigationPending()); @@ -656,10 +639,8 @@ 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, entry_id, true, url, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED); // Open a new contents with the same SiteInstance, navigated to the same site. scoped_ptr<TestWebContents> contents2( @@ -667,22 +648,20 @@ 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, entry_id, true, url, - ui::PAGE_TRANSITION_TYPED); + contents2->TestDidNavigate( + contents2->GetMainFrame(), 2, 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, entry_id, true, url2a, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate( + pending_rfh_a, 1, url2a, ui::PAGE_TRANSITION_TYPED); SiteInstance* instance2a = contents()->GetSiteInstance(); EXPECT_NE(instance1, instance2a); @@ -691,7 +670,6 @@ 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(); @@ -701,8 +679,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, entry_id, true, url2b, - ui::PAGE_TRANSITION_TYPED); + contents2->TestDidNavigate( + pending_rfh_b, 2, url2b, ui::PAGE_TRANSITION_TYPED); SiteInstance* instance2b = contents2->GetSiteInstance(); EXPECT_NE(instance1, instance2b); @@ -728,10 +706,9 @@ 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, entry_id, true, native_url, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate( + orig_rfh, 1, native_url, ui::PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->CrossProcessNavigationPending()); EXPECT_EQ(orig_rfh, contents()->GetMainFrame()); @@ -746,14 +723,12 @@ 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()->CrossProcessNavigationPending()); EXPECT_EQ(native_url, contents()->GetLastCommittedURL()); EXPECT_EQ(url, contents()->GetVisibleURL()); EXPECT_FALSE(contents()->GetPendingMainFrame()); - contents()->TestDidNavigate(orig_rfh, 2, entry_id, true, url, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rfh, 1, 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 @@ -769,7 +744,6 @@ 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(); @@ -791,8 +765,8 @@ TEST_F(WebContentsImplTest, NavigateFromSitelessUrl) { } // DidNavigate from the pending page. - contents()->TestDidNavigate(pending_rfh, 1, entry_id, true, url2, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate( + pending_rfh, 1, url2, ui::PAGE_TRANSITION_TYPED); SiteInstance* new_instance = contents()->GetSiteInstance(); EXPECT_FALSE(contents()->CrossProcessNavigationPending()); @@ -839,10 +813,9 @@ TEST_F(WebContentsImplTest, NavigateFromRestoredSitelessUrl) { ASSERT_EQ(0u, entries.size()); ASSERT_EQ(1, controller().GetEntryCount()); controller().GoToIndex(0); - entry = controller().GetPendingEntry(); orig_rfh->PrepareForCommit(); - contents()->TestDidNavigate(orig_rfh, 0, entry->GetUniqueID(), false, - native_url, ui::PAGE_TRANSITION_RELOAD); + contents()->TestDidNavigate( + orig_rfh, 0, native_url, ui::PAGE_TRANSITION_RELOAD); EXPECT_EQ(orig_instance, contents()->GetSiteInstance()); EXPECT_EQ(GURL(), contents()->GetSiteInstance()->GetSiteURL()); EXPECT_FALSE(orig_instance->HasSite()); @@ -852,10 +825,8 @@ TEST_F(WebContentsImplTest, NavigateFromRestoredSitelessUrl) { 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(orig_rfh, 2, entry->GetUniqueID(), true, url, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rfh, 2, url, ui::PAGE_TRANSITION_TYPED); EXPECT_EQ(orig_instance, contents()->GetSiteInstance()); // Cleanup. @@ -887,10 +858,9 @@ 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, entry->GetUniqueID(), false, - regular_url, ui::PAGE_TRANSITION_RELOAD); + contents()->TestDidNavigate( + orig_rfh, 0, regular_url, ui::PAGE_TRANSITION_RELOAD); EXPECT_EQ(orig_instance, contents()->GetSiteInstance()); EXPECT_TRUE(orig_instance->HasSite()); @@ -898,11 +868,9 @@ 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, - entry->GetUniqueID(), true, url, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate( + contents()->GetPendingMainFrame(), 2, url, ui::PAGE_TRANSITION_TYPED); EXPECT_NE(orig_instance, contents()->GetSiteInstance()); // Cleanup. @@ -918,10 +886,8 @@ 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, entry_id, true, url, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rfh, 1, 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"); @@ -951,10 +917,9 @@ 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, entry_id, true, url, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate( + orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED); // Open a related contents to a second site. scoped_ptr<TestWebContents> contents2( @@ -963,15 +928,12 @@ 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->CrossProcessNavigationPending()); - contents2->TestDidNavigate(rfh2, 2, entry_id, true, url2, - ui::PAGE_TRANSITION_TYPED); + contents2->TestDidNavigate(rfh2, 2, url2, ui::PAGE_TRANSITION_TYPED); SiteInstance* instance2 = contents2->GetSiteInstance(); EXPECT_NE(instance1, instance2); EXPECT_FALSE(contents2->CrossProcessNavigationPending()); @@ -980,8 +942,8 @@ TEST_F(WebContentsImplTest, CrossSiteComparesAgainstCurrentPage) { // SiteInstances, because we don't intercept Blink navigations. orig_rfh->SendRendererInitiatedNavigationRequest(url2, true); orig_rfh->PrepareForCommit(); - contents()->TestDidNavigate(orig_rfh, 2, 0, true, url2, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate( + orig_rfh, 2, url2, ui::PAGE_TRANSITION_TYPED); SiteInstance* instance3 = contents()->GetSiteInstance(); EXPECT_EQ(instance1, instance3); EXPECT_FALSE(contents()->CrossProcessNavigationPending()); @@ -991,11 +953,10 @@ 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()->CrossProcessNavigationPending()); contents()->GetMainFrame()->PrepareForCommit(); - contents()->TestDidNavigate(orig_rfh, 3, entry_id, true, url3, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate( + orig_rfh, 3, url3, ui::PAGE_TRANSITION_TYPED); SiteInstance* instance4 = contents()->GetSiteInstance(); EXPECT_EQ(instance1, instance4); } @@ -1010,10 +971,8 @@ 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, entry_id, true, url, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->CrossProcessNavigationPending()); EXPECT_EQ(orig_rfh, contents()->GetMainFrame()); @@ -1032,7 +991,6 @@ 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(); @@ -1043,8 +1001,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, entry_id, true, url2, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate( + pending_rfh, 1, url2, ui::PAGE_TRANSITION_TYPED); SiteInstance* instance2 = contents()->GetSiteInstance(); EXPECT_FALSE(contents()->CrossProcessNavigationPending()); EXPECT_EQ(pending_rfh, contents()->GetMainFrame()); @@ -1063,10 +1021,8 @@ 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, entry_id, true, url, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->CrossProcessNavigationPending()); EXPECT_EQ(orig_rfh, contents()->GetMainFrame()); @@ -1079,7 +1035,7 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationPreempted) { EXPECT_TRUE(contents()->CrossProcessNavigationPending()); // Suppose the original renderer navigates before the new one is ready. - orig_rfh->SendNavigate(2, 0, true, GURL("http://www.google.com/foo")); + orig_rfh->SendNavigate(2, GURL("http://www.google.com/foo")); // Verify that the pending navigation is cancelled. EXPECT_FALSE(orig_rfh->IsWaitingForBeforeUnloadACK()); @@ -1095,11 +1051,9 @@ 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, entry_id, true, url1, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(ntp_rfh, 1, url1, ui::PAGE_TRANSITION_TYPED); NavigationEntry* entry1 = controller().GetLastCommittedEntry(); SiteInstance* instance1 = contents()->GetSiteInstance(); @@ -1115,7 +1069,6 @@ 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()->CrossProcessNavigationPending()); TestRenderFrameHost* google_rfh = contents()->GetPendingMainFrame(); @@ -1125,8 +1078,8 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationBackPreempted) { ntp_rfh->PrepareForCommit(); // DidNavigate from the pending page. - contents()->TestDidNavigate(google_rfh, 1, entry_id, true, url2, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate( + google_rfh, 1, url2, ui::PAGE_TRANSITION_TYPED); NavigationEntry* entry2 = controller().GetLastCommittedEntry(); SiteInstance* instance2 = contents()->GetSiteInstance(); @@ -1144,11 +1097,10 @@ 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()->CrossProcessNavigationPending()); contents()->GetMainFrame()->PrepareForCommit(); - contents()->TestDidNavigate(google_rfh, 2, entry_id, true, url3, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate( + google_rfh, 2, url3, ui::PAGE_TRANSITION_TYPED); NavigationEntry* entry3 = controller().GetLastCommittedEntry(); SiteInstance* instance3 = contents()->GetSiteInstance(); @@ -1162,7 +1114,6 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationBackPreempted) { // Go back within the site. controller().GoBack(); - NavigationEntry* goback_entry = controller().GetPendingEntry(); EXPECT_FALSE(contents()->CrossProcessNavigationPending()); EXPECT_EQ(entry2, controller().GetPendingEntry()); @@ -1180,8 +1131,7 @@ 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, goback_entry->GetUniqueID(), false, - url2, ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(google_rfh, 1, url2, ui::PAGE_TRANSITION_TYPED); // We should commit this page and forget about the second back. EXPECT_FALSE(contents()->CrossProcessNavigationPending()); @@ -1208,10 +1158,8 @@ 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, entry_id, true, url, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->CrossProcessNavigationPending()); EXPECT_EQ(orig_rfh, contents()->GetMainFrame()); @@ -1223,9 +1171,8 @@ 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, 0, false, - GURL("http://google.com/frame"), - ui::PAGE_TRANSITION_AUTO_SUBFRAME); + child_rfh->SendNavigateWithTransition( + 1, 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 @@ -1244,7 +1191,6 @@ 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()->CrossProcessNavigationPending()); @@ -1252,7 +1198,6 @@ 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()->CrossProcessNavigationPending()); EXPECT_TRUE(orig_rfh->IsWaitingForBeforeUnloadACK()); @@ -1260,14 +1205,13 @@ 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, entry1_id, true, GURL("chrome://blah")); + orig_rfh->SendNavigate(1, GURL("chrome://blah")); EXPECT_TRUE(contents()->CrossProcessNavigationPending()); 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, entry2_id, true, url2, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(pending_rfh, 1, url2, ui::PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->CrossProcessNavigationPending()); EXPECT_EQ(pending_rfh, contents()->GetMainFrame()); } @@ -1281,14 +1225,12 @@ 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. orig_rfh->PrepareForCommit(); - contents()->TestDidNavigate(orig_rfh, 1, entry_id, true, url, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED); entry = controller().GetLastCommittedEntry(); EXPECT_TRUE(entry->GetPageState().IsValid()); @@ -1296,23 +1238,19 @@ 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. orig_rfh->PrepareForCommit(); - contents()->TestDidNavigate(orig_rfh, 2, entry_id, true, url2, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rfh, 2, 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(); - entry_id = controller().GetPendingEntry()->GetUniqueID(); orig_rfh->PrepareForCommit(); - contents()->TestDidNavigate(orig_rfh, 1, entry_id, false, url, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED); entry = controller().GetLastCommittedEntry(); EXPECT_TRUE(entry->GetPageState().IsValid()); } @@ -1323,12 +1261,15 @@ TEST_F(WebContentsImplTest, NavigationEntryContentState) { TEST_F(WebContentsImplTest, NavigationEntryContentStateNewWindow) { TestRenderFrameHost* orig_rfh = contents()->GetMainFrame(); - // Navigate to about:blank. + // When opening a new window, it is navigated to about:blank internally. + // Currently, this results in two DidNavigate events. const GURL url(url::kAboutBlankURL); orig_rfh->SendRendererInitiatedNavigationRequest(url, false); orig_rfh->PrepareForCommit(); - contents()->TestDidNavigate(orig_rfh, 1, 0, true, url, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED); + orig_rfh->SendRendererInitiatedNavigationRequest(url, false); + orig_rfh->PrepareForCommit(); + contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED); // Should have a page state here. NavigationEntry* entry = controller().GetLastCommittedEntry(); @@ -1344,12 +1285,10 @@ 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()->CrossProcessNavigationPending()); EXPECT_EQ(orig_rfh, contents()->GetMainFrame()); orig_rfh->PrepareForCommit(); - contents()->TestDidNavigate(orig_rfh, 2, entry->GetUniqueID(), true, new_url, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rfh, 1, new_url, ui::PAGE_TRANSITION_TYPED); NavigationEntryImpl* entry_impl2 = NavigationEntryImpl::FromNavigationEntry( controller().GetLastCommittedEntry()); EXPECT_EQ(site_instance_id, entry_impl2->site_instance()->GetId()); @@ -1368,10 +1307,8 @@ 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, entry_id, true, url, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rfh, 1, url, ui::PAGE_TRANSITION_TYPED); EXPECT_EQ(orig_rfh, contents()->GetMainFrame()); // Toggle fullscreen mode on (as if initiated via IPC from renderer). @@ -1388,11 +1325,10 @@ 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, entry_id, true, url2, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate( + pending_rfh, 1, url2, ui::PAGE_TRANSITION_TYPED); // Confirm fullscreen has exited. EXPECT_FALSE(orig_rvh->IsFullscreenGranted()); @@ -1414,21 +1350,17 @@ TEST_F(WebContentsImplTest, HistoryNavigationExitsFullscreen) { 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, entry_id, true, url, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rfh, 1, 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(); orig_rfh->PrepareForCommit(); EXPECT_FALSE(contents()->CrossProcessNavigationPending()); - contents()->TestDidNavigate(orig_rfh, 2, entry_id, true, url2, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rfh, 2, url2, ui::PAGE_TRANSITION_TYPED); EXPECT_EQ(orig_rfh, contents()->GetMainFrame()); // Sanity-check: Confirm we're not starting out in fullscreen mode. @@ -1449,12 +1381,11 @@ TEST_F(WebContentsImplTest, HistoryNavigationExitsFullscreen) { controller().GoBack(); else controller().GoForward(); - entry_id = controller().GetPendingEntry()->GetUniqueID(); orig_rfh->PrepareForCommit(); EXPECT_FALSE(contents()->CrossProcessNavigationPending()); EXPECT_EQ(orig_rfh, contents()->GetMainFrame()); - contents()->TestDidNavigate(orig_rfh, i + 1, entry_id, false, url, - ui::PAGE_TRANSITION_FORWARD_BACK); + contents()->TestDidNavigate( + orig_rfh, i + 1, url, ui::PAGE_TRANSITION_FORWARD_BACK); // Confirm fullscreen has exited. EXPECT_FALSE(orig_rvh->IsFullscreenGranted()); @@ -1489,10 +1420,9 @@ TEST_F(WebContentsImplTest, CrashExitsFullscreen) { const GURL url("http://www.google.com"); controller().LoadURL( url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = controller().GetPendingEntry()->GetUniqueID(); main_test_rfh()->PrepareForCommit(); - contents()->TestDidNavigate(contents()->GetMainFrame(), 1, entry_id, true, - url, ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate( + contents()->GetMainFrame(), 1, url, ui::PAGE_TRANSITION_TYPED); // Toggle fullscreen mode on (as if initiated via IPC from renderer). EXPECT_FALSE(test_rvh()->IsFullscreenGranted()); @@ -1526,13 +1456,12 @@ TEST_F(WebContentsImplTest, ShowInterstitialFromBrowserWithNewNavigationDontProceed) { // Navigate to a page. GURL url1("http://www.google.com"); - main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, url1); + main_test_rfh()->NavigateAndCommitRendererInitiated(1, 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 = @@ -1543,17 +1472,16 @@ 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, interstitial_entry_id, true, url2); + interstitial->TestDidNavigate(1, url2); EXPECT_TRUE(interstitial->is_showing()); EXPECT_TRUE(contents()->ShowingInterstitialPage()); EXPECT_TRUE(contents()->GetInterstitialPage() == interstitial); - entry = controller().GetVisibleEntry(); + NavigationEntry* entry = controller().GetVisibleEntry(); ASSERT_NE(nullptr, entry); EXPECT_TRUE(entry->GetURL() == url2); @@ -1575,10 +1503,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, - ShowInterstitialFromRendererWithNewNavigationDontProceed) { + ShowInterstitiaFromRendererlWithNewNavigationDontProceed) { // Navigate to a page. GURL url1("http://www.google.com"); - main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, url1); + main_test_rfh()->NavigateAndCommitRendererInitiated(1, url1); EXPECT_EQ(1, controller().GetEntryCount()); // Show an interstitial (no pending entry, the interstitial would have been @@ -1591,13 +1519,12 @@ 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, interstitial_entry_id, true, url2); + interstitial->TestDidNavigate(1, url2); EXPECT_TRUE(interstitial->is_showing()); EXPECT_TRUE(contents()->ShowingInterstitialPage()); EXPECT_TRUE(contents()->GetInterstitialPage() == interstitial); @@ -1625,7 +1552,7 @@ TEST_F(WebContentsImplTest, TEST_F(WebContentsImplTest, ShowInterstitialNoNewNavigationDontProceed) { // Navigate to a page. GURL url1("http://www.google.com"); - main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, url1); + main_test_rfh()->NavigateAndCommitRendererInitiated(1, url1); EXPECT_EQ(1, controller().GetEntryCount()); // Show an interstitial. @@ -1642,7 +1569,7 @@ TEST_F(WebContentsImplTest, ShowInterstitialNoNewNavigationDontProceed) { EXPECT_FALSE(contents()->ShowingInterstitialPage()); EXPECT_EQ(nullptr, contents()->GetInterstitialPage()); // Let's commit the interstitial navigation. - interstitial->TestDidNavigate(1, 0, true, url2); + interstitial->TestDidNavigate(1, url2); EXPECT_TRUE(interstitial->is_showing()); EXPECT_TRUE(contents()->ShowingInterstitialPage()); EXPECT_TRUE(contents()->GetInterstitialPage() == interstitial); @@ -1672,7 +1599,7 @@ TEST_F(WebContentsImplTest, ShowInterstitialFromBrowserNewNavigationProceed) { // Navigate to a page. GURL url1("http://www.google.com"); - main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, url1); + main_test_rfh()->NavigateAndCommitRendererInitiated(1, url1); EXPECT_EQ(1, controller().GetEntryCount()); // Initiate a browser navigation that will trigger the interstitial @@ -1688,13 +1615,12 @@ 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, interstitial_entry_id, true, url2); + interstitial->TestDidNavigate(1, url2); EXPECT_TRUE(interstitial->is_showing()); EXPECT_TRUE(contents()->ShowingInterstitialPage()); EXPECT_TRUE(contents()->GetInterstitialPage() == interstitial); @@ -1714,7 +1640,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, 0, true, url3); + contents()->GetMainFrame()->SendNavigate(2, url3); EXPECT_FALSE(contents()->ShowingInterstitialPage()); EXPECT_EQ(nullptr, contents()->GetInterstitialPage()); @@ -1735,7 +1661,7 @@ TEST_F(WebContentsImplTest, ShowInterstitialFromRendererNewNavigationProceed) { // Navigate to a page. GURL url1("http://www.google.com"); - main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, url1); + main_test_rfh()->NavigateAndCommitRendererInitiated(1, url1); EXPECT_EQ(1, controller().GetEntryCount()); // Show an interstitial. @@ -1747,13 +1673,12 @@ 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, interstitial_entry_id, true, url2); + interstitial->TestDidNavigate(1, url2); EXPECT_TRUE(interstitial->is_showing()); EXPECT_TRUE(contents()->ShowingInterstitialPage()); EXPECT_TRUE(contents()->GetInterstitialPage() == interstitial); @@ -1773,7 +1698,7 @@ TEST_F(WebContentsImplTest, // Simulate the navigation to the page, that's when the interstitial gets // hidden. GURL url3("http://www.thepage.com"); - main_test_rfh()->NavigateAndCommitRendererInitiated(2, true, url3); + main_test_rfh()->NavigateAndCommitRendererInitiated(2, url3); EXPECT_FALSE(contents()->ShowingInterstitialPage()); EXPECT_EQ(nullptr, contents()->GetInterstitialPage()); @@ -1793,7 +1718,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"); - main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, url1); + main_test_rfh()->NavigateAndCommitRendererInitiated(1, url1); EXPECT_EQ(1, controller().GetEntryCount()); // Show an interstitial. @@ -1810,7 +1735,7 @@ TEST_F(WebContentsImplTest, ShowInterstitialNoNewNavigationProceed) { EXPECT_FALSE(contents()->ShowingInterstitialPage()); EXPECT_EQ(nullptr, contents()->GetInterstitialPage()); // Let's commit the interstitial navigation. - interstitial->TestDidNavigate(1, 0, true, url2); + interstitial->TestDidNavigate(1, url2); EXPECT_TRUE(interstitial->is_showing()); EXPECT_TRUE(contents()->ShowingInterstitialPage()); EXPECT_TRUE(contents()->GetInterstitialPage() == interstitial); @@ -1847,12 +1772,11 @@ TEST_F(WebContentsImplTest, ShowInterstitialThenNavigate) { new TestInterstitialPage(contents(), true, url, &state, &deleted); TestInterstitialPageStateGuard state_guard(interstitial); interstitial->Show(); - int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID(); - interstitial->TestDidNavigate(1, interstitial_entry_id, true, url); + interstitial->TestDidNavigate(1, url); // While interstitial showing, navigate to a new URL. const GURL url2("http://www.yahoo.com"); - main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, url2); + main_test_rfh()->NavigateAndCommitRendererInitiated(1, url2); EXPECT_EQ(TestInterstitialPage::CANCELED, state); @@ -1864,9 +1788,8 @@ 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"); - main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, url1); + main_test_rfh()->NavigateAndCommitRendererInitiated(1, url1); EXPECT_EQ(1, controller().GetEntryCount()); - NavigationEntry* entry = controller().GetLastCommittedEntry(); // Show interstitial. TestInterstitialPage::InterstitialState state = @@ -1878,20 +1801,17 @@ TEST_F(WebContentsImplTest, ShowInterstitialThenGoBack) { &state, &deleted); TestInterstitialPageStateGuard state_guard(interstitial); interstitial->Show(); - int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID(); - interstitial->TestDidNavigate(2, interstitial_entry_id, true, - interstitial_url); + interstitial->TestDidNavigate(2, interstitial_url); // While the interstitial is showing, go back. controller().GoBack(); main_test_rfh()->PrepareForCommit(); - contents()->GetMainFrame()->SendNavigate(1, entry->GetUniqueID(), false, - url1); + contents()->GetMainFrame()->SendNavigate(1, url1); // Make sure we are back to the original page and that the interstitial is // gone. EXPECT_EQ(TestInterstitialPage::CANCELED, state); - entry = controller().GetVisibleEntry(); + NavigationEntry* entry = controller().GetVisibleEntry(); ASSERT_TRUE(entry); EXPECT_EQ(url1.spec(), entry->GetURL().spec()); @@ -1904,9 +1824,8 @@ 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"); - main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, url1); + main_test_rfh()->NavigateAndCommitRendererInitiated(1, url1); EXPECT_EQ(1, controller().GetEntryCount()); - NavigationEntry* entry = controller().GetLastCommittedEntry(); // Show interstitial. TestInterstitialPage::InterstitialState state = @@ -1918,9 +1837,7 @@ TEST_F(WebContentsImplTest, ShowInterstitialCrashRendererThenGoBack) { &state, &deleted); TestInterstitialPageStateGuard state_guard(interstitial); interstitial->Show(); - int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID(); - interstitial->TestDidNavigate(2, interstitial_entry_id, true, - interstitial_url); + interstitial->TestDidNavigate(2, interstitial_url); // Crash the renderer contents()->GetMainFrame()->GetProcess()->SimulateCrash(); @@ -1928,13 +1845,12 @@ TEST_F(WebContentsImplTest, ShowInterstitialCrashRendererThenGoBack) { // While the interstitial is showing, go back. controller().GoBack(); main_test_rfh()->PrepareForCommit(); - contents()->GetMainFrame()->SendNavigate(1, entry->GetUniqueID(), false, - url1); + contents()->GetMainFrame()->SendNavigate(1, url1); // Make sure we are back to the original page and that the interstitial is // gone. EXPECT_EQ(TestInterstitialPage::CANCELED, state); - entry = controller().GetVisibleEntry(); + NavigationEntry* entry = controller().GetVisibleEntry(); ASSERT_TRUE(entry); EXPECT_EQ(url1.spec(), entry->GetURL().spec()); @@ -1947,7 +1863,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"); - main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, url1); + main_test_rfh()->NavigateAndCommitRendererInitiated(1, url1); EXPECT_EQ(1, controller().GetEntryCount()); // Show interstitial. @@ -1960,13 +1876,11 @@ TEST_F(WebContentsImplTest, ShowInterstitialCrashRendererThenNavigate) { &state, &deleted); TestInterstitialPageStateGuard state_guard(interstitial); interstitial->Show(); - int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID(); // Crash the renderer contents()->GetMainFrame()->GetProcess()->SimulateCrash(); - interstitial->TestDidNavigate(2, interstitial_entry_id, true, - interstitial_url); + interstitial->TestDidNavigate(2, interstitial_url); } // Test navigating to a page that shows an interstitial, then close the @@ -1981,8 +1895,7 @@ TEST_F(WebContentsImplTest, ShowInterstitialThenCloseTab) { new TestInterstitialPage(contents(), true, url, &state, &deleted); TestInterstitialPageStateGuard state_guard(interstitial); interstitial->Show(); - int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID(); - interstitial->TestDidNavigate(1, interstitial_entry_id, true, url); + interstitial->TestDidNavigate(1, url); // Now close the contents. DeleteContents(); @@ -2004,8 +1917,7 @@ TEST_F(WebContentsImplTest, ShowInterstitialThenCloseAndShutdown) { new TestInterstitialPage(contents(), true, url, &state, &deleted); TestInterstitialPageStateGuard state_guard(interstitial); interstitial->Show(); - int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID(); - interstitial->TestDidNavigate(1, interstitial_entry_id, true, url); + interstitial->TestDidNavigate(1, url); TestRenderFrameHost* rfh = static_cast<TestRenderFrameHost*>(interstitial->GetMainFrame()); @@ -2027,7 +1939,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"); - main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, url1); + main_test_rfh()->NavigateAndCommitRendererInitiated(1, url1); EXPECT_EQ(1, controller().GetEntryCount()); // Show an interstitial. @@ -2039,8 +1951,7 @@ TEST_F(WebContentsImplTest, ShowInterstitialProceedMultipleCommands) { new TestInterstitialPage(contents(), true, url2, &state, &deleted); TestInterstitialPageStateGuard state_guard(interstitial); interstitial->Show(); - int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID(); - interstitial->TestDidNavigate(1, interstitial_entry_id, true, url2); + interstitial->TestDidNavigate(1, url2); // Run a command. EXPECT_EQ(0, interstitial->command_received_count()); @@ -2063,7 +1974,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"); - main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, start_url); + main_test_rfh()->NavigateAndCommitRendererInitiated(1, start_url); EXPECT_EQ(1, controller().GetEntryCount()); // Show an interstitial. @@ -2075,8 +1986,7 @@ TEST_F(WebContentsImplTest, ShowInterstitialOnInterstitial) { new TestInterstitialPage(contents(), true, url1, &state1, &deleted1); TestInterstitialPageStateGuard state_guard1(interstitial1); interstitial1->Show(); - int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID(); - interstitial1->TestDidNavigate(1, interstitial_entry_id, true, url1); + interstitial1->TestDidNavigate(1, url1); // Now show another interstitial. TestInterstitialPage::InterstitialState state2 = @@ -2087,8 +1997,7 @@ TEST_F(WebContentsImplTest, ShowInterstitialOnInterstitial) { new TestInterstitialPage(contents(), true, url2, &state2, &deleted2); TestInterstitialPageStateGuard state_guard2(interstitial2); interstitial2->Show(); - interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID(); - interstitial2->TestDidNavigate(1, interstitial_entry_id, true, url2); + interstitial2->TestDidNavigate(1, url2); // Showing interstitial2 should have caused interstitial1 to go away. EXPECT_EQ(TestInterstitialPage::CANCELED, state1); @@ -2101,7 +2010,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, 0, true, landing_url); + contents()->GetMainFrame()->SendNavigate(2, landing_url); EXPECT_FALSE(contents()->ShowingInterstitialPage()); EXPECT_EQ(nullptr, contents()->GetInterstitialPage()); @@ -2118,7 +2027,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"); - main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, start_url); + main_test_rfh()->NavigateAndCommitRendererInitiated(1, start_url); EXPECT_EQ(1, controller().GetEntryCount()); // Show an interstitial. @@ -2130,8 +2039,7 @@ TEST_F(WebContentsImplTest, ShowInterstitialProceedShowInterstitial) { new TestInterstitialPage(contents(), true, url1, &state1, &deleted1); TestInterstitialPageStateGuard state_guard1(interstitial1); interstitial1->Show(); - int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID(); - interstitial1->TestDidNavigate(1, interstitial_entry_id, true, url1); + interstitial1->TestDidNavigate(1, url1); // Take action. The interstitial won't be hidden until the navigation is // committed. @@ -2148,8 +2056,7 @@ TEST_F(WebContentsImplTest, ShowInterstitialProceedShowInterstitial) { new TestInterstitialPage(contents(), true, url2, &state2, &deleted2); TestInterstitialPageStateGuard state_guard2(interstitial2); interstitial2->Show(); - interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID(); - interstitial2->TestDidNavigate(1, interstitial_entry_id, true, url2); + interstitial2->TestDidNavigate(1, url2); // Showing interstitial2 should have caused interstitial1 to go away. EXPECT_EQ(TestInterstitialPage::UNDECIDED, state2); @@ -2160,7 +2067,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, 0, true, landing_url); + contents()->GetMainFrame()->SendNavigate(2, landing_url); RunAllPendingInMessageLoop(); EXPECT_TRUE(deleted2); @@ -2185,7 +2092,6 @@ 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. @@ -2197,8 +2103,7 @@ TEST_F(WebContentsImplTest, NavigateBeforeInterstitialShows) { ASSERT_FALSE(deleted); // Now let's make the interstitial navigation commit. - interstitial->TestDidNavigate(1, interstitial_entry_id, true, - interstitial_url); + interstitial->TestDidNavigate(1, interstitial_url); // After it loaded the interstitial should be gone. EXPECT_EQ(TestInterstitialPage::CANCELED, state); @@ -2232,7 +2137,6 @@ 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); @@ -2244,8 +2148,7 @@ TEST_F(WebContentsImplTest, TwoQuickInterstitials) { ASSERT_FALSE(deleted2); // Make the interstitial navigation commit it should be showing. - interstitial2->TestDidNavigate(1, interstitial_entry_id, true, - interstitial_url); + interstitial2->TestDidNavigate(1, interstitial_url); EXPECT_EQ(interstitial2, contents()->GetInterstitialPage()); } @@ -2272,8 +2175,7 @@ TEST_F(WebContentsImplTest, InterstitialCrasher) { interstitial = new TestInterstitialPage(contents(), true, url, &state, &deleted); interstitial->Show(); - int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID(); - interstitial->TestDidNavigate(1, interstitial_entry_id, true, url); + interstitial->TestDidNavigate(1, url); // Simulate a renderer crash. interstitial->TestRenderViewTerminated( base::TERMINATION_STATUS_PROCESS_CRASHED, -1); @@ -2302,8 +2204,7 @@ TEST_F(WebContentsImplTest, NewInterstitialDoesNotCancelPendingEntry) { new TestInterstitialPage(contents(), true, kGURL, &state, &deleted); TestInterstitialPageStateGuard state_guard(interstitial); interstitial->Show(); - int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID(); - interstitial->TestDidNavigate(1, interstitial_entry_id, true, kGURL); + interstitial->TestDidNavigate(1, kGURL); // Initiate a new navigation from the browser that also triggers an // interstitial. @@ -2316,8 +2217,7 @@ TEST_F(WebContentsImplTest, NewInterstitialDoesNotCancelPendingEntry) { new TestInterstitialPage(contents(), true, kGURL, &state2, &deleted2); TestInterstitialPageStateGuard state_guard2(interstitial2); interstitial2->Show(); - interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID(); - interstitial2->TestDidNavigate(1, interstitial_entry_id, true, kGURL); + interstitial2->TestDidNavigate(1, kGURL); // Make sure we still have an entry. NavigationEntry* entry = contents()->GetController().GetPendingEntry(); @@ -2341,11 +2241,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(); main_test_rfh()->PrepareForCommit(); // DidNavigate from the page - contents()->TestDidNavigate(contents()->GetMainFrame(), 1, entry_id, true, - kGURL, ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate( + contents()->GetMainFrame(), 1, kGURL, ui::PAGE_TRANSITION_TYPED); // Simulate showing an interstitial while the page is showing. TestInterstitialPage::InterstitialState state = @@ -2355,8 +2254,7 @@ TEST_F(WebContentsImplTest, NoJSMessageOnInterstitials) { new TestInterstitialPage(contents(), true, kGURL, &state, &deleted); TestInterstitialPageStateGuard state_guard(interstitial); interstitial->Show(); - int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID(); - interstitial->TestDidNavigate(1, interstitial_entry_id, true, kGURL); + interstitial->TestDidNavigate(1, kGURL); // While the interstitial is showing, let's simulate the hidden page // attempting to show a JS message. @@ -2373,7 +2271,7 @@ TEST_F(WebContentsImplTest, NoJSMessageOnInterstitials) { TEST_F(WebContentsImplTest, CopyStateFromAndPruneSourceInterstitial) { // Navigate to a page. GURL url1("http://www.google.com"); - main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, url1); + main_test_rfh()->NavigateAndCommitRendererInitiated(1, url1); EXPECT_EQ(1, controller().GetEntryCount()); // Initiate a browser navigation that will trigger the interstitial @@ -2389,8 +2287,7 @@ TEST_F(WebContentsImplTest, CopyStateFromAndPruneSourceInterstitial) { new TestInterstitialPage(contents(), true, url2, &state, &deleted); TestInterstitialPageStateGuard state_guard(interstitial); interstitial->Show(); - int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID(); - interstitial->TestDidNavigate(1, interstitial_entry_id, true, url2); + interstitial->TestDidNavigate(1, url2); EXPECT_TRUE(interstitial->is_showing()); EXPECT_EQ(2, controller().GetEntryCount()); @@ -2439,9 +2336,7 @@ TEST_F(WebContentsImplTest, CopyStateFromAndPruneTargetInterstitial) { &deleted); TestInterstitialPageStateGuard state_guard(interstitial); interstitial->Show(); - int interstitial_entry_id = - other_controller.GetTransientEntry()->GetUniqueID(); - interstitial->TestDidNavigate(1, interstitial_entry_id, true, url3); + interstitial->TestDidNavigate(1, url3); EXPECT_TRUE(interstitial->is_showing()); EXPECT_EQ(2, other_controller.GetEntryCount()); @@ -2775,14 +2670,13 @@ TEST_F(WebContentsImplTest, ActiveContentsCountNavigate) { Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = contents->GetController().GetPendingEntry()->GetUniqueID(); if (base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableBrowserSideNavigation)) { contents->GetMainFrame()->PrepareForCommit(); } EXPECT_TRUE(contents->CrossProcessNavigationPending()); EXPECT_EQ(1u, instance->GetRelatedActiveContentsCount()); - contents->GetPendingMainFrame()->SendNavigate(1, entry_id, true, kUrl); + contents->GetPendingMainFrame()->SendNavigate(1, kUrl); EXPECT_EQ(1u, instance->GetRelatedActiveContentsCount()); contents.reset(); @@ -2811,7 +2705,6 @@ TEST_F(WebContentsImplTest, ActiveContentsCountChangeBrowsingInstance) { Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - int entry_id = contents->GetController().GetPendingEntry()->GetUniqueID(); contents->GetMainFrame()->PrepareForCommit(); EXPECT_TRUE(contents->CrossProcessNavigationPending()); scoped_refptr<SiteInstance> instance_webui( @@ -2823,7 +2716,7 @@ TEST_F(WebContentsImplTest, ActiveContentsCountChangeBrowsingInstance) { EXPECT_EQ(0u, instance_webui->GetRelatedActiveContentsCount()); // Commit and contents counts for the new one. - contents->GetPendingMainFrame()->SendNavigate(1, entry_id, true, kWebUIUrl); + contents->GetPendingMainFrame()->SendNavigate(1, kWebUIUrl); EXPECT_EQ(0u, instance->GetRelatedActiveContentsCount()); EXPECT_EQ(1u, instance_webui->GetRelatedActiveContentsCount()); @@ -2879,12 +2772,10 @@ 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->PrepareForCommit(); orig_rfh->OnMessageReceived( FrameHostMsg_DidStartLoading(orig_rfh->GetRoutingID(), false)); - contents()->TestDidNavigate(orig_rfh, 1, entry_id, true, main_url, - ui::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rfh, 1, main_url, ui::PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->CrossProcessNavigationPending()); EXPECT_EQ(orig_rfh, contents()->GetMainFrame()); EXPECT_TRUE(contents()->IsLoading()); @@ -2900,7 +2791,7 @@ TEST_F(WebContentsImplTest, StartStopEventsBalance) { subframe->PrepareForCommit(); subframe->OnMessageReceived( FrameHostMsg_DidStartLoading(subframe->GetRoutingID(), true)); - subframe->SendNavigateWithTransition(1, 0, false, initial_url, + subframe->SendNavigateWithTransition(1, initial_url, ui::PAGE_TRANSITION_AUTO_SUBFRAME); subframe->OnMessageReceived( FrameHostMsg_DidStopLoading(subframe->GetRoutingID())); @@ -2913,8 +2804,8 @@ TEST_F(WebContentsImplTest, StartStopEventsBalance) { subframe->PrepareForCommit(); subframe->OnMessageReceived( FrameHostMsg_DidStartLoading(subframe->GetRoutingID(), true)); - subframe->SendNavigateWithTransition(1, 0, false, foo_url, - ui::PAGE_TRANSITION_AUTO_SUBFRAME); + subframe->SendNavigateWithTransition( + 1, foo_url, ui::PAGE_TRANSITION_AUTO_SUBFRAME); subframe->OnMessageReceived( FrameHostMsg_DidStopLoading(subframe->GetRoutingID())); } @@ -2939,7 +2830,6 @@ 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)); @@ -2947,8 +2837,8 @@ TEST_F(WebContentsImplTest, StartStopEventsBalance) { // Commit the navigation in the child frame and send the DidStopLoading // message. subframe->PrepareForCommit(); - contents()->TestDidNavigate(subframe, 3, entry_id, true, bar_url, - ui::PAGE_TRANSITION_MANUAL_SUBFRAME); + contents()->TestDidNavigate( + subframe, 3, bar_url, ui::PAGE_TRANSITION_MANUAL_SUBFRAME); subframe->OnMessageReceived( FrameHostMsg_DidStopLoading(subframe->GetRoutingID())); } @@ -2984,7 +2874,6 @@ 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()->CrossProcessNavigationPending()); TestRenderFrameHost* pending_rfh = contents()->GetPendingMainFrame(); ASSERT_TRUE(pending_rfh); @@ -3008,7 +2897,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, 0, true, kUrl3); + current_rfh->SendNavigate(1, kUrl3); current_rfh->OnMessageReceived( FrameHostMsg_DidStopLoading(current_rfh->GetRoutingID())); EXPECT_EQ(contents()->GetPendingMainFrame(), pending_rfh); @@ -3016,7 +2905,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, entry_id, true, kUrl2, + contents()->TestDidNavigate(pending_rfh, 1, kUrl2, ui::PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->GetPendingMainFrame()); TestRenderFrameHost* new_current_rfh = contents()->GetMainFrame(); diff --git a/content/common/frame_messages.h b/content/common/frame_messages.h index cd8dfdc..70870ab 100644 --- a/content/common/frame_messages.h +++ b/content/common/frame_messages.h @@ -124,7 +124,6 @@ IPC_STRUCT_END() IPC_STRUCT_TRAITS_BEGIN(content::FrameNavigateParams) IPC_STRUCT_TRAITS_MEMBER(page_id) - IPC_STRUCT_TRAITS_MEMBER(nav_entry_id) IPC_STRUCT_TRAITS_MEMBER(url) IPC_STRUCT_TRAITS_MEMBER(base_url) IPC_STRUCT_TRAITS_MEMBER(referrer) @@ -143,15 +142,6 @@ IPC_STRUCT_BEGIN_WITH_PARENT(FrameHostMsg_DidCommitProvisionalLoad_Params, content::FrameNavigateParams) IPC_STRUCT_TRAITS_PARENT(content::FrameNavigateParams) - // This is the value from the browser indicated whether it intended to make a - // new entry. TODO(avi): Remove this when the pending entry situation is made - // sane and the browser keeps them around long enough to match them via - // nav_entry_id. - IPC_STRUCT_MEMBER(bool, intended_as_new_entry) - - // Whether this commit created a new entry. - IPC_STRUCT_MEMBER(bool, did_create_new_entry) - // Information regarding the security of the connection (empty if the // connection was not secure). IPC_STRUCT_MEMBER(std::string, security_info) @@ -283,8 +273,6 @@ IPC_STRUCT_TRAITS_BEGIN(content::RequestNavigationParams) IPC_STRUCT_TRAITS_MEMBER(request_time) IPC_STRUCT_TRAITS_MEMBER(page_state) IPC_STRUCT_TRAITS_MEMBER(page_id) - IPC_STRUCT_TRAITS_MEMBER(nav_entry_id) - IPC_STRUCT_TRAITS_MEMBER(intended_as_new_entry) IPC_STRUCT_TRAITS_MEMBER(pending_history_list_offset) IPC_STRUCT_TRAITS_MEMBER(current_history_list_offset) IPC_STRUCT_TRAITS_MEMBER(current_history_list_length) diff --git a/content/common/navigation_params.cc b/content/common/navigation_params.cc index 57149de..523a354 100644 --- a/content/common/navigation_params.cc +++ b/content/common/navigation_params.cc @@ -84,8 +84,6 @@ RequestNavigationParams::RequestNavigationParams() can_load_local_resources(false), request_time(base::Time::Now()), page_id(-1), - nav_entry_id(0), - intended_as_new_entry(false), pending_history_list_offset(-1), current_history_list_offset(-1), current_history_list_length(0), @@ -100,8 +98,6 @@ RequestNavigationParams::RequestNavigationParams( base::Time request_time, const PageState& page_state, int32 page_id, - int nav_entry_id, - bool intended_as_new_entry, int pending_history_list_offset, int current_history_list_offset, int current_history_list_length, @@ -113,8 +109,6 @@ RequestNavigationParams::RequestNavigationParams( request_time(request_time), page_state(page_state), page_id(page_id), - nav_entry_id(nav_entry_id), - intended_as_new_entry(intended_as_new_entry), pending_history_list_offset(pending_history_list_offset), current_history_list_offset(current_history_list_offset), current_history_list_length(current_history_list_length), diff --git a/content/common/navigation_params.h b/content/common/navigation_params.h index 90eb70e..cba83c6 100644 --- a/content/common/navigation_params.h +++ b/content/common/navigation_params.h @@ -169,8 +169,6 @@ struct CONTENT_EXPORT RequestNavigationParams { base::Time request_time, const PageState& page_state, int32 page_id, - int nav_entry_id, - bool intended_as_new_entry, int pending_history_list_offset, int current_history_list_offset, int current_history_list_length, @@ -205,18 +203,6 @@ struct CONTENT_EXPORT RequestNavigationParams { // FrameHostMsg_DidCommitProvisionalLoad message. int32 page_id; - // For browser-initiated navigations, this is the unique id of the - // NavigationEntry being navigated to. (For renderer-initiated navigations it - // is 0.) If the load succeeds, then this nav_entry_id will be reflected in - // the resulting FrameHostMsg_DidCommitProvisionalLoad message. - int nav_entry_id; - - // For browser-initiated navigations, this is true if this is a new entry - // being navigated to. This is false otherwise. TODO(avi): Remove this when - // the pending entry situation is made sane and the browser keeps them around - // long enough to match them via nav_entry_id, above. - bool intended_as_new_entry; - // For history navigations, this is the offset in the history list of the // pending load. For non-history navigations, this will be ignored. int pending_history_list_offset; diff --git a/content/public/common/frame_navigate_params.cc b/content/public/common/frame_navigate_params.cc index 1aef9e5..637cec5 100644 --- a/content/public/common/frame_navigate_params.cc +++ b/content/public/common/frame_navigate_params.cc @@ -8,7 +8,6 @@ namespace content { FrameNavigateParams::FrameNavigateParams() : page_id(0), - nav_entry_id(0), transition(ui::PAGE_TRANSITION_LINK), should_update_history(false) { } diff --git a/content/public/common/frame_navigate_params.h b/content/public/common/frame_navigate_params.h index 884a1d1..b704b8e 100644 --- a/content/public/common/frame_navigate_params.h +++ b/content/public/common/frame_navigate_params.h @@ -27,12 +27,6 @@ struct CONTENT_EXPORT FrameNavigateParams { // iframes are loaded automatically. int32 page_id; - // The unique ID of the NavigationEntry for browser-initiated navigations. - // This value was given to the render process in the HistoryNavigationParams - // and is being returned by the renderer without it having any idea what it - // means. If the navigation was renderer-initiated, this value is 0. - int nav_entry_id; - // URL of the page being loaded. GURL url; diff --git a/content/public/test/render_view_test.cc b/content/public/test/render_view_test.cc index 1df34a8..626b887 100644 --- a/content/public/test/render_view_test.cc +++ b/content/public/test/render_view_test.cc @@ -534,7 +534,6 @@ void RenderViewTest::GoToOffset(int offset, const PageState& state) { RequestNavigationParams request_params; request_params.page_state = state; request_params.page_id = impl->page_id_ + offset; - request_params.nav_entry_id = pending_offset + 1; request_params.pending_history_list_offset = pending_offset; request_params.current_history_list_offset = impl->history_list_offset_; request_params.current_history_list_length = history_list_length; diff --git a/content/public/test/test_renderer_host.cc b/content/public/test/test_renderer_host.cc index b233e8a..fea075d 100644 --- a/content/public/test/test_renderer_host.cc +++ b/content/public/test/test_renderer_host.cc @@ -163,19 +163,16 @@ void RenderViewHostTestHarness::Reload() { NavigationEntry* entry = controller().GetLastCommittedEntry(); DCHECK(entry); controller().Reload(false); - RenderFrameHostTester::For(main_rfh()) - ->SendNavigateWithTransition(entry->GetPageID(), entry->GetUniqueID(), - false, entry->GetURL(), - ui::PAGE_TRANSITION_RELOAD); + RenderFrameHostTester::For(main_rfh())->SendNavigateWithTransition( + entry->GetPageID(), entry->GetURL(), ui::PAGE_TRANSITION_RELOAD); } void RenderViewHostTestHarness::FailedReload() { NavigationEntry* entry = controller().GetLastCommittedEntry(); DCHECK(entry); controller().Reload(false); - RenderFrameHostTester::For(main_rfh()) - ->SendFailedNavigate(entry->GetPageID(), entry->GetUniqueID(), false, - entry->GetURL()); + RenderFrameHostTester::For(main_rfh())->SendFailedNavigate(entry->GetPageID(), + entry->GetURL()); } void RenderViewHostTestHarness::SetUp() { diff --git a/content/public/test/test_renderer_host.h b/content/public/test/test_renderer_host.h index 001a48e..e4eb93d 100644 --- a/content/public/test/test_renderer_host.h +++ b/content/public/test/test_renderer_host.h @@ -71,27 +71,17 @@ class RenderFrameHostTester { virtual RenderFrameHost* AppendChild(const std::string& frame_name) = 0; // Calls OnDidCommitProvisionalLoad on the RenderFrameHost with the given - // information with various sets of parameters. These are helper functions for - // simulating the most common types of loads. - // - // Guidance for calling these: - // - nav_entry_id should be 0 if simulating a renderer-initiated navigation; - // if simulating a browser-initiated one, pass the GetUniqueID() value of - // the NavigationController's PendingEntry. - // - did_create_new_entry should be true if simulating a navigation that - // created a new navigation entry; false for history navigations, reloads, - // and other navigations that don't affect the history list. - virtual void SendNavigate(int page_id, - int nav_entry_id, - bool did_create_new_entry, - const GURL& url) = 0; - virtual void SendFailedNavigate(int page_id, - int nav_entry_id, - bool did_create_new_entry, - const GURL& url) = 0; + // information. Sets the rest of the parameters in the message to the + // "typical" values. This is a helper function for simulating the most common + // types of loads. + virtual void SendNavigate(int page_id, const GURL& url) = 0; + virtual void SendFailedNavigate(int page_id, const GURL& url) = 0; + + // Calls OnDidCommitProvisionalLoad on the RenderFrameHost with the given + // information, including a custom PageTransition. Sets the rest of the + // parameters in the message to the "typical" values. This is a helper + // function for simulating the most common types of loads. virtual void SendNavigateWithTransition(int page_id, - int nav_entry_id, - bool did_create_new_entry, const GURL& url, ui::PageTransition transition) = 0; diff --git a/content/public/test/web_contents_tester.h b/content/public/test/web_contents_tester.h index 77ef2cc..a96d86d 100644 --- a/content/public/test/web_contents_tester.h +++ b/content/public/test/web_contents_tester.h @@ -78,28 +78,17 @@ class WebContentsTester { // Does nothing if no cross-navigation is pending. virtual void ProceedWithCrossSiteNavigation() = 0; - // Simulates a navigation with the given information. - // - // Guidance for calling these: - // - nav_entry_id should be 0 if simulating a renderer-initiated navigation; - // if simulating a browser-initiated one, pass the GetUniqueID() value of - // the NavigationController's PendingEntry. - // - did_create_new_entry should be true if simulating a navigation that - // created a new navigation entry; false for history navigations, reloads, - // and other navigations that don't affect the history list. virtual void TestDidNavigate(RenderFrameHost* render_frame_host, int page_id, - int nav_entry_id, - bool did_create_new_entry, const GURL& url, ui::PageTransition transition) = 0; - virtual void TestDidNavigateWithReferrer(RenderFrameHost* render_frame_host, - int page_id, - int nav_entry_id, - bool did_create_new_entry, - const GURL& url, - const Referrer& referrer, - ui::PageTransition transition) = 0; + + virtual void TestDidNavigateWithReferrer( + RenderFrameHost* render_frame_host, + int page_id, + const GURL& url, + const Referrer& referrer, + ui::PageTransition transition) = 0; }; } // namespace content diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index dfa09aa..decaf5e 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -1119,10 +1119,6 @@ void RenderFrameImpl::OnNavigate( } else if (is_history_navigation) { // We must know the page ID of the page we are navigating back to. DCHECK_NE(request_params.page_id, -1); - // We must know the nav entry ID of the page we are navigating back to, - // which should be the case because history navigations are routed via the - // browser. - DCHECK_NE(0, request_params.nav_entry_id); scoped_ptr<HistoryEntry> entry = PageStateToHistoryEntry(request_params.page_state); if (entry) { @@ -2587,10 +2583,6 @@ void RenderFrameImpl::didFailProvisionalLoad( const WebURLRequest& failed_request = ds->request(); - DocumentState* document_state = DocumentState::FromDataSource(ds); - NavigationStateImpl* navigation_state = - static_cast<NavigationStateImpl*>(document_state->navigation_state()); - // Notify the browser that we failed a provisional load with an error. // // Note: It is important this notification occur before DidStopLoading so the @@ -2610,6 +2602,10 @@ void RenderFrameImpl::didFailProvisionalLoad( // Make sure we never show errors in view source mode. frame->enableViewSourceMode(false); + DocumentState* document_state = DocumentState::FromDataSource(ds); + NavigationStateImpl* navigation_state = + static_cast<NavigationStateImpl*>(document_state->navigation_state()); + // If this is a failed back/forward/reload navigation, then we need to do a // 'replace' load. This is necessary to avoid messing up session history. // Otherwise, we do a normal load, which simulates a 'go' navigation as far @@ -2696,7 +2692,18 @@ void RenderFrameImpl::didCommitProvisionalLoad( render_view_->history_list_offset_ + 1; } } else { - if (navigation_state->request_params().page_id != -1) { + // Inspect the navigation_state on this frame to see if the navigation + // corresponds to a session history navigation... Note: |frame| may or + // may not be the toplevel frame, but for the case of capturing session + // history, the first committed frame suffices. We keep track of whether + // we've seen this commit before so that only capture session history once + // per navigation. + // + // Note that we need to check if the page ID changed. In the case of a + // reload, the page ID doesn't change, and UpdateSessionHistory gets the + // previous URL and the current page ID, which would be wrong. + if (navigation_state->request_params().page_id != -1 && + navigation_state->request_params().page_id != render_view_->page_id_) { // This is a successful session history navigation! render_view_->page_id_ = navigation_state->request_params().page_id; @@ -3854,12 +3861,8 @@ void RenderFrameImpl::SendDidCommitProvisionalLoad( params.http_status_code = response.httpStatusCode(); params.url_is_unreachable = ds->hasUnreachableURL(); params.is_post = false; - params.intended_as_new_entry = - navigation_state->request_params().intended_as_new_entry; - params.did_create_new_entry = commit_type == blink::WebStandardCommit; params.post_id = -1; params.page_id = render_view_->page_id_; - params.nav_entry_id = navigation_state->request_params().nav_entry_id; // We need to track the RenderViewHost routing_id because of downstream // dependencies (crbug.com/392171 DownloadRequestHandle, SaveFileManager, // ResourceDispatcherHostImpl, MediaStreamUIProxy, diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc index 13d0952..38e8ca7 100644 --- a/content/renderer/render_view_browsertest.cc +++ b/content/renderer/render_view_browsertest.cc @@ -716,7 +716,6 @@ TEST_F(RenderViewImplTest, ReloadWhileSwappedOut) { request_params_A.current_history_list_offset = 1; request_params_A.pending_history_list_offset = 0; request_params_A.page_id = 1; - request_params_A.nav_entry_id = 1; request_params_A.page_state = state_A; NavigateMainFrame(common_params_A, StartNavigationParams(), request_params_A); EXPECT_EQ(1, view()->historyBackListCount()); @@ -746,7 +745,6 @@ TEST_F(RenderViewImplTest, ReloadWhileSwappedOut) { request_params.current_history_list_offset = 0; request_params.pending_history_list_offset = 0; request_params.page_id = 1; - request_params.nav_entry_id = 1; request_params.page_state = state_A; NavigateMainFrame(common_params, StartNavigationParams(), request_params); ProcessPendingMessages(); @@ -917,12 +915,12 @@ TEST_F(RenderViewImplTest, DISABLED_LastCommittedUpdateState) { // ignored. See http://crbug.com/86758. TEST_F(RenderViewImplTest, StaleNavigationsIgnored) { // Load page A. - LoadHTML("<div id=pagename>Page A</div>"); + LoadHTML("<div>Page A</div>"); EXPECT_EQ(1, view()->history_list_length_); EXPECT_EQ(0, view()->history_list_offset_); // Load page B, which will trigger an UpdateState message for page A. - LoadHTML("<div id=pagename>Page B</div>"); + LoadHTML("<div>Page B</div>"); EXPECT_EQ(2, view()->history_list_length_); EXPECT_EQ(1, view()->history_list_offset_); @@ -938,7 +936,7 @@ TEST_F(RenderViewImplTest, StaleNavigationsIgnored) { EXPECT_EQ(1, page_id_A); render_thread_->sink().ClearMessages(); - // Back to page A (nav_entry_id 1) and commit. + // Back to page A (page_id 1) and commit. CommonNavigationParams common_params_A; RequestNavigationParams request_params_A; common_params_A.navigation_type = FrameMsg_Navigate_Type::NORMAL; @@ -947,21 +945,15 @@ TEST_F(RenderViewImplTest, StaleNavigationsIgnored) { request_params_A.current_history_list_offset = 1; request_params_A.pending_history_list_offset = 0; request_params_A.page_id = 1; - request_params_A.nav_entry_id = 1; request_params_A.page_state = state_A; NavigateMainFrame(common_params_A, StartNavigationParams(), request_params_A); ProcessPendingMessages(); // A new navigation commits, clearing the forward history. - LoadHTML("<div id=pagename>Page C</div>"); + LoadHTML("<div>Page C</div>"); EXPECT_EQ(2, view()->history_list_length_); EXPECT_EQ(1, view()->history_list_offset_); EXPECT_EQ(3, view()->page_id_); // page C is now page id 3 - int was_page_c = -1; - base::string16 check_page_c = base::ASCIIToUTF16( - "Number(document.getElementById('pagename').innerHTML == 'Page C')"); - EXPECT_TRUE(ExecuteJavaScriptAndReturnIntValue(check_page_c, &was_page_c)); - EXPECT_EQ(1, was_page_c); // The browser then sends a stale navigation to B, which should be ignored. CommonNavigationParams common_params_B; @@ -972,7 +964,6 @@ TEST_F(RenderViewImplTest, StaleNavigationsIgnored) { request_params_B.current_history_list_offset = 0; request_params_B.pending_history_list_offset = 1; request_params_B.page_id = 2; - request_params_B.nav_entry_id = 2; request_params_B.page_state = state_A; // Doesn't matter, just has to be present. NavigateMainFrame(common_params_B, StartNavigationParams(), request_params_B); @@ -981,9 +972,6 @@ TEST_F(RenderViewImplTest, StaleNavigationsIgnored) { EXPECT_EQ(2, view()->history_list_length_); EXPECT_EQ(1, view()->history_list_offset_); EXPECT_EQ(3, view()->page_id_); // page C, not page B - was_page_c = -1; - EXPECT_TRUE(ExecuteJavaScriptAndReturnIntValue(check_page_c, &was_page_c)); - EXPECT_EQ(1, was_page_c); // Check for a valid DidDropNavigation message. ProcessPendingMessages(); diff --git a/content/test/test_render_frame_host.cc b/content/test/test_render_frame_host.cc index 838c423..bc54c3c 100644 --- a/content/test/test_render_frame_host.cc +++ b/content/test/test_render_frame_host.cc @@ -79,6 +79,13 @@ TestRenderFrameHost* TestRenderFrameHost::AppendChild( child_creation_observer_.last_created_frame()); } +void TestRenderFrameHost::SendNavigateWithTransition( + int page_id, + const GURL& url, + ui::PageTransition transition) { + SendNavigateWithTransitionAndResponseCode(page_id, url, transition, 200); +} + void TestRenderFrameHost::SetContentsMimeType(const std::string& mime_type) { contents_mime_type_ = mime_type; } @@ -92,39 +99,18 @@ void TestRenderFrameHost::SimulateSwapOutACK() { OnSwappedOut(); } -void TestRenderFrameHost::SendNavigate(int page_id, - int nav_entry_id, - bool did_create_new_entry, - const GURL& url) { - SendNavigateWithTransition(page_id, nav_entry_id, did_create_new_entry, url, - ui::PAGE_TRANSITION_LINK); -} - -void TestRenderFrameHost::SendFailedNavigate(int page_id, - int nav_entry_id, - bool did_create_new_entry, - const GURL& url) { - SendNavigateWithTransitionAndResponseCode(page_id, nav_entry_id, - did_create_new_entry, url, - ui::PAGE_TRANSITION_RELOAD, 500); +void TestRenderFrameHost::SendNavigate(int page_id, const GURL& url) { + SendNavigateWithTransition(page_id, url, ui::PAGE_TRANSITION_LINK); } -void TestRenderFrameHost::SendNavigateWithTransition( - int page_id, - int nav_entry_id, - bool did_create_new_entry, - const GURL& url, - ui::PageTransition transition) { +void TestRenderFrameHost::SendFailedNavigate(int page_id, const GURL& url) { SendNavigateWithTransitionAndResponseCode( - page_id, nav_entry_id, did_create_new_entry, url, transition, 200); + page_id, url, ui::PAGE_TRANSITION_RELOAD, 500); } void TestRenderFrameHost::SendNavigateWithTransitionAndResponseCode( int page_id, - int nav_entry_id, - bool did_create_new_entry, - const GURL& url, - ui::PageTransition transition, + const GURL& url, ui::PageTransition transition, int response_code) { // DidStartProvisionalLoad may delete the pending entry that holds |url|, // so we keep a copy of it to use in SendNavigateWithParameters. @@ -135,15 +121,12 @@ void TestRenderFrameHost::SendNavigateWithTransitionAndResponseCode( SetRenderFrameCreated(true); OnDidStartProvisionalLoadForFrame(url_copy, false); - SendNavigateWithParameters(page_id, nav_entry_id, did_create_new_entry, - url_copy, transition, url_copy, response_code, 0, - std::vector<GURL>()); + SendNavigateWithParameters(page_id, url_copy, transition, url_copy, + response_code, 0, std::vector<GURL>()); } void TestRenderFrameHost::SendNavigateWithOriginalRequestURL( int page_id, - int nav_entry_id, - bool did_create_new_entry, const GURL& url, const GURL& original_request_url) { // Ensure that the RenderFrameCreated notification has been sent to observers @@ -151,20 +134,16 @@ void TestRenderFrameHost::SendNavigateWithOriginalRequestURL( SetRenderFrameCreated(true); OnDidStartProvisionalLoadForFrame(url, false); - SendNavigateWithParameters(page_id, nav_entry_id, did_create_new_entry, url, - ui::PAGE_TRANSITION_LINK, original_request_url, - 200, 0, std::vector<GURL>()); + SendNavigateWithParameters(page_id, url, ui::PAGE_TRANSITION_LINK, + original_request_url, 200, 0, std::vector<GURL>()); } void TestRenderFrameHost::SendNavigateWithFile( int page_id, - int nav_entry_id, - bool did_create_new_entry, const GURL& url, const base::FilePath& file_path) { - SendNavigateWithParameters(page_id, nav_entry_id, did_create_new_entry, url, - ui::PAGE_TRANSITION_LINK, url, 200, &file_path, - std::vector<GURL>()); + SendNavigateWithParameters(page_id, url, ui::PAGE_TRANSITION_LINK, url, 200, + &file_path, std::vector<GURL>()); } void TestRenderFrameHost::SendNavigateWithParams( @@ -175,18 +154,14 @@ void TestRenderFrameHost::SendNavigateWithParams( void TestRenderFrameHost::SendNavigateWithRedirects( int page_id, - int nav_entry_id, - bool did_create_new_entry, const GURL& url, const std::vector<GURL>& redirects) { - SendNavigateWithParameters(page_id, nav_entry_id, did_create_new_entry, url, - ui::PAGE_TRANSITION_LINK, url, 200, 0, redirects); + SendNavigateWithParameters( + page_id, url, ui::PAGE_TRANSITION_LINK, url, 200, 0, redirects); } void TestRenderFrameHost::SendNavigateWithParameters( int page_id, - int nav_entry_id, - bool did_create_new_entry, const GURL& url, ui::PageTransition transition, const GURL& original_request_url, @@ -195,7 +170,6 @@ void TestRenderFrameHost::SendNavigateWithParameters( const std::vector<GURL>& redirects) { FrameHostMsg_DidCommitProvisionalLoad_Params params; params.page_id = page_id; - params.nav_entry_id = nav_entry_id; params.url = url; params.referrer = Referrer(); params.transition = transition; @@ -203,7 +177,6 @@ void TestRenderFrameHost::SendNavigateWithParameters( params.should_update_history = true; params.searchable_form_url = GURL(); params.searchable_form_encoding = std::string(); - params.did_create_new_entry = did_create_new_entry; params.security_info = std::string(); params.gesture = NavigationGestureUser; params.contents_mime_type = contents_mime_type_; @@ -231,13 +204,11 @@ void TestRenderFrameHost::SendNavigateWithParameters( OnDidCommitProvisionalLoad(msg); } -void TestRenderFrameHost::NavigateAndCommitRendererInitiated( - int page_id, - bool did_create_new_entry, - const GURL& url) { +void TestRenderFrameHost::NavigateAndCommitRendererInitiated(int page_id, + const GURL& url) { SendRendererInitiatedNavigationRequest(url, false); PrepareForCommit(); - SendNavigate(page_id, 0, did_create_new_entry, url); + SendNavigate(page_id, url); } void TestRenderFrameHost::SendRendererInitiatedNavigationRequest( diff --git a/content/test/test_render_frame_host.h b/content/test/test_render_frame_host.h index 3b0c9ae..798479f 100644 --- a/content/test/test_render_frame_host.h +++ b/content/test/test_render_frame_host.h @@ -52,50 +52,35 @@ class TestRenderFrameHost : public RenderFrameHostImpl, // RenderFrameHostTester implementation. TestRenderFrameHost* AppendChild(const std::string& frame_name) override; - void SendNavigate(int page_id, - int nav_entry_id, - bool did_create_new_entry, - const GURL& url) override; - void SendFailedNavigate(int page_id, - int nav_entry_id, - bool did_create_new_entry, - const GURL& url) override; + void SendNavigate(int page_id, const GURL& url) override; + void SendFailedNavigate(int page_id, const GURL& url) override; void SendNavigateWithTransition(int page_id, - int nav_entry_id, - bool did_create_new_entry, const GURL& url, ui::PageTransition transition) override; void SetContentsMimeType(const std::string& mime_type) override; void SendBeforeUnloadACK(bool proceed) override; void SimulateSwapOutACK() override; - void SendNavigateWithTransitionAndResponseCode(int page_id, - int nav_entry_id, - bool did_create_new_entry, - const GURL& url, - ui::PageTransition transition, - int response_code); - void SendNavigateWithOriginalRequestURL(int page_id, - int nav_entry_id, - bool did_create_new_entry, - const GURL& url, - const GURL& original_request_url); - void SendNavigateWithFile(int page_id, - int nav_entry_id, - bool did_create_new_entry, - const GURL& url, - const base::FilePath& file_path); + void SendNavigateWithTransitionAndResponseCode( + int page_id, + const GURL& url, ui::PageTransition transition, + int response_code); + void SendNavigateWithOriginalRequestURL( + int page_id, + const GURL& url, + const GURL& original_request_url); + void SendNavigateWithFile( + int page_id, + const GURL& url, + const base::FilePath& file_path); void SendNavigateWithParams( FrameHostMsg_DidCommitProvisionalLoad_Params* params); - void SendNavigateWithRedirects(int page_id, - int nav_entry_id, - bool did_create_new_entry, - const GURL& url, - const std::vector<GURL>& redirects); + void SendNavigateWithRedirects( + int page_id, + const GURL& url, + const std::vector<GURL>& redirects); void SendNavigateWithParameters( int page_id, - int nav_entry_id, - bool did_create_new_entry, const GURL& url, ui::PageTransition transition, const GURL& original_request_url, @@ -104,9 +89,7 @@ class TestRenderFrameHost : public RenderFrameHostImpl, const std::vector<GURL>& redirects); // Simulate a renderer-initiated navigation up until commit. - void NavigateAndCommitRendererInitiated(int page_id, - bool did_create_new_entry, - const GURL& url); + void NavigateAndCommitRendererInitiated(int page_id, const GURL& url); // With the current navigation logic this method is a no-op. // PlzNavigate: this method simulates receiving a BeginNavigation IPC. diff --git a/content/test/test_render_view_host.cc b/content/test/test_render_view_host.cc index bedb4b8..b6f7a86 100644 --- a/content/test/test_render_view_host.cc +++ b/content/test/test_render_view_host.cc @@ -28,12 +28,9 @@ namespace content { void InitNavigateParams(FrameHostMsg_DidCommitProvisionalLoad_Params* params, int page_id, - int nav_entry_id, - bool did_create_new_entry, const GURL& url, ui::PageTransition transition) { params->page_id = page_id; - params->nav_entry_id = nav_entry_id; params->url = url; params->referrer = Referrer(); params->transition = transition; @@ -41,7 +38,6 @@ void InitNavigateParams(FrameHostMsg_DidCommitProvisionalLoad_Params* params, params->should_update_history = false; params->searchable_form_url = GURL(); params->searchable_form_encoding = std::string(); - params->did_create_new_entry = did_create_new_entry; params->security_info = std::string(); params->gesture = NavigationGestureUser; params->was_within_same_page = false; diff --git a/content/test/test_render_view_host.h b/content/test/test_render_view_host.h index 13bc0fb..ad4ca65 100644 --- a/content/test/test_render_view_host.h +++ b/content/test/test_render_view_host.h @@ -40,12 +40,10 @@ class SiteInstance; class TestRenderFrameHost; class TestWebContents; -// Utility function to initialize FrameHostMsg_DidCommitProvisionalLoad_Params -// with given parameters. +// Utility function to initialize ViewHostMsg_NavigateParams_Params +// with given |page_id|, |url| and |transition_type|. void InitNavigateParams(FrameHostMsg_DidCommitProvisionalLoad_Params* params, int page_id, - int nav_entry_id, - bool did_create_new_entry, const GURL& url, ui::PageTransition transition_type); diff --git a/content/test/test_web_contents.cc b/content/test/test_web_contents.cc index 28c3980..9032fc4 100644 --- a/content/test/test_web_contents.cc +++ b/content/test/test_web_contents.cc @@ -67,14 +67,10 @@ TestRenderFrameHost* TestWebContents::GetPendingMainFrame() const { void TestWebContents::TestDidNavigate(RenderFrameHost* render_frame_host, int page_id, - int nav_entry_id, - bool did_create_new_entry, const GURL& url, ui::PageTransition transition) { TestDidNavigateWithReferrer(render_frame_host, page_id, - nav_entry_id, - did_create_new_entry, url, Referrer(), transition); @@ -83,15 +79,12 @@ void TestWebContents::TestDidNavigate(RenderFrameHost* render_frame_host, void TestWebContents::TestDidNavigateWithReferrer( RenderFrameHost* render_frame_host, int page_id, - int nav_entry_id, - bool did_create_new_entry, const GURL& url, const Referrer& referrer, ui::PageTransition transition) { FrameHostMsg_DidCommitProvisionalLoad_Params params; params.page_id = page_id; - params.nav_entry_id = nav_entry_id; params.url = url; params.referrer = referrer; params.transition = transition; @@ -99,7 +92,6 @@ void TestWebContents::TestDidNavigateWithReferrer( params.should_update_history = false; params.searchable_form_url = GURL(); params.searchable_form_encoding = std::string(); - params.did_create_new_entry = did_create_new_entry; params.security_info = std::string(); params.gesture = NavigationGestureUser; params.was_within_same_page = false; @@ -190,9 +182,7 @@ void TestWebContents::CommitPendingNavigation() { page_id = GetMaxPageIDForSiteInstance(rfh->GetSiteInstance()) + 1; } - rfh->SendNavigate(page_id, entry->GetUniqueID(), - GetController().GetPendingEntryIndex() == -1, - entry->GetURL()); + rfh->SendNavigate(page_id, entry->GetURL()); // Simulate the SwapOut_ACK. This is needed when cross-site navigation // happens. if (old_rfh != rfh) diff --git a/content/test/test_web_contents.h b/content/test/test_web_contents.h index 632d57f..66bef97 100644 --- a/content/test/test_web_contents.h +++ b/content/test/test_web_contents.h @@ -40,14 +40,10 @@ class TestWebContents : public WebContentsImpl, public WebContentsTester { void ProceedWithCrossSiteNavigation() override; void TestDidNavigate(RenderFrameHost* render_frame_host, int page_id, - int nav_entry_id, - bool did_create_new_entry, const GURL& url, ui::PageTransition transition) override; void TestDidNavigateWithReferrer(RenderFrameHost* render_frame_host, int page_id, - int nav_entry_id, - bool did_create_new_entry, const GURL& url, const Referrer& referrer, ui::PageTransition transition) override; |