From 83c2e233067108fb212ba4082ee02a9bff90d98d Mon Sep 17 00:00:00 2001 From: "creis@chromium.org" Date: Fri, 7 Oct 2011 21:36:46 +0000 Subject: Fix UI quirks when doing a history navigation to a slow page. This fixes two related issues: 1) The forward button is not immediately disabled when going forward to a slow page, even though the user cannot go forward any more. 2) When cancelling a history navigation to a slow page by performing another history navigation, the throbber remains stuck indicating a load in progress. Also included are tests for each of these issues. Patch from Karl Koscher BUG=94747 TEST=Go forward to slow URL, then back. Review URL: http://codereview.chromium.org/8136024 Patch from Karl Koscher . git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104571 0039d316-1c4b-4281-b951-d872f2087c98 --- .../tab_contents/navigation_controller_unittest.cc | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'content/browser/tab_contents/navigation_controller_unittest.cc') diff --git a/content/browser/tab_contents/navigation_controller_unittest.cc b/content/browser/tab_contents/navigation_controller_unittest.cc index 39b6603..f856cbe 100644 --- a/content/browser/tab_contents/navigation_controller_unittest.cc +++ b/content/browser/tab_contents/navigation_controller_unittest.cc @@ -2114,6 +2114,30 @@ TEST_F(NavigationControllerTest, PruneAllButActiveForTransient) { EXPECT_EQ(controller().GetTransientEntry()->url(), transient_url); } +// Test to ensure that when we do a history navigation back to the current +// committed page (e.g., going forward to a slow-loading page, then pressing +// the back button), we just stop the navigation to prevent the throbber from +// running continuously. Otherwise, the RenderViewHost forces the throbber to +// start, but WebKit essentially ignores the navigation and never sends a +// message to stop the throbber. +TEST_F(NavigationControllerTest, StopOnHistoryNavigationToCurrentPage) { + const GURL url0("http://foo/0"); + const GURL url1("http://foo/1"); + + NavigateAndCommit(url0); + NavigateAndCommit(url1); + + // Go back to the original page, then forward to the slow page, then back + controller().GoBack(); + contents()->CommitPendingNavigation(); + + controller().GoForward(); + EXPECT_EQ(1, controller().pending_entry_index()); + + controller().GoBack(); + EXPECT_EQ(-1, controller().pending_entry_index()); +} + /* TODO(brettw) These test pass on my local machine but fail on the XP buildbot (but not Vista) cleaning up the directory after they run. This should be fixed. -- cgit v1.1