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

Unified Diff: ash/accelerators/accelerator_controller_unittest.cc

Issue 10977088: Fix for Ash shortcuts unexpectedly working in system model dialog (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: adding unit tests Created 8 years, 2 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
Index: ash/accelerators/accelerator_controller_unittest.cc
diff --git a/ash/accelerators/accelerator_controller_unittest.cc b/ash/accelerators/accelerator_controller_unittest.cc
index 4d8c8ff3e9d64d0f4fbb80461484bddd96e58dd5..0008d3e9ad7bcbbe803595d15083ca30809d74aa 100644
--- a/ash/accelerators/accelerator_controller_unittest.cc
+++ b/ash/accelerators/accelerator_controller_unittest.cc
@@ -1020,5 +1020,36 @@ TEST_F(AcceleratorControllerTest, ReservedAccelerators) {
ui::Accelerator(ui::VKEY_A, ui::EF_NONE)));
}
+TEST_F(AcceleratorControllerTest, DisallowedAtModalWindow) {
+ std::set<AcceleratorAction> allActions;
+ for (size_t i = 0 ; i < kAcceleratorDataLength; ++i) {
+ allActions.insert(kAcceleratorData[i].action);
+ }
+ std::set<AcceleratorAction> actionsAllowedAtModalWindow;
+ for (size_t k = 0 ; k < kActionsAllowedAtModalWindowLength; ++k) {
+ actionsAllowedAtModalWindow.insert(kActionsAllowedAtModalWindow[k]);
+ }
+ for (std::set<AcceleratorAction>::const_iterator it =
+ actionsAllowedAtModalWindow.begin();
+ it != actionsAllowedAtModalWindow.end(); ++it) {
+ EXPECT_FALSE(allActions.find(*it) == allActions.end())
+ << " action from kActionsAllowedAtModalWindow"
+ << " not found in kAcceleratorData. action: " << *it;
+ }
+ scoped_ptr<aura::Window> window(
+ aura::test::CreateTestWindowWithBounds(gfx::Rect(5, 5, 20, 20), NULL));
+ const ui::Accelerator dummy;
+ wm::ActivateWindow(window.get());
+ Shell::GetInstance()->SimulateModalWindowOpenForTesting(true);
+ for (std::set<AcceleratorAction>::const_iterator it = allActions.begin();
+ it != allActions.end(); ++it) {
+ if (actionsAllowedAtModalWindow.find(*it) ==
+ actionsAllowedAtModalWindow.end()) {
+ EXPECT_TRUE(GetController()->PerformAction(*it, dummy))
Yusuke Sato 2012/10/16 01:03:18 This test itself looks good to me, but I think it
sschmitz 2012/10/16 18:18:23 Done.
+ << " for action (disallowed at modal window): " << *it;
+ }
+ }
+}
+
} // namespace test
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698