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 --- chrome/browser/ui/browser_browsertest.cc | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'chrome/browser/ui/browser_browsertest.cc') diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index 10ebfc0..387bdf4 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -1066,6 +1066,35 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, StartMinimized) { } } +// Makes sure the forward button is disabled immediately when navigating +// forward to a slow-to-commit page. +IN_PROC_BROWSER_TEST_F(BrowserTest, ForwardDisabledOnForward) { + GURL blank_url(chrome::kAboutBlankURL); + ui_test_utils::NavigateToURL(browser(), blank_url); + + ui_test_utils::NavigateToURL(browser(), + ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), + FilePath(kTitle1File))); + + ui_test_utils::WindowedNotificationObserver back_nav_load_observer( + content::NOTIFICATION_LOAD_STOP, + Source( + &browser()->GetSelectedTabContents()->controller())); + browser()->GoBack(CURRENT_TAB); + back_nav_load_observer.Wait(); + EXPECT_TRUE(browser()->command_updater()->IsCommandEnabled(IDC_FORWARD)); + + ui_test_utils::WindowedNotificationObserver forward_nav_load_observer( + content::NOTIFICATION_LOAD_STOP, + Source( + &browser()->GetSelectedTabContents()->controller())); + browser()->GoForward(CURRENT_TAB); + // This check will happen before the navigation completes, since the browser + // won't process the renderer's response until the Wait() call below. + EXPECT_FALSE(browser()->command_updater()->IsCommandEnabled(IDC_FORWARD)); + forward_nav_load_observer.Wait(); +} + // TODO(ben): this test was never enabled. It has bit-rotted since being added. // It originally lived in browser_unittest.cc, but has been moved here to make // room for real browser unit tests. -- cgit v1.1