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. 4 5 #include "ui/aura/test/test_event_handler.h" 6 7 #include "ui/events/event.h" 8 9 namespace aura { 10 namespace test { 11 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 } 19 20 TestEventHandler::~TestEventHandler() {} 21 22 void TestEventHandler::Reset() { 23 num_key_events_ = 0; 24 num_mouse_events_ = 0; 25 num_scroll_events_ = 0; 26 num_touch_events_ = 0; 27 num_gesture_events_ = 0; 28 } 29 30 void TestEventHandler::OnKeyEvent(ui::KeyEvent* event) { 31 num_key_events_++; 32 event->SetHandled(); 33 } 34 35 void TestEventHandler::OnMouseEvent(ui::MouseEvent* event) { 36 num_mouse_events_++; 37 } 38 39 void TestEventHandler::OnScrollEvent(ui::ScrollEvent* event) { 40 num_scroll_events_++; 41 } 42 43 void TestEventHandler::OnTouchEvent(ui::TouchEvent* event) { 44 num_touch_events_++; 45 } 46 47 void TestEventHandler::OnGestureEvent(ui::GestureEvent* event) { 48 num_gesture_events_++; 49 } 50 51 } // namespace test 52 } // namespace aura 53