| OLD | NEW |
| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 EXPECT_TRUE(interstitial_page->HasFocus()); | 464 EXPECT_TRUE(interstitial_page->HasFocus()); |
| 465 | 465 |
| 466 // Hide the interstitial; the original page should gain focus. | 466 // Hide the interstitial; the original page should gain focus. |
| 467 interstitial_page->DontProceed(); | 467 interstitial_page->DontProceed(); |
| 468 content::RunAllPendingInMessageLoop(); | 468 content::RunAllPendingInMessageLoop(); |
| 469 EXPECT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); | 469 EXPECT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); |
| 470 EXPECT_TRUE(tab->GetRenderViewHost()->GetView()->HasFocus()); | 470 EXPECT_TRUE(tab->GetRenderViewHost()->GetView()->HasFocus()); |
| 471 } | 471 } |
| 472 | 472 |
| 473 // Test that find-in-page UI can request focus, even when it is already open. | 473 // Test that find-in-page UI can request focus, even when it is already open. |
| 474 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FindFocusTest) { | 474 #if defined(OS_MACOSX) |
| 475 #define MAYBE_FindFocusTest DISABLED_FindFocusTest |
| 476 #else |
| 477 #define MAYBE_FindFocusTest FindFocusTest |
| 478 #endif |
| 479 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FindFocusTest) { |
| 475 chrome::DisableFindBarAnimationsDuringTesting(true); | 480 chrome::DisableFindBarAnimationsDuringTesting(true); |
| 476 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 481 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
| 477 const GURL url = embedded_test_server()->GetURL(kTypicalPage); | 482 const GURL url = embedded_test_server()->GetURL(kTypicalPage); |
| 478 ui_test_utils::NavigateToURL(browser(), url); | 483 ui_test_utils::NavigateToURL(browser(), url); |
| 479 EXPECT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); | 484 EXPECT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); |
| 480 | 485 |
| 481 chrome::ShowFindBar(browser()); | 486 chrome::ShowFindBar(browser()); |
| 482 EXPECT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); | 487 EXPECT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); |
| 483 | 488 |
| 484 chrome::FocusLocationBar(browser()); | 489 chrome::FocusLocationBar(browser()); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 695 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 691 content::NotificationService::AllSources()); | 696 content::NotificationService::AllSources()); |
| 692 chrome::GoForward(browser(), CURRENT_TAB); | 697 chrome::GoForward(browser(), CURRENT_TAB); |
| 693 forward_nav_observer.Wait(); | 698 forward_nav_observer.Wait(); |
| 694 } | 699 } |
| 695 | 700 |
| 696 EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX)); | 701 EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX)); |
| 697 } | 702 } |
| 698 | 703 |
| 699 } // namespace | 704 } // namespace |
| OLD | NEW |