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

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

Issue 10316020: Remove WebContentsImpl::OnDidRedirectProvisionalLoad. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Listen for RESOURCE_RECEIVED_REDIRET in PrerenderTabHelper Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/navigation_controller_impl_unittest.cc
diff --git a/content/browser/web_contents/navigation_controller_impl_unittest.cc b/content/browser/web_contents/navigation_controller_impl_unittest.cc
index b0b09a544e0d0def241b14566f98b45cf20755cb..c7a2181ced958c5740e36affd508ed4402fdd219 100644
--- a/content/browser/web_contents/navigation_controller_impl_unittest.cc
+++ b/content/browser/web_contents/navigation_controller_impl_unittest.cc
@@ -490,68 +490,6 @@ TEST_F(NavigationControllerTest, LoadURL_AbortCancelsPending) {
contents()->SetDelegate(NULL);
}
-// Tests that the pending entry state is correct after a redirect and abort.
-// http://crbug.com/83031.
-TEST_F(NavigationControllerTest, LoadURL_RedirectAbortCancelsPending) {
- NavigationControllerImpl& controller = controller_impl();
- TestNotificationTracker notifications;
- RegisterForAllNavNotifications(&notifications, &controller);
-
- // Set a WebContentsDelegate to listen for state changes.
- scoped_ptr<TestWebContentsDelegate> delegate(new TestWebContentsDelegate());
- EXPECT_FALSE(contents()->GetDelegate());
- contents()->SetDelegate(delegate.get());
-
- // Without any navigations, the renderer starts at about:blank.
- const GURL kExistingURL("about:blank");
-
- // Now make a pending new navigation.
- const GURL kNewURL("http://eh");
- controller.LoadURL(
- kNewURL, content::Referrer(), content::PAGE_TRANSITION_TYPED,
- std::string());
- EXPECT_EQ(0U, notifications.size());
- EXPECT_EQ(-1, controller.GetPendingEntryIndex());
- EXPECT_TRUE(controller.GetPendingEntry());
- EXPECT_EQ(-1, controller.GetLastCommittedEntryIndex());
- EXPECT_EQ(1, delegate->navigation_state_change_count());
-
- // Now the navigation redirects.
- const GURL kRedirectURL("http://bee");
- test_rvh()->OnMessageReceived(
- ViewHostMsg_DidRedirectProvisionalLoad(0, // routing_id
- -1, // pending page_id
- GURL(), // opener
- kNewURL, // old url
- kRedirectURL)); // new url
-
- // We don't want to change the NavigationEntry's url, in case it cancels.
- // Prevents regression of http://crbug.com/77786.
- EXPECT_EQ(kNewURL, controller.GetPendingEntry()->GetURL());
-
- // It may abort before committing, if it's a download or due to a stop or
- // a new navigation from the user.
- ViewHostMsg_DidFailProvisionalLoadWithError_Params params;
- params.frame_id = 1;
- params.is_main_frame = true;
- params.error_code = net::ERR_ABORTED;
- params.error_description = string16();
- params.url = kRedirectURL;
- params.showing_repost_interstitial = false;
- test_rvh()->OnMessageReceived(
- ViewHostMsg_DidFailProvisionalLoadWithError(0, // routing_id
- params));
-
- // This should clear the pending entry and notify of a navigation state
- // change, so that we do not keep displaying kNewURL.
- EXPECT_EQ(-1, controller.GetPendingEntryIndex());
- EXPECT_FALSE(controller.GetPendingEntry());
- EXPECT_EQ(-1, controller.GetLastCommittedEntryIndex());
- EXPECT_EQ(2, delegate->navigation_state_change_count());
-
- contents()->SetDelegate(NULL);
-}
-
TEST_F(NavigationControllerTest, Reload) {
NavigationControllerImpl& controller = controller_impl();
TestNotificationTracker notifications;

Powered by Google App Engine
This is Rietveld 408576698