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.
5 #ifndef UI_EVENTS_TEST_TEST_EVENT_PROCESSOR_H_
6 #define UI_EVENTS_TEST_TEST_EVENT_PROCESSOR_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "ui/events/event_processor.h"
14 class TestEventProcessor
: public EventProcessor
{
17 ~TestEventProcessor() override
;
19 int num_times_processing_started() const {
20 return num_times_processing_started_
;
23 int num_times_processing_finished() const {
24 return num_times_processing_finished_
;
27 void set_should_processing_occur(bool occur
) {
28 should_processing_occur_
= occur
;
31 void SetRoot(scoped_ptr
<EventTarget
> root
);
35 bool CanDispatchToTarget(EventTarget
* target
) override
;
36 EventTarget
* GetRootTarget() override
;
37 EventDispatchDetails
OnEventFromSource(Event
* event
) override
;
38 void OnEventProcessingStarted(Event
* event
) override
;
39 void OnEventProcessingFinished(Event
* event
) override
;
42 scoped_ptr
<EventTarget
> root_
;
44 // Used in our override of OnEventProcessingStarted(). If this value is
45 // false, mark incoming events as handled.
46 bool should_processing_occur_
;
48 // Counts the number of times OnEventProcessingStarted() has been called.
49 int num_times_processing_started_
;
51 // Counts the number of times OnEventProcessingFinished() has been called.
52 int num_times_processing_finished_
;
54 DISALLOW_COPY_AND_ASSIGN(TestEventProcessor
);
60 #endif // UI_EVENTS_TEST_TEST_EVENT_PROCESSOR_H_