diff options
author | suzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-04 19:48:19 +0000 |
---|---|---|
committer | suzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-04 19:48:19 +0000 |
commit | ee19cb20c9c5a0354d145a6a1ca950797b7cd3aa (patch) | |
tree | 66a1f65060e653ff2a817c73c62505caee94b65f /chrome/browser/browser_keyevents_browsertest.cc | |
parent | e5a8c47bda7fe8e3d8491fdd74cd166da02b8a7b (diff) | |
download | chromium_src-ee19cb20c9c5a0354d145a6a1ca950797b7cd3aa.zip chromium_src-ee19cb20c9c5a0354d145a6a1ca950797b7cd3aa.tar.gz chromium_src-ee19cb20c9c5a0354d145a6a1ca950797b7cd3aa.tar.bz2 |
[Linux Views] Refactor accelerator handler related code.
This CL removes the accelerator handling logic in
accelerator_handler_gtk.cc and implements a much simpler solution in
WidgetGtk. The new approach always sends a key event to the focused View
and native GtkWidget first and only sends it to the focus manager if it's not
handled by any View or native GtkWidget.
BUG=23383 AcceleratorHandler on Windows should not dispatch the KEYUP messages eaten by the FocusManager
BUG=40966 BrowserKeyEventsTest.AccessKeys is crashy
BUG=49701 [Linux Views]Some Emacs keybindings are broken in omnibox and find in page box.
TEST=Press Alt key in different place (web page, omnibox, find bar, etc.) to see if menu bar can be focused correctly. Press alt-F to popup wrench menu and Escape to close it, then try alt key again.
Review URL: http://codereview.chromium.org/3046041
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54947 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_keyevents_browsertest.cc')
-rw-r--r-- | chrome/browser/browser_keyevents_browsertest.cc | 62 |
1 files changed, 54 insertions, 8 deletions
diff --git a/chrome/browser/browser_keyevents_browsertest.cc b/chrome/browser/browser_keyevents_browsertest.cc index e943bef..0c4bd37db 100644 --- a/chrome/browser/browser_keyevents_browsertest.cc +++ b/chrome/browser/browser_keyevents_browsertest.cc @@ -532,14 +532,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, CommandKeyEvents) { } #endif -#if defined(TOOLKIT_VIEWS) && defined(OS_LINUX) -// See http://crbug.com/40037 for details. -#define MAYBE_AccessKeys DISABLED_AccessKeys -#else -#define MAYBE_AccessKeys AccessKeys -#endif - -IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, MAYBE_AccessKeys) { +IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, AccessKeys) { #if defined(OS_MACOSX) // On Mac, access keys use ctrl+alt modifiers. static const KeyEventTestData kTestAccessA = { @@ -891,4 +884,57 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, PageUpDownKeys) { EXPECT_NO_FATAL_FAILURE(CheckTextBoxValue(tab_index, L"A", L"")); } +#if defined(OS_WIN) || defined(TOOLKIT_VIEWS) +IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, FocusMenuBarByAltKey) { + static const KeyEventTestData kTestAltKey = { + base::VKEY_MENU, false, false, false, false, + false, false, false, false, 2, + { "D 18 0 false false true false", + "U 18 0 false false true false" } + }; + + static const KeyEventTestData kTestAltKeySuppress = { + base::VKEY_MENU, false, false, false, false, + true, false, false, false, 2, + { "D 18 0 false false true false", + "U 18 0 false false true false" } + }; + + static const KeyEventTestData kTestCtrlAltKey = { + base::VKEY_MENU, true, false, false, false, + false, false, false, false, 4, + { "D 17 0 true false false false", + "D 18 0 true false true false", + "U 18 0 true false true false", + "U 17 0 true false false false" } + }; + + net::HTTPTestServer* server = StartHTTPServer(); + ASSERT_TRUE(server); + + BringBrowserWindowToFront(); + GURL url = server->TestServerPage(kTestingPage); + ui_test_utils::NavigateToURL(browser(), url); + + ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); + ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); + + int tab_index = browser()->selected_index(); + // Press and release Alt key to focus wrench menu button. + EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltKey)); + EXPECT_TRUE(IsViewFocused(VIEW_ID_APP_MENU)); + + ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); + ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); + + // Alt key can be suppressed. + EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltKeySuppress)); + ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); + + // Ctrl+Alt should have no effect. + EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlAltKey)); + ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); +} +#endif + } // namespace |