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

Unified Diff: ui/events/event_processor_unittest.cc

Issue 533323004: Remove RootView::DispatchGestureEvent() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test added, member name changed Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/event_processor.cc ('k') | ui/events/test/test_event_processor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {}
« no previous file with comments | « ui/events/event_processor.cc ('k') | ui/events/test/test_event_processor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698