Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / ui / events / test / test_event_handler.cc
blobf97aad5e4d3547eb18cccb567ec6c8aa5772c1b6
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
3 // found in the LICENSE file.
5 #include "ui/events/test/test_event_handler.h"
7 #include "ui/events/event.h"
9 namespace ui {
10 namespace test {
12 TestEventHandler::TestEventHandler()
13 : num_key_events_(0),
14 num_mouse_events_(0),
15 num_scroll_events_(0),
16 num_touch_events_(0),
17 num_gesture_events_(0),
18 recorder_(NULL),
19 handler_name_("unknown") {
22 TestEventHandler::~TestEventHandler() {}
24 void TestEventHandler::Reset() {
25 num_key_events_ = 0;
26 num_mouse_events_ = 0;
27 num_scroll_events_ = 0;
28 num_touch_events_ = 0;
29 num_gesture_events_ = 0;
32 void TestEventHandler::OnKeyEvent(KeyEvent* event) {
33 if (recorder_)
34 recorder_->push_back(handler_name_);
35 num_key_events_++;
36 event->SetHandled();
39 void TestEventHandler::OnMouseEvent(MouseEvent* event) {
40 if (recorder_)
41 recorder_->push_back(handler_name_);
42 num_mouse_events_++;
45 void TestEventHandler::OnScrollEvent(ScrollEvent* event) {
46 if (recorder_)
47 recorder_->push_back(handler_name_);
48 num_scroll_events_++;
51 void TestEventHandler::OnTouchEvent(TouchEvent* event) {
52 if (recorder_)
53 recorder_->push_back(handler_name_);
54 num_touch_events_++;
57 void TestEventHandler::OnGestureEvent(GestureEvent* event) {
58 if (recorder_)
59 recorder_->push_back(handler_name_);
60 num_gesture_events_++;
63 } // namespace test
64 } // namespace ui