| Index: ui/events/event_processor_unittest.cc
|
| diff --git a/ui/events/event_processor_unittest.cc b/ui/events/event_processor_unittest.cc
|
| index 8ccbd779af0a4126533b52ae28e228b1a8637143..c8b20229354c93e807b07628e576dd7c512561cf 100644
|
| --- a/ui/events/event_processor_unittest.cc
|
| +++ b/ui/events/event_processor_unittest.cc
|
| @@ -25,6 +25,7 @@ class EventProcessorTest : public testing::Test {
|
| // testing::Test:
|
| virtual void SetUp() OVERRIDE {
|
| processor_.SetRoot(scoped_ptr<EventTarget>(new TestEventTarget()));
|
| + processor_.ResetCounts();
|
| root()->SetEventTargeter(make_scoped_ptr(new EventTargeter()));
|
| }
|
|
|
| @@ -32,6 +33,10 @@ class EventProcessorTest : public testing::Test {
|
| return static_cast<TestEventTarget*>(processor_.GetRootTarget());
|
| }
|
|
|
| + TestEventProcessor* processor() {
|
| + return &processor_;
|
| + }
|
| +
|
| void DispatchEvent(Event* event) {
|
| processor_.OnEventFromSource(event);
|
| }
|
| @@ -257,6 +262,24 @@ TEST_F(EventProcessorTest, NestedEventProcessing) {
|
| EXPECT_TRUE(mouse2.handled());
|
| }
|
|
|
| +// Verifies that OnEventProcessingFinished() is called when an event
|
| +// has been handled.
|
| +TEST_F(EventProcessorTest, OnEventProcessingFinished) {
|
| + scoped_ptr<TestEventTarget> child(new TestEventTarget());
|
| + child->set_mark_events_as_handled(true);
|
| + root()->AddChild(child.Pass());
|
| +
|
| + // Dispatch a mouse event. We expect the event to be seen by the target,
|
| + // handled, and we expect OnEventProcessingFinished() to be invoked once.
|
| + MouseEvent mouse(ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10),
|
| + EF_NONE, EF_NONE);
|
| + DispatchEvent(&mouse);
|
| + EXPECT_TRUE(root()->child_at(0)->DidReceiveEvent(ET_MOUSE_MOVED));
|
| + EXPECT_FALSE(root()->DidReceiveEvent(ET_MOUSE_MOVED));
|
| + EXPECT_TRUE(mouse.handled());
|
| + EXPECT_EQ(1, processor()->num_times_processing_finished());
|
| +}
|
| +
|
| class IgnoreEventTargeter : public EventTargeter {
|
| public:
|
| IgnoreEventTargeter() {}
|
|
|