| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 | 660 |
| 661 // The tab contents should have the focus in the second tab. | 661 // The tab contents should have the focus in the second tab. |
| 662 EXPECT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); | 662 EXPECT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); |
| 663 | 663 |
| 664 // Go back to the first tab. The focus should not be in the omnibox. | 664 // Go back to the first tab. The focus should not be in the omnibox. |
| 665 chrome::SelectPreviousTab(browser()); | 665 chrome::SelectPreviousTab(browser()); |
| 666 EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); | 666 EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); |
| 667 EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX)); | 667 EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX)); |
| 668 } | 668 } |
| 669 | 669 |
| 670 // Flaky on Windows (http://crbug.com/665296). | 670 // Flaky on Windows and Mac (http://crbug.com/665296). |
| 671 #if defined(OS_WIN) | 671 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 672 #define MAYBE_FocusOnNavigate DISABLED_FocusOnNavigate | 672 #define MAYBE_FocusOnNavigate DISABLED_FocusOnNavigate |
| 673 #else | 673 #else |
| 674 #define MAYBE_FocusOnNavigate FocusOnNavigate | 674 #define MAYBE_FocusOnNavigate FocusOnNavigate |
| 675 #endif | 675 #endif |
| 676 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusOnNavigate) { | 676 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusOnNavigate) { |
| 677 // Needed on Mac. | 677 // Needed on Mac. |
| 678 // TODO(warx): check why it is needed on Mac. | 678 // TODO(warx): check why it is needed on Mac. |
| 679 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 679 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
| 680 // Load the NTP. | 680 // Load the NTP. |
| 681 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); | 681 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 ASSERT_TRUE(content::ExecuteScript(web_contents, spoof)); | 732 ASSERT_TRUE(content::ExecuteScript(web_contents, spoof)); |
| 733 EXPECT_EQ(url1, web_contents->GetVisibleURL()); | 733 EXPECT_EQ(url1, web_contents->GetVisibleURL()); |
| 734 // After running the spoof code, |GetActiveWebContents| returns the new tab, | 734 // After running the spoof code, |GetActiveWebContents| returns the new tab, |
| 735 // not the same as |web_contents|. | 735 // not the same as |web_contents|. |
| 736 ASSERT_NO_FATAL_FAILURE(content::WaitForLoadStop( | 736 ASSERT_NO_FATAL_FAILURE(content::WaitForLoadStop( |
| 737 browser()->tab_strip_model()->GetActiveWebContents())); | 737 browser()->tab_strip_model()->GetActiveWebContents())); |
| 738 EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX)); | 738 EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX)); |
| 739 } | 739 } |
| 740 | 740 |
| 741 } // namespace | 741 } // namespace |
| OLD | NEW |