summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-02 21:17:45 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-02 21:17:45 +0000
commitae40b572f534c3438e9d28ee9cf837531476ff17 (patch)
tree8bc76e8767534b42025852815965cfd2befd5a96 /chrome
parent1f2532bec61be9751f526f74c7b77e85a7484c2c (diff)
downloadchromium_src-ae40b572f534c3438e9d28ee9cf837531476ff17.zip
chromium_src-ae40b572f534c3438e9d28ee9cf837531476ff17.tar.gz
chromium_src-ae40b572f534c3438e9d28ee9cf837531476ff17.tar.bz2
Find-in-bar would steal focus when switching tab.
BUG=23296 TEST=See bug. Review URL: http://codereview.chromium.org/243073 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27901 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser_focus_uitest.cc38
-rw-r--r--chrome/browser/views/frame/browser_view.cc2
2 files changed, 38 insertions, 2 deletions
diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc
index 5e3a111..ca3de5e 100644
--- a/chrome/browser/browser_focus_uitest.cc
+++ b/chrome/browser/browser_focus_uitest.cc
@@ -344,6 +344,44 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, TabsRememberFocus) {
}
}
+// Tabs remember focus with find-in-page box.
+IN_PROC_BROWSER_TEST_F(BrowserFocusTest, TabsRememberFocusFindInPage) {
+ HTTPTestServer* server = StartHTTPServer();
+
+ // First we navigate to our test page.
+ GURL url = server->TestServerPageW(kSimplePage);
+ ui_test_utils::NavigateToURL(browser(), url);
+
+ browser()->Find();
+ ui_test_utils::FindInPage(browser()->GetSelectedTabContents(),
+ ASCIIToUTF16("a"), true, false, NULL);
+ CheckViewHasFocus(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD);
+
+ // Focus the location bar.
+ browser()->FocusLocationBar();
+
+ // Create a 2nd tab.
+ browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, true, -1,
+ false, NULL);
+
+ // Focus should be on the recently opened tab page.
+ CheckViewHasFocus(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW);
+
+ // Select 1st tab, focus should still be on the location-bar.
+ // (bug http://crbug.com/23296)
+ browser()->SelectTabContentsAt(0, true);
+ CheckViewHasFocus(VIEW_ID_LOCATION_BAR);
+
+ // Now open the find box again, switch to another tab and come back, the focus
+ // should return to the find box.
+ browser()->Find();
+ CheckViewHasFocus(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD);
+ browser()->SelectTabContentsAt(1, true);
+ CheckViewHasFocus(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW);
+ browser()->SelectTabContentsAt(0, true);
+ CheckViewHasFocus(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD);
+}
+
// Background window does not steal focus.
IN_PROC_BROWSER_TEST_F(BrowserFocusTest, BackgroundBrowserDontStealFocus) {
HTTPTestServer* server = StartHTTPServer();
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index a6b874a..a626250 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -1226,8 +1226,6 @@ void BrowserView::TabSelectedAt(TabContents* old_contents,
// We only restore focus if our window is visible, to avoid invoking blur
// handlers when we are eventually shown.
new_contents->view()->RestoreFocus();
- if (new_contents->find_ui_active())
- browser_->find_bar()->find_bar()->SetFocusAndSelection();
}
// Update all the UI bits.