OLD | NEW |
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 "ui/base/accelerators/accelerator_manager.h" | 5 #include "ui/base/accelerators/accelerator_manager.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "ui/events/event_constants.h" | 9 #include "ui/events/event_constants.h" |
10 #include "ui/events/keycodes/keyboard_codes.h" | 10 #include "ui/events/keycodes/keyboard_codes.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 int accelerator_pressed_count() const { | 22 int accelerator_pressed_count() const { |
23 return accelerator_pressed_count_; | 23 return accelerator_pressed_count_; |
24 } | 24 } |
25 | 25 |
26 void set_accelerator_pressed_count(int accelerator_pressed_count) { | 26 void set_accelerator_pressed_count(int accelerator_pressed_count) { |
27 accelerator_pressed_count_ = accelerator_pressed_count; | 27 accelerator_pressed_count_ = accelerator_pressed_count; |
28 } | 28 } |
29 | 29 |
30 // Overridden from AcceleratorTarget: | 30 // Overridden from AcceleratorTarget: |
31 virtual bool AcceleratorPressed(const Accelerator& accelerator) OVERRIDE; | 31 virtual bool AcceleratorPressed(const Accelerator& accelerator) override; |
32 virtual bool CanHandleAccelerators() const OVERRIDE; | 32 virtual bool CanHandleAccelerators() const override; |
33 | 33 |
34 private: | 34 private: |
35 int accelerator_pressed_count_; | 35 int accelerator_pressed_count_; |
36 | 36 |
37 DISALLOW_COPY_AND_ASSIGN(TestTarget); | 37 DISALLOW_COPY_AND_ASSIGN(TestTarget); |
38 }; | 38 }; |
39 | 39 |
40 bool TestTarget::AcceleratorPressed(const Accelerator& accelerator) { | 40 bool TestTarget::AcceleratorPressed(const Accelerator& accelerator) { |
41 ++accelerator_pressed_count_; | 41 ++accelerator_pressed_count_; |
42 return true; | 42 return true; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 << text << ", " << test_text; // different modifiers | 174 << text << ", " << test_text; // different modifiers |
175 } | 175 } |
176 | 176 |
177 EXPECT_EQ(last_count + 1, target.accelerator_pressed_count()) << text; | 177 EXPECT_EQ(last_count + 1, target.accelerator_pressed_count()) << text; |
178 manager_.UnregisterAll(&target); | 178 manager_.UnregisterAll(&target); |
179 } | 179 } |
180 } | 180 } |
181 | 181 |
182 } // namespace test | 182 } // namespace test |
183 } // namespace ui | 183 } // namespace ui |
OLD | NEW |