Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4936)

Unified Diff: chrome/test/interactive_ui/keyboard_access_uitest.cc

Issue 3029038: Add back a test lost in r37819, because it had been at the bottom of an unrel... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/interactive_ui/keyboard_access_uitest.cc
===================================================================
--- chrome/test/interactive_ui/keyboard_access_uitest.cc (revision 54017)
+++ chrome/test/interactive_ui/keyboard_access_uitest.cc (working copy)
@@ -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 @@
}
// 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 @@
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)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698