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

Side by Side Diff: athena/input/accelerator_manager_unittest.cc

Issue 322503005: Athena's FocusManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « athena/input/accelerator_manager_impl.cc ('k') | athena/input/input_manager_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "athena/input/public/accelerator_manager.h" 5 #include "athena/input/public/accelerator_manager.h"
6 6
7 #include "athena/input/public/input_manager.h" 7 #include "athena/input/public/input_manager.h"
8 #include "athena/test/athena_test_base.h" 8 #include "athena/test/athena_test_base.h"
9 #include "ui/aura/test/event_generator.h" 9 #include "ui/aura/test/event_generator.h"
10 10
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 // Disable command. 90 // Disable command.
91 test_handler.set_enabled(false); 91 test_handler.set_enabled(false);
92 generator.PressKey(ui::VKEY_A, ui::EF_SHIFT_DOWN); 92 generator.PressKey(ui::VKEY_A, ui::EF_SHIFT_DOWN);
93 EXPECT_EQ(kInvalidCommandId, test_handler.GetFiredCommandIdAndReset()); 93 EXPECT_EQ(kInvalidCommandId, test_handler.GetFiredCommandIdAndReset());
94 test_handler.set_enabled(true); 94 test_handler.set_enabled(true);
95 generator.PressKey(ui::VKEY_A, ui::EF_SHIFT_DOWN); 95 generator.PressKey(ui::VKEY_A, ui::EF_SHIFT_DOWN);
96 EXPECT_EQ(COMMAND_A, test_handler.GetFiredCommandIdAndReset()); 96 EXPECT_EQ(COMMAND_A, test_handler.GetFiredCommandIdAndReset());
97 97
98 // Debug accelerators. 98 // Debug accelerators.
99 accelerator_manager->SetDebugAcceleratorsEnabled(false);
99 generator.PressKey(ui::VKEY_C, ui::EF_SHIFT_DOWN); 100 generator.PressKey(ui::VKEY_C, ui::EF_SHIFT_DOWN);
100 EXPECT_EQ(kInvalidCommandId, test_handler.GetFiredCommandIdAndReset()); 101 EXPECT_EQ(kInvalidCommandId, test_handler.GetFiredCommandIdAndReset());
101 102 accelerator_manager->SetDebugAcceleratorsEnabled(true);
102 accelerator_manager->EnableDebugAccelerators();
103 generator.PressKey(ui::VKEY_C, ui::EF_SHIFT_DOWN); 103 generator.PressKey(ui::VKEY_C, ui::EF_SHIFT_DOWN);
104 EXPECT_EQ(COMMAND_C, test_handler.GetFiredCommandIdAndReset()); 104 EXPECT_EQ(COMMAND_C, test_handler.GetFiredCommandIdAndReset());
105 accelerator_manager->SetDebugAcceleratorsEnabled(false);
105 106
106 // Non auto repeatable 107 // Non auto repeatable
107 generator.PressKey(ui::VKEY_D, ui::EF_SHIFT_DOWN); 108 generator.PressKey(ui::VKEY_D, ui::EF_SHIFT_DOWN);
108 EXPECT_EQ(COMMAND_D, test_handler.GetFiredCommandIdAndReset()); 109 EXPECT_EQ(COMMAND_D, test_handler.GetFiredCommandIdAndReset());
109 generator.PressKey(ui::VKEY_D, ui::EF_SHIFT_DOWN | ui::EF_IS_REPEAT); 110 generator.PressKey(ui::VKEY_D, ui::EF_SHIFT_DOWN | ui::EF_IS_REPEAT);
110 EXPECT_EQ(kInvalidCommandId, test_handler.GetFiredCommandIdAndReset()); 111 EXPECT_EQ(kInvalidCommandId, test_handler.GetFiredCommandIdAndReset());
111 112
112 // Non reserved accelerator won't be handled unless there is 113 // TODO(oshima): Add scenario where the key event is consumed by
113 // a view's focus manager. 114 // an app.
114 // TODO(oshima): Support view's focus manager. Investigate we can implement
115 // the non reserved behavior without view's focus manager.
116 generator.PressKey(ui::VKEY_E, ui::EF_SHIFT_DOWN); 115 generator.PressKey(ui::VKEY_E, ui::EF_SHIFT_DOWN);
117 EXPECT_EQ(kInvalidCommandId, test_handler.GetFiredCommandIdAndReset()); 116 EXPECT_EQ(COMMAND_E, test_handler.GetFiredCommandIdAndReset());
118 } 117 }
119 118
120 } // namespace athena 119 } // namespace athena
OLDNEW
« no previous file with comments | « athena/input/accelerator_manager_impl.cc ('k') | athena/input/input_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698