From a3f343f6ac8b64af57859042089577f5c1752c96 Mon Sep 17 00:00:00 2001 From: "isherman@chromium.org" Date: Wed, 6 Oct 2010 23:39:42 +0000 Subject: Rehabilitate BrowserFocusTest.TabInitialFocus BUG=50763 TEST=interactive_ui_tests --gtest_filter=BrowserFocusTest.TabInitialFocus Review URL: http://codereview.chromium.org/3561013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61735 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/browser_focus_uitest.cc | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'chrome/browser/browser_focus_uitest.cc') diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc index 4558c90..ea679674 100644 --- a/chrome/browser/browser_focus_uitest.cc +++ b/chrome/browser/browser_focus_uitest.cc @@ -705,27 +705,33 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FindFocusTest) { // Makes sure the focus is in the right location when opening the different // types of tabs. -// Flaky, http://crbug.com/50763. -IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FLAKY_TabInitialFocus) { +IN_PROC_BROWSER_TEST_F(BrowserFocusTest, TabInitialFocus) { ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); // Open the history tab, focus should be on the tab contents. browser()->ShowHistoryTab(); - ui_test_utils::RunAllPendingInMessageLoop(); - ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); + ASSERT_NO_FATAL_FAILURE(ui_test_utils::WaitForLoadStop( + &browser()->GetSelectedTabContents()->controller())); + EXPECT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); // Open the new tab, focus should be on the location bar. browser()->NewTab(); - ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); + ASSERT_NO_FATAL_FAILURE(ui_test_utils::WaitForLoadStop( + &browser()->GetSelectedTabContents()->controller())); + EXPECT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); // Open the download tab, focus should be on the tab contents. browser()->ShowDownloadsTab(); - ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); + ASSERT_NO_FATAL_FAILURE(ui_test_utils::WaitForLoadStop( + &browser()->GetSelectedTabContents()->controller())); + EXPECT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); // Open about:blank, focus should be on the location bar. browser()->AddSelectedTabWithURL(GURL(chrome::kAboutBlankURL), PageTransition::LINK); - ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); + ASSERT_NO_FATAL_FAILURE(ui_test_utils::WaitForLoadStop( + &browser()->GetSelectedTabContents()->controller())); + EXPECT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); } // Tests that focus goes where expected when using reload. -- cgit v1.1