Fix search results being clipped in app list.
[chromium-blink-merge.git] / ui / events / test / test_event_processor.h
blob569670ea080efa61b4366567a138abeb88a37913
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"
11 namespace ui {
12 namespace test {
14 class TestEventProcessor : public EventProcessor {
15 public:
16 TestEventProcessor();
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);
32 void Reset();
34 // EventProcessor:
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;
41 private:
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);
57 } // namespace test
58 } // namespace ui
60 #endif // UI_EVENTS_TEST_TEST_EVENT_PROCESSOR_H_