Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Side by Side Diff: ui/events/test/test_event_processor.h

Issue 552503003: Introduce EventProcessor::OnEventProcessingStarted() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sadrul comments addressed Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/events/event_processor_unittest.cc ('k') | ui/events/test/test_event_processor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_EVENTS_TEST_TEST_EVENT_PROCESSOR_H_ 5 #ifndef UI_EVENTS_TEST_TEST_EVENT_PROCESSOR_H_
6 #define UI_EVENTS_TEST_TEST_EVENT_PROCESSOR_H_ 6 #define UI_EVENTS_TEST_TEST_EVENT_PROCESSOR_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "ui/events/event_processor.h" 9 #include "ui/events/event_processor.h"
10 10
11 namespace ui { 11 namespace ui {
12 namespace test { 12 namespace test {
13 13
14 class TestEventProcessor : public EventProcessor { 14 class TestEventProcessor : public EventProcessor {
15 public: 15 public:
16 TestEventProcessor(); 16 TestEventProcessor();
17 virtual ~TestEventProcessor(); 17 virtual ~TestEventProcessor();
18 18
19 int num_times_processing_started() const {
20 return num_times_processing_started_;
21 }
22
19 int num_times_processing_finished() const { 23 int num_times_processing_finished() const {
20 return num_times_processing_finished_; 24 return num_times_processing_finished_;
21 } 25 }
22 26
27 void set_should_processing_occur(bool occur) {
28 should_processing_occur_ = occur;
29 }
30
23 void SetRoot(scoped_ptr<EventTarget> root); 31 void SetRoot(scoped_ptr<EventTarget> root);
24 void ResetCounts(); 32 void Reset();
25 33
26 // EventProcessor: 34 // EventProcessor:
27 virtual bool CanDispatchToTarget(EventTarget* target) OVERRIDE; 35 virtual bool CanDispatchToTarget(EventTarget* target) OVERRIDE;
28 virtual EventTarget* GetRootTarget() OVERRIDE; 36 virtual EventTarget* GetRootTarget() OVERRIDE;
29 virtual EventDispatchDetails OnEventFromSource(Event* event) OVERRIDE; 37 virtual EventDispatchDetails OnEventFromSource(Event* event) OVERRIDE;
38 virtual void OnEventProcessingStarted(Event* event) OVERRIDE;
30 virtual void OnEventProcessingFinished(Event* event) OVERRIDE; 39 virtual void OnEventProcessingFinished(Event* event) OVERRIDE;
31 40
32 private: 41 private:
33 scoped_ptr<EventTarget> root_; 42 scoped_ptr<EventTarget> root_;
34 43
44 // Used in our override of OnEventProcessingStarted(). If this value is
45 // false, mark incoming events as handled.
46 bool should_processing_occur_;
47
48 // Counts the number of times OnEventProcessingStarted() has been called.
49 int num_times_processing_started_;
50
35 // Counts the number of times OnEventProcessingFinished() has been called. 51 // Counts the number of times OnEventProcessingFinished() has been called.
36 int num_times_processing_finished_; 52 int num_times_processing_finished_;
37 53
38 DISALLOW_COPY_AND_ASSIGN(TestEventProcessor); 54 DISALLOW_COPY_AND_ASSIGN(TestEventProcessor);
39 }; 55 };
40 56
41 } // namespace test 57 } // namespace test
42 } // namespace ui 58 } // namespace ui
43 59
44 #endif // UI_EVENTS_TEST_TEST_EVENT_PROCESSOR_H_ 60 #endif // UI_EVENTS_TEST_TEST_EVENT_PROCESSOR_H_
OLDNEW
« no previous file with comments | « ui/events/event_processor_unittest.cc ('k') | ui/events/test/test_event_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698