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

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

Issue 10807047: Create content\public\test\test_utils.h to hold common test classes that are used by unit and brows… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 853 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 EXPECT_TRUE(IsViewFocused(location_bar_focus_view_id_)); 864 EXPECT_TRUE(IsViewFocused(location_bar_focus_view_id_));
865 } 865 }
866 866
867 // Tests that focus goes where expected when using reload. 867 // Tests that focus goes where expected when using reload.
868 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) { 868 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) {
869 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 869 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
870 ASSERT_TRUE(test_server()->Start()); 870 ASSERT_TRUE(test_server()->Start());
871 871
872 // Open the new tab, reload. 872 // Open the new tab, reload.
873 { 873 {
874 ui_test_utils::WindowedNotificationObserver observer( 874 content::WindowedNotificationObserver observer(
875 content::NOTIFICATION_LOAD_STOP, 875 content::NOTIFICATION_LOAD_STOP,
876 content::NotificationService::AllSources()); 876 content::NotificationService::AllSources());
877 chrome::NewTab(browser()); 877 chrome::NewTab(browser());
878 observer.Wait(); 878 observer.Wait();
879 } 879 }
880 ui_test_utils::RunAllPendingInMessageLoop(); 880 ui_test_utils::RunAllPendingInMessageLoop();
881 881
882 { 882 {
883 ui_test_utils::WindowedNotificationObserver observer( 883 content::WindowedNotificationObserver observer(
884 content::NOTIFICATION_LOAD_STOP, 884 content::NOTIFICATION_LOAD_STOP,
885 content::Source<NavigationController>( 885 content::Source<NavigationController>(
886 &chrome::GetActiveWebContents(browser())->GetController())); 886 &chrome::GetActiveWebContents(browser())->GetController()));
887 chrome::Reload(browser(), CURRENT_TAB); 887 chrome::Reload(browser(), CURRENT_TAB);
888 observer.Wait(); 888 observer.Wait();
889 } 889 }
890 // Focus should stay on the location bar. 890 // Focus should stay on the location bar.
891 ASSERT_TRUE(IsViewFocused(location_bar_focus_view_id_)); 891 ASSERT_TRUE(IsViewFocused(location_bar_focus_view_id_));
892 892
893 // Open a regular page, focus the location bar, reload. 893 // Open a regular page, focus the location bar, reload.
894 ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(kSimplePage)); 894 ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(kSimplePage));
895 chrome::FocusLocationBar(browser()); 895 chrome::FocusLocationBar(browser());
896 ASSERT_TRUE(IsViewFocused(location_bar_focus_view_id_)); 896 ASSERT_TRUE(IsViewFocused(location_bar_focus_view_id_));
897 { 897 {
898 ui_test_utils::WindowedNotificationObserver observer( 898 content::WindowedNotificationObserver observer(
899 content::NOTIFICATION_LOAD_STOP, 899 content::NOTIFICATION_LOAD_STOP,
900 content::Source<NavigationController>( 900 content::Source<NavigationController>(
901 &chrome::GetActiveWebContents(browser())->GetController())); 901 &chrome::GetActiveWebContents(browser())->GetController()));
902 chrome::Reload(browser(), CURRENT_TAB); 902 chrome::Reload(browser(), CURRENT_TAB);
903 observer.Wait(); 903 observer.Wait();
904 } 904 }
905 905
906 // Focus should now be on the tab contents. 906 // Focus should now be on the tab contents.
907 chrome::ShowDownloads(browser()); 907 chrome::ShowDownloads(browser());
908 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); 908 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
909 } 909 }
910 910
911 // Tests that focus goes where expected when using reload on a crashed tab. 911 // Tests that focus goes where expected when using reload on a crashed tab.
912 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_FocusOnReloadCrashedTab) { 912 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_FocusOnReloadCrashedTab) {
913 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 913 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
914 ASSERT_TRUE(test_server()->Start()); 914 ASSERT_TRUE(test_server()->Start());
915 915
916 // Open a regular page, crash, reload. 916 // Open a regular page, crash, reload.
917 ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(kSimplePage)); 917 ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(kSimplePage));
918 ui_test_utils::CrashTab(chrome::GetActiveWebContents(browser())); 918 ui_test_utils::CrashTab(chrome::GetActiveWebContents(browser()));
919 { 919 {
920 ui_test_utils::WindowedNotificationObserver observer( 920 content::WindowedNotificationObserver observer(
921 content::NOTIFICATION_LOAD_STOP, 921 content::NOTIFICATION_LOAD_STOP,
922 content::Source<NavigationController>( 922 content::Source<NavigationController>(
923 &chrome::GetActiveWebContents(browser())->GetController())); 923 &chrome::GetActiveWebContents(browser())->GetController()));
924 chrome::Reload(browser(), CURRENT_TAB); 924 chrome::Reload(browser(), CURRENT_TAB);
925 observer.Wait(); 925 observer.Wait();
926 } 926 }
927 927
928 // Focus should now be on the tab contents. 928 // Focus should now be on the tab contents.
929 chrome::ShowDownloads(browser()); 929 chrome::ShowDownloads(browser());
930 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); 930 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
931 } 931 }
932 932
933 } // namespace 933 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/browser_encoding_browsertest.cc ('k') | chrome/browser/browser_keyevents_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698