summaryrefslogtreecommitdiffstats
path: root/chrome/test/interactive_ui
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-29 22:02:22 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-29 22:02:22 +0000
commit947b1a563bceae4b78425424f0c0b88fa182ce22 (patch)
tree48d4f928619ad1b203055ba17db125e73180fdbc /chrome/test/interactive_ui
parent901baddfb80f62f14ea9b19fdb1852ba7b0c89b9 (diff)
downloadchromium_src-947b1a563bceae4b78425424f0c0b88fa182ce22.zip
chromium_src-947b1a563bceae4b78425424f0c0b88fa182ce22.tar.gz
chromium_src-947b1a563bceae4b78425424f0c0b88fa182ce22.tar.bz2
Add back a test lost in r37819, because it had been at the bottom of an unrelated file.
BUG=none TEST=Test passes Review URL: http://codereview.chromium.org/3029038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54204 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/interactive_ui')
-rw-r--r--chrome/test/interactive_ui/keyboard_access_uitest.cc38
1 files changed, 36 insertions, 2 deletions
diff --git a/chrome/test/interactive_ui/keyboard_access_uitest.cc b/chrome/test/interactive_ui/keyboard_access_uitest.cc
index b4180f1..f28575b 100644
--- a/chrome/test/interactive_ui/keyboard_access_uitest.cc
+++ b/chrome/test/interactive_ui/keyboard_access_uitest.cc
@@ -8,6 +8,7 @@
#include "chrome/test/automation/window_proxy.h"
#include "chrome/test/ui/ui_test.h"
#include "googleurl/src/gurl.h"
+#include "views/event.h"
// This functionality currently works on Windows and on Linux when
// toolkit_views is defined (i.e. for Chrome OS). It's not needed
@@ -24,8 +25,8 @@ class KeyboardAccessTest : public UITest {
}
// Use the keyboard to select "New Tab" from the app menu.
- // This test depends on the fact that there are two menus and that
- // New Tab is the first item in the app menu. If the menus change,
+ // This test depends on the fact that there is one menu and that
+ // New Tab is the first item in the menu. If the menus change,
// this test will need to be changed to reflect that.
//
// If alternate_key_sequence is true, use "Alt" instead of "F10" to
@@ -101,6 +102,39 @@ TEST_F(KeyboardAccessTest, TestAltMenuKeyboardAccess) {
TestMenuKeyboardAccess(true);
}
+TEST_F(KeyboardAccessTest, ReserveKeyboardAccelerators) {
+ const std::string kBadPage =
+ "<html><script>"
+ "document.onkeydown = function() {"
+ " event.preventDefault();"
+ " return false;"
+ "}"
+ "</script></html>";
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ ASSERT_TRUE(browser);
+ browser->AppendTab(GURL("data:text/html," + kBadPage));
+ int tab_count = 0;
+ ASSERT_TRUE(browser->GetTabCount(&tab_count));
+ ASSERT_EQ(tab_count, 2);
+
+ int active_tab = 0;
+ ASSERT_TRUE(browser->GetActiveTabIndex(&active_tab));
+ ASSERT_EQ(active_tab, 1);
+
+ scoped_refptr<WindowProxy> window(browser->GetWindow());
+ ASSERT_TRUE(window);
+ ASSERT_TRUE(window->SimulateOSKeyPress(
+ base::VKEY_TAB, views::Event::EF_CONTROL_DOWN));
+ ASSERT_TRUE(browser->WaitForTabToBecomeActive(0, action_max_timeout_ms()));
+
+#if !defined(OS_MACOSX) // see BrowserWindowCocoa::GetCommandId
+ ASSERT_TRUE(browser->ActivateTab(1));
+ ASSERT_TRUE(window->SimulateOSKeyPress(
+ base::VKEY_F4, views::Event::EF_CONTROL_DOWN));
+ ASSERT_TRUE(browser->WaitForTabCountToBecome(1, action_max_timeout_ms()));
+#endif
+}
+
} // namespace
#endif // defined(TOOLKIT_VIEWS)