blob: 87ad7c9ffe5521968d19619a7069f7052f26309b [file] [log] [blame]
Avi Drissman3e1a26c2022-09-15 20:26:031// Copyright 2018 The Chromium Authors
Scott Violet1ab35302018-06-05 20:53:232// 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
7namespace ui {
8
9TestAcceleratorTarget::TestAcceleratorTarget(bool accelerator_pressed_result)
10 : accelerator_pressed_result_(accelerator_pressed_result) {}
11
12TestAcceleratorTarget::~TestAcceleratorTarget() = default;
13
14void TestAcceleratorTarget::ResetCounts() {
15 accelerator_repeat_count_ = accelerator_count_ = 0;
16}
17
18bool 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
26bool TestAcceleratorTarget::CanHandleAccelerators() const {
27 return can_handle_accelerators_;
28}
29
30} // namespace ui