OLD | NEW |
---|---|
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 #include "ui/events/test/test_event_processor.h" | 5 #include "ui/events/test/test_event_processor.h" |
6 | 6 |
7 #include "ui/events/event_target.h" | 7 #include "ui/events/event_target.h" |
8 | 8 |
9 namespace ui { | 9 namespace ui { |
10 namespace test { | 10 namespace test { |
11 | 11 |
12 TestEventProcessor::TestEventProcessor() : num_times_processing_finished_(0) {} | 12 TestEventProcessor::TestEventProcessor() |
13 : should_processing_occur_(true), | |
14 num_times_processing_started_(0), | |
15 num_times_processing_finished_(0) { | |
16 } | |
17 | |
13 TestEventProcessor::~TestEventProcessor() {} | 18 TestEventProcessor::~TestEventProcessor() {} |
14 | 19 |
15 void TestEventProcessor::SetRoot(scoped_ptr<EventTarget> root) { | 20 void TestEventProcessor::SetRoot(scoped_ptr<EventTarget> root) { |
16 root_ = root.Pass(); | 21 root_ = root.Pass(); |
17 } | 22 } |
18 | 23 |
19 void TestEventProcessor::ResetCounts() { | 24 void TestEventProcessor::SetShouldProcessingOccur(bool occur) { |
sadrul
2014/09/25 16:12:01
set_should_processing_occur()?
tdanderson
2014/09/25 17:11:58
Done.
| |
25 should_processing_occur_ = occur; | |
26 } | |
27 | |
28 void TestEventProcessor::Reset() { | |
29 should_processing_occur_ = true; | |
30 num_times_processing_started_ = 0; | |
20 num_times_processing_finished_ = 0; | 31 num_times_processing_finished_ = 0; |
21 } | 32 } |
22 | 33 |
23 bool TestEventProcessor::CanDispatchToTarget(EventTarget* target) { | 34 bool TestEventProcessor::CanDispatchToTarget(EventTarget* target) { |
24 return true; | 35 return true; |
25 } | 36 } |
26 | 37 |
27 EventTarget* TestEventProcessor::GetRootTarget() { | 38 EventTarget* TestEventProcessor::GetRootTarget() { |
28 return root_.get(); | 39 return root_.get(); |
29 } | 40 } |
30 | 41 |
31 EventDispatchDetails TestEventProcessor::OnEventFromSource(Event* event) { | 42 EventDispatchDetails TestEventProcessor::OnEventFromSource(Event* event) { |
32 return EventProcessor::OnEventFromSource(event); | 43 return EventProcessor::OnEventFromSource(event); |
33 } | 44 } |
34 | 45 |
46 void TestEventProcessor::OnEventProcessingStarted(Event* event) { | |
47 num_times_processing_started_++; | |
48 if (!should_processing_occur_) | |
49 event->SetHandled(); | |
50 } | |
51 | |
35 void TestEventProcessor::OnEventProcessingFinished(Event* event) { | 52 void TestEventProcessor::OnEventProcessingFinished(Event* event) { |
36 num_times_processing_finished_++; | 53 num_times_processing_finished_++; |
37 } | 54 } |
38 | 55 |
39 } // namespace test | 56 } // namespace test |
40 } // namespace ui | 57 } // namespace ui |
OLD | NEW |