OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
10 #include "chrome/browser/automation/ui_controls.h" | 10 #include "chrome/browser/automation/ui_controls.h" |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 | 731 |
732 // Tests that focus goes where expected when using reload. | 732 // Tests that focus goes where expected when using reload. |
733 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) { | 733 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) { |
734 HTTPTestServer* server = StartHTTPServer(); | 734 HTTPTestServer* server = StartHTTPServer(); |
735 | 735 |
736 // Open the new tab, reload. | 736 // Open the new tab, reload. |
737 browser()->NewTab(); | 737 browser()->NewTab(); |
738 | 738 |
739 ui_test_utils::RunAllPendingInMessageLoop(); | 739 ui_test_utils::RunAllPendingInMessageLoop(); |
740 | 740 |
741 browser()->Reload(); | 741 browser()->Reload(CURRENT_TAB); |
742 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); | 742 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); |
743 // Focus should stay on the location bar. | 743 // Focus should stay on the location bar. |
744 ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); | 744 ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); |
745 | 745 |
746 // Open a regular page, focus the location bar, reload. | 746 // Open a regular page, focus the location bar, reload. |
747 ui_test_utils::NavigateToURL(browser(), server->TestServerPage(kSimplePage)); | 747 ui_test_utils::NavigateToURL(browser(), server->TestServerPage(kSimplePage)); |
748 browser()->FocusLocationBar(); | 748 browser()->FocusLocationBar(); |
749 ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); | 749 ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); |
750 browser()->Reload(); | 750 browser()->Reload(CURRENT_TAB); |
751 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); | 751 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); |
752 // Focus should now be on the tab contents. | 752 // Focus should now be on the tab contents. |
753 browser()->ShowDownloadsTab(); | 753 browser()->ShowDownloadsTab(); |
754 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); | 754 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); |
755 } | 755 } |
756 | 756 |
757 // Tests that focus goes where expected when using reload on a crashed tab. | 757 // Tests that focus goes where expected when using reload on a crashed tab. |
758 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReloadCrashedTab) { | 758 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReloadCrashedTab) { |
759 HTTPTestServer* server = StartHTTPServer(); | 759 HTTPTestServer* server = StartHTTPServer(); |
760 | 760 |
761 // Open a regular page, crash, reload. | 761 // Open a regular page, crash, reload. |
762 ui_test_utils::NavigateToURL(browser(), server->TestServerPage(kSimplePage)); | 762 ui_test_utils::NavigateToURL(browser(), server->TestServerPage(kSimplePage)); |
763 ui_test_utils::CrashTab(browser()->GetSelectedTabContents()); | 763 ui_test_utils::CrashTab(browser()->GetSelectedTabContents()); |
764 browser()->Reload(); | 764 browser()->Reload(CURRENT_TAB); |
765 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); | 765 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); |
766 // Focus should now be on the tab contents. | 766 // Focus should now be on the tab contents. |
767 browser()->ShowDownloadsTab(); | 767 browser()->ShowDownloadsTab(); |
768 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); | 768 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); |
769 } | 769 } |
OLD | NEW |