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

Side by Side Diff: chrome/browser/browser_focus_uitest.cc

Issue 10823029: Move WaitForLoadStop from ui_test_utils to browser_test_utils so that it can be reused in content_b… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 } 834 }
835 835
836 // Makes sure the focus is in the right location when opening the different 836 // Makes sure the focus is in the right location when opening the different
837 // types of tabs. 837 // types of tabs.
838 // Flaky, http://crbug.com/62539. 838 // Flaky, http://crbug.com/62539.
839 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_TabInitialFocus) { 839 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_TabInitialFocus) {
840 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 840 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
841 841
842 // Open the history tab, focus should be on the tab contents. 842 // Open the history tab, focus should be on the tab contents.
843 chrome::ShowHistory(browser()); 843 chrome::ShowHistory(browser());
844 ASSERT_NO_FATAL_FAILURE(ui_test_utils::WaitForLoadStop( 844 ASSERT_NO_FATAL_FAILURE(content::WaitForLoadStop(
845 chrome::GetActiveWebContents(browser()))); 845 chrome::GetActiveWebContents(browser())));
846 EXPECT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); 846 EXPECT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
847 847
848 // Open the new tab, focus should be on the location bar. 848 // Open the new tab, focus should be on the location bar.
849 chrome::NewTab(browser()); 849 chrome::NewTab(browser());
850 ASSERT_NO_FATAL_FAILURE(ui_test_utils::WaitForLoadStop( 850 ASSERT_NO_FATAL_FAILURE(content::WaitForLoadStop(
851 chrome::GetActiveWebContents(browser()))); 851 chrome::GetActiveWebContents(browser())));
852 EXPECT_TRUE(IsViewFocused(location_bar_focus_view_id_)); 852 EXPECT_TRUE(IsViewFocused(location_bar_focus_view_id_));
853 853
854 // Open the download tab, focus should be on the tab contents. 854 // Open the download tab, focus should be on the tab contents.
855 chrome::ShowDownloads(browser()); 855 chrome::ShowDownloads(browser());
856 ASSERT_NO_FATAL_FAILURE(ui_test_utils::WaitForLoadStop( 856 ASSERT_NO_FATAL_FAILURE(content::WaitForLoadStop(
857 chrome::GetActiveWebContents(browser()))); 857 chrome::GetActiveWebContents(browser())));
858 EXPECT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); 858 EXPECT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
859 859
860 // Open about:blank, focus should be on the location bar. 860 // Open about:blank, focus should be on the location bar.
861 chrome::AddSelectedTabWithURL(browser(), GURL(chrome::kAboutBlankURL), 861 chrome::AddSelectedTabWithURL(browser(), GURL(chrome::kAboutBlankURL),
862 content::PAGE_TRANSITION_LINK); 862 content::PAGE_TRANSITION_LINK);
863 ASSERT_NO_FATAL_FAILURE(ui_test_utils::WaitForLoadStop( 863 ASSERT_NO_FATAL_FAILURE(content::WaitForLoadStop(
864 chrome::GetActiveWebContents(browser()))); 864 chrome::GetActiveWebContents(browser())));
865 EXPECT_TRUE(IsViewFocused(location_bar_focus_view_id_)); 865 EXPECT_TRUE(IsViewFocused(location_bar_focus_view_id_));
866 } 866 }
867 867
868 // Tests that focus goes where expected when using reload. 868 // Tests that focus goes where expected when using reload.
869 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) { 869 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) {
870 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 870 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
871 ASSERT_TRUE(test_server()->Start()); 871 ASSERT_TRUE(test_server()->Start());
872 872
873 // Open the new tab, reload. 873 // Open the new tab, reload.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 chrome::Reload(browser(), CURRENT_TAB); 925 chrome::Reload(browser(), CURRENT_TAB);
926 observer.Wait(); 926 observer.Wait();
927 } 927 }
928 928
929 // Focus should now be on the tab contents. 929 // Focus should now be on the tab contents.
930 chrome::ShowDownloads(browser()); 930 chrome::ShowDownloads(browser());
931 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); 931 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
932 } 932 }
933 933
934 } // namespace 934 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698