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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/accelerators/accelerator_controller.h" 5 #include "ash/accelerators/accelerator_controller.h"
6 #include "ash/accelerators/accelerator_table.h" 6 #include "ash/accelerators/accelerator_table.h"
7 #include "ash/caps_lock_delegate.h" 7 #include "ash/caps_lock_delegate.h"
8 #include "ash/display/multi_display_manager.h" 8 #include "ash/display/multi_display_manager.h"
9 #include "ash/ime_control_delegate.h" 9 #include "ash/ime_control_delegate.h"
10 #include "ash/screenshot_delegate.h" 10 #include "ash/screenshot_delegate.h"
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 #endif 1013 #endif
1014 // Others are not reserved. 1014 // Others are not reserved.
1015 EXPECT_FALSE(GetController()->IsReservedAccelerator( 1015 EXPECT_FALSE(GetController()->IsReservedAccelerator(
1016 ui::Accelerator(ui::VKEY_PRINT, ui::EF_NONE))); 1016 ui::Accelerator(ui::VKEY_PRINT, ui::EF_NONE)));
1017 EXPECT_FALSE(GetController()->IsReservedAccelerator( 1017 EXPECT_FALSE(GetController()->IsReservedAccelerator(
1018 ui::Accelerator(ui::VKEY_TAB, ui::EF_NONE))); 1018 ui::Accelerator(ui::VKEY_TAB, ui::EF_NONE)));
1019 EXPECT_FALSE(GetController()->IsReservedAccelerator( 1019 EXPECT_FALSE(GetController()->IsReservedAccelerator(
1020 ui::Accelerator(ui::VKEY_A, ui::EF_NONE))); 1020 ui::Accelerator(ui::VKEY_A, ui::EF_NONE)));
1021 } 1021 }
1022 1022
1023 TEST_F(AcceleratorControllerTest, DisallowedAtModalWindow) {
1024 std::set<AcceleratorAction> allActions;
1025 for (size_t i = 0 ; i < kAcceleratorDataLength; ++i) {
1026 allActions.insert(kAcceleratorData[i].action);
1027 }
1028 std::set<AcceleratorAction> actionsAllowedAtModalWindow;
1029 for (size_t k = 0 ; k < kActionsAllowedAtModalWindowLength; ++k) {
1030 actionsAllowedAtModalWindow.insert(kActionsAllowedAtModalWindow[k]);
1031 }
1032 for (std::set<AcceleratorAction>::const_iterator it =
1033 actionsAllowedAtModalWindow.begin();
1034 it != actionsAllowedAtModalWindow.end(); ++it) {
1035 EXPECT_FALSE(allActions.find(*it) == allActions.end())
1036 << " action from kActionsAllowedAtModalWindow"
1037 << " not found in kAcceleratorData. action: " << *it;
1038 }
1039 scoped_ptr<aura::Window> window(
1040 aura::test::CreateTestWindowWithBounds(gfx::Rect(5, 5, 20, 20), NULL));
1041 const ui::Accelerator dummy;
1042 wm::ActivateWindow(window.get());
1043 Shell::GetInstance()->SimulateModalWindowOpenForTesting(true);
1044 for (std::set<AcceleratorAction>::const_iterator it = allActions.begin();
1045 it != allActions.end(); ++it) {
1046 if (actionsAllowedAtModalWindow.find(*it) ==
1047 actionsAllowedAtModalWindow.end()) {
1048 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.
1049 << " for action (disallowed at modal window): " << *it;
1050 }
1051 }
1052 }
1053
1023 } // namespace test 1054 } // namespace test
1024 } // namespace ash 1055 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698