| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 content::NotificationService::AllSources()); | 845 content::NotificationService::AllSources()); |
| 846 browser()->NewTab(); | 846 browser()->NewTab(); |
| 847 observer.Wait(); | 847 observer.Wait(); |
| 848 } | 848 } |
| 849 ui_test_utils::RunAllPendingInMessageLoop(); | 849 ui_test_utils::RunAllPendingInMessageLoop(); |
| 850 | 850 |
| 851 { | 851 { |
| 852 ui_test_utils::WindowedNotificationObserver observer( | 852 ui_test_utils::WindowedNotificationObserver observer( |
| 853 content::NOTIFICATION_LOAD_STOP, | 853 content::NOTIFICATION_LOAD_STOP, |
| 854 content::Source<NavigationController>( | 854 content::Source<NavigationController>( |
| 855 &browser()->GetSelectedTabContentsWrapper()->controller())); | 855 &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> |
| 856 controller())); |
| 856 browser()->Reload(CURRENT_TAB); | 857 browser()->Reload(CURRENT_TAB); |
| 857 observer.Wait(); | 858 observer.Wait(); |
| 858 } | 859 } |
| 859 // Focus should stay on the location bar. | 860 // Focus should stay on the location bar. |
| 860 ASSERT_TRUE(IsViewFocused(location_bar_focus_view_id_)); | 861 ASSERT_TRUE(IsViewFocused(location_bar_focus_view_id_)); |
| 861 | 862 |
| 862 // Open a regular page, focus the location bar, reload. | 863 // Open a regular page, focus the location bar, reload. |
| 863 ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(kSimplePage)); | 864 ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(kSimplePage)); |
| 864 browser()->FocusLocationBar(); | 865 browser()->FocusLocationBar(); |
| 865 ASSERT_TRUE(IsViewFocused(location_bar_focus_view_id_)); | 866 ASSERT_TRUE(IsViewFocused(location_bar_focus_view_id_)); |
| 866 { | 867 { |
| 867 ui_test_utils::WindowedNotificationObserver observer( | 868 ui_test_utils::WindowedNotificationObserver observer( |
| 868 content::NOTIFICATION_LOAD_STOP, | 869 content::NOTIFICATION_LOAD_STOP, |
| 869 content::Source<NavigationController>( | 870 content::Source<NavigationController>( |
| 870 &browser()->GetSelectedTabContentsWrapper()->controller())); | 871 &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> |
| 872 controller())); |
| 871 browser()->Reload(CURRENT_TAB); | 873 browser()->Reload(CURRENT_TAB); |
| 872 observer.Wait(); | 874 observer.Wait(); |
| 873 } | 875 } |
| 874 | 876 |
| 875 // Focus should now be on the tab contents. | 877 // Focus should now be on the tab contents. |
| 876 browser()->ShowDownloadsTab(); | 878 browser()->ShowDownloadsTab(); |
| 877 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); | 879 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); |
| 878 } | 880 } |
| 879 | 881 |
| 880 // Tests that focus goes where expected when using reload on a crashed tab. | 882 // Tests that focus goes where expected when using reload on a crashed tab. |
| 881 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_FocusOnReloadCrashedTab) { | 883 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_FocusOnReloadCrashedTab) { |
| 882 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 884 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
| 883 ASSERT_TRUE(test_server()->Start()); | 885 ASSERT_TRUE(test_server()->Start()); |
| 884 | 886 |
| 885 // Open a regular page, crash, reload. | 887 // Open a regular page, crash, reload. |
| 886 ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(kSimplePage)); | 888 ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(kSimplePage)); |
| 887 ui_test_utils::CrashTab(browser()->GetSelectedTabContents()); | 889 ui_test_utils::CrashTab(browser()->GetSelectedTabContents()); |
| 888 { | 890 { |
| 889 ui_test_utils::WindowedNotificationObserver observer( | 891 ui_test_utils::WindowedNotificationObserver observer( |
| 890 content::NOTIFICATION_LOAD_STOP, | 892 content::NOTIFICATION_LOAD_STOP, |
| 891 content::Source<NavigationController>( | 893 content::Source<NavigationController>( |
| 892 &browser()->GetSelectedTabContentsWrapper()->controller())); | 894 &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> |
| 895 controller())); |
| 893 browser()->Reload(CURRENT_TAB); | 896 browser()->Reload(CURRENT_TAB); |
| 894 observer.Wait(); | 897 observer.Wait(); |
| 895 } | 898 } |
| 896 | 899 |
| 897 // Focus should now be on the tab contents. | 900 // Focus should now be on the tab contents. |
| 898 browser()->ShowDownloadsTab(); | 901 browser()->ShowDownloadsTab(); |
| 899 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); | 902 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); |
| 900 } | 903 } |
| 901 | 904 |
| 902 } // namespace | 905 } // namespace |
| OLD | NEW |