Avi Drissman | 3e1a26c | 2022-09-15 20:26:03 | [diff] [blame] | 1 | // Copyright 2018 The Chromium Authors |
Scott Violet | 1ab3530 | 2018-06-05 20:53:23 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "ui/base/accelerators/test_accelerator_target.h" |
| 6 | |
| 7 | namespace ui { |
| 8 | |
| 9 | TestAcceleratorTarget::TestAcceleratorTarget(bool accelerator_pressed_result) |
| 10 | : accelerator_pressed_result_(accelerator_pressed_result) {} |
| 11 | |
| 12 | TestAcceleratorTarget::~TestAcceleratorTarget() = default; |
| 13 | |
| 14 | void TestAcceleratorTarget::ResetCounts() { |
| 15 | accelerator_repeat_count_ = accelerator_count_ = 0; |
| 16 | } |
| 17 | |
| 18 | bool TestAcceleratorTarget::AcceleratorPressed( |
| 19 | const ui::Accelerator& accelerator) { |
| 20 | ++accelerator_count_; |
| 21 | if (accelerator.IsRepeat()) |
| 22 | accelerator_repeat_count_++; |
| 23 | return accelerator_pressed_result_; |
| 24 | } |
| 25 | |
| 26 | bool TestAcceleratorTarget::CanHandleAccelerators() const { |
| 27 | return can_handle_accelerators_; |
| 28 | } |
| 29 | |
| 30 | } // namespace ui |