diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-12 00:21:28 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-12 00:21:28 +0000 |
commit | 401513c474b3520fe784c03e068a15fc6655d6e1 (patch) | |
tree | 9d5368feb8f3a668ec4523e90bc9694bcfc3a9d3 /chrome/browser/browser_focus_uitest.cc | |
parent | a8e9b16e3e3f944d0eaf7f91e5cc96a7b2c914d3 (diff) | |
download | chromium_src-401513c474b3520fe784c03e068a15fc6655d6e1.zip chromium_src-401513c474b3520fe784c03e068a15fc6655d6e1.tar.gz chromium_src-401513c474b3520fe784c03e068a15fc6655d6e1.tar.bz2 |
Moving the storing/restoring of the focus from TabContents to WebContentsView. This makes TabContents less dependent on views.
This requires few contortions with DOMUIs (NTP, history and downloads tab) as they still need to set the initial focus specifically.
BUG=None
TEST=Run the interactive tests.
Review URL: http://codereview.chromium.org/39269
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11501 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_focus_uitest.cc')
-rw-r--r-- | chrome/browser/browser_focus_uitest.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc index d920a012..81edcc2 100644 --- a/chrome/browser/browser_focus_uitest.cc +++ b/chrome/browser/browser_focus_uitest.cc @@ -442,3 +442,27 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FindFocusTest) { ASSERT_TRUE(focused_view != NULL); EXPECT_EQ(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD, focused_view->GetID()); } + +// Makes sure the focus is in the right location when opening the different +// types of tabs. +IN_PROC_BROWSER_TEST_F(BrowserFocusTest, TabInitialFocus) { + HWND hwnd = reinterpret_cast<HWND>(browser()->window()->GetNativeHandle()); + BrowserView* browser_view = BrowserView::GetBrowserViewForHWND(hwnd); + ASSERT_TRUE(browser_view); + views::FocusManager* focus_manager = + views::FocusManager::GetFocusManager(hwnd); + ASSERT_TRUE(focus_manager); + + // Open the history tab, focus should be on the tab contents. + browser()->ShowHistoryTab(); + EXPECT_EQ(browser_view->GetContentsView(), focus_manager->GetFocusedView()); + + // Open the new tab, focus should be on the location bar. + browser()->NewTab(); + EXPECT_EQ(browser_view->GetLocationBarView(), + focus_manager->GetFocusedView()); + + // Open the download tab, focus should be on the tab contents. + browser()->ShowDownloadsTab(); + EXPECT_EQ(browser_view->GetContentsView(), focus_manager->GetFocusedView()); +} |