1 // Copyright 2013 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 #ifndef UI_EVENTS_TEST_TEST_EVENT_PROCESSOR_H_ 6 #define UI_EVENTS_TEST_TEST_EVENT_PROCESSOR_H_ 7 8 #include "base/memory/scoped_ptr.h" 9 #include "ui/events/event_processor.h" 10 11 namespace ui { 12 namespace test { 13 14 class TestEventProcessor : public EventProcessor { 15 public: 16 TestEventProcessor(); 17 virtual ~TestEventProcessor(); 18 num_times_processing_finished()19 int num_times_processing_finished() const { 20 return num_times_processing_finished_; 21 } 22 23 void SetRoot(scoped_ptr<EventTarget> root); 24 void ResetCounts(); 25 26 // EventProcessor: 27 virtual bool CanDispatchToTarget(EventTarget* target) OVERRIDE; 28 virtual EventTarget* GetRootTarget() OVERRIDE; 29 virtual EventDispatchDetails OnEventFromSource(Event* event) OVERRIDE; 30 virtual void OnEventProcessingFinished(Event* event) OVERRIDE; 31 32 private: 33 scoped_ptr<EventTarget> root_; 34 35 // Counts the number of times OnEventProcessingFinished() has been called. 36 int num_times_processing_finished_; 37 38 DISALLOW_COPY_AND_ASSIGN(TestEventProcessor); 39 }; 40 41 } // namespace test 42 } // namespace ui 43 44 #endif // UI_EVENTS_TEST_TEST_EVENT_PROCESSOR_H_ 45