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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_TabsRememberFocus) { | 282 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_TabsRememberFocus) { |
283 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 283 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
284 ASSERT_TRUE(test_server()->Start()); | 284 ASSERT_TRUE(test_server()->Start()); |
285 | 285 |
286 // First we navigate to our test page. | 286 // First we navigate to our test page. |
287 GURL url = test_server()->GetURL(kSimplePage); | 287 GURL url = test_server()->GetURL(kSimplePage); |
288 ui_test_utils::NavigateToURL(browser(), url); | 288 ui_test_utils::NavigateToURL(browser(), url); |
289 | 289 |
290 // Create several tabs. | 290 // Create several tabs. |
291 for (int i = 0; i < 4; ++i) | 291 for (int i = 0; i < 4; ++i) |
292 browser()->AddSelectedTabWithURL(url, PageTransition::TYPED); | 292 browser()->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED); |
293 | 293 |
294 // Alternate focus for the tab. | 294 // Alternate focus for the tab. |
295 const bool kFocusPage[3][5] = { | 295 const bool kFocusPage[3][5] = { |
296 { true, true, true, true, false }, | 296 { true, true, true, true, false }, |
297 { false, false, false, false, false }, | 297 { false, false, false, false, false }, |
298 { false, true, false, true, false } | 298 { false, true, false, true, false } |
299 }; | 299 }; |
300 | 300 |
301 for (int i = 1; i < 3; i++) { | 301 for (int i = 1; i < 3; i++) { |
302 for (int j = 0; j < 5; j++) { | 302 for (int j = 0; j < 5; j++) { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 | 357 |
358 browser()->Find(); | 358 browser()->Find(); |
359 ui_test_utils::FindInPage(browser()->GetSelectedTabContentsWrapper(), | 359 ui_test_utils::FindInPage(browser()->GetSelectedTabContentsWrapper(), |
360 ASCIIToUTF16("a"), true, false, NULL); | 360 ASCIIToUTF16("a"), true, false, NULL); |
361 ASSERT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); | 361 ASSERT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); |
362 | 362 |
363 // Focus the location bar. | 363 // Focus the location bar. |
364 browser()->FocusLocationBar(); | 364 browser()->FocusLocationBar(); |
365 | 365 |
366 // Create a 2nd tab. | 366 // Create a 2nd tab. |
367 browser()->AddSelectedTabWithURL(url, PageTransition::TYPED); | 367 browser()->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED); |
368 | 368 |
369 // Focus should be on the recently opened tab page. | 369 // Focus should be on the recently opened tab page. |
370 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); | 370 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); |
371 | 371 |
372 // Select 1st tab, focus should still be on the location-bar. | 372 // Select 1st tab, focus should still be on the location-bar. |
373 // (bug http://crbug.com/23296) | 373 // (bug http://crbug.com/23296) |
374 browser()->ActivateTabAt(0, true); | 374 browser()->ActivateTabAt(0, true); |
375 ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); | 375 ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); |
376 | 376 |
377 // Now open the find box again, switch to another tab and come back, the focus | 377 // Now open the find box again, switch to another tab and come back, the focus |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 EXPECT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); | 829 EXPECT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); |
830 | 830 |
831 // Open the download tab, focus should be on the tab contents. | 831 // Open the download tab, focus should be on the tab contents. |
832 browser()->ShowDownloadsTab(); | 832 browser()->ShowDownloadsTab(); |
833 ASSERT_NO_FATAL_FAILURE(ui_test_utils::WaitForLoadStop( | 833 ASSERT_NO_FATAL_FAILURE(ui_test_utils::WaitForLoadStop( |
834 browser()->GetSelectedTabContents())); | 834 browser()->GetSelectedTabContents())); |
835 EXPECT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); | 835 EXPECT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); |
836 | 836 |
837 // Open about:blank, focus should be on the location bar. | 837 // Open about:blank, focus should be on the location bar. |
838 browser()->AddSelectedTabWithURL(GURL(chrome::kAboutBlankURL), | 838 browser()->AddSelectedTabWithURL(GURL(chrome::kAboutBlankURL), |
839 PageTransition::LINK); | 839 content::PAGE_TRANSITION_LINK); |
840 ASSERT_NO_FATAL_FAILURE(ui_test_utils::WaitForLoadStop( | 840 ASSERT_NO_FATAL_FAILURE(ui_test_utils::WaitForLoadStop( |
841 browser()->GetSelectedTabContents())); | 841 browser()->GetSelectedTabContents())); |
842 EXPECT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); | 842 EXPECT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); |
843 } | 843 } |
844 | 844 |
845 // Tests that focus goes where expected when using reload. | 845 // Tests that focus goes where expected when using reload. |
846 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) { | 846 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) { |
847 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 847 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
848 ASSERT_TRUE(test_server()->Start()); | 848 ASSERT_TRUE(test_server()->Start()); |
849 | 849 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 browser()->Reload(CURRENT_TAB); | 902 browser()->Reload(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 browser()->ShowDownloadsTab(); | 907 browser()->ShowDownloadsTab(); |
908 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); | 908 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); |
909 } | 909 } |
910 | 910 |
911 } // namespace | 911 } // namespace |
OLD | NEW |