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

Unified Diff: chrome/browser/ui/views/frame/browser_view_unittest.cc

Issue 2128243003: Make most browser accelerators not repeat. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update comment in test Created 4 years, 3 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 | « chrome/browser/ui/views/frame/browser_view.cc ('k') | ui/base/accelerators/accelerator_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/frame/browser_view_unittest.cc
diff --git a/chrome/browser/ui/views/frame/browser_view_unittest.cc b/chrome/browser/ui/views/frame/browser_view_unittest.cc
index 11c644827a37f97ba4729c4221b120802bd5f44d..a7d35312a0bcaf6b8e2dad797adf0d841dfb2d36 100644
--- a/chrome/browser/ui/views/frame/browser_view_unittest.cc
+++ b/chrome/browser/ui/views/frame/browser_view_unittest.cc
@@ -16,6 +16,7 @@
#include "chrome/browser/ui/views/tabs/tab_strip.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "chrome/common/url_constants.h"
+#include "ui/base/accelerators/accelerator.h"
#include "ui/views/controls/webview/webview.h"
namespace {
@@ -162,6 +163,26 @@ TEST_F(BrowserViewTest, BrowserViewLayout) {
BookmarkBarView::DisableAnimationsForTesting(false);
}
+// Test that repeated accelerators are processed or ignored depending on the
+// commands that they refer to. The behavior for different commands is dictated
+// by chrome::IsCommandRepeatable() in
+// chrome/browser/ui/views/accelerator_table.h.
+TEST_F(BrowserViewTest, RepeatedAccelerators) {
+ // A non-repeated Ctrl-L accelerator should be processed.
+ const ui::Accelerator kLocationAccel(ui::VKEY_L, ui::EF_CONTROL_DOWN);
+ EXPECT_TRUE(browser_view()->AcceleratorPressed(kLocationAccel));
+
+ // If the accelerator is repeated, it should be ignored.
+ const ui::Accelerator kLocationRepeatAccel(
+ ui::VKEY_L, ui::EF_CONTROL_DOWN | ui::EF_IS_REPEAT);
+ EXPECT_FALSE(browser_view()->AcceleratorPressed(kLocationRepeatAccel));
+
+ // A repeated Ctrl-Tab accelerator should be processed.
+ const ui::Accelerator kNextTabRepeatAccel(
+ ui::VKEY_TAB, ui::EF_CONTROL_DOWN | ui::EF_IS_REPEAT);
+ EXPECT_TRUE(browser_view()->AcceleratorPressed(kNextTabRepeatAccel));
+}
+
class BrowserViewHostedAppTest : public TestWithBrowserView {
public:
BrowserViewHostedAppTest() : TestWithBrowserView(Browser::TYPE_POPUP, true) {}
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | ui/base/accelerators/accelerator_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698