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

Unified Diff: ui/aura/root_window_unittest.cc

Issue 12088015: Add ability for EventGenerator to generate Scroll events asynchronously (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Free any leftover events in destructor Created 7 years, 11 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/aura/root_window.cc ('k') | ui/aura/test/event_generator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/root_window_unittest.cc
diff --git a/ui/aura/root_window_unittest.cc b/ui/aura/root_window_unittest.cc
index c6574f470f17c4207dcc229cfa989cd16454947e..3f51220747419eccca5875649a11ef1c5cedabfb 100644
--- a/ui/aura/root_window_unittest.cc
+++ b/ui/aura/root_window_unittest.cc
@@ -18,6 +18,7 @@
#include "ui/aura/window_tracker.h"
#include "ui/base/events/event.h"
#include "ui/base/events/event_handler.h"
+#include "ui/base/events/event_utils.h"
#include "ui/base/gestures/gesture_configuration.h"
#include "ui/base/hit_test.h"
#include "ui/base/keycodes/keyboard_codes.h"
@@ -370,6 +371,7 @@ TEST_F(RootWindowTest, TouchEventsOutsideBounds) {
// Tests that scroll events are dispatched correctly.
TEST_F(RootWindowTest, ScrollEventDispatch) {
+ base::TimeDelta now = ui::EventTimeForNow();
test::TestEventHandler* filter = new test::TestEventHandler;
root_window()->SetEventFilter(filter);
@@ -377,15 +379,15 @@ TEST_F(RootWindowTest, ScrollEventDispatch) {
scoped_ptr<Window> w1(CreateWindow(1, root_window(), &delegate));
w1->SetBounds(gfx::Rect(20, 20, 40, 40));
- // A scroll event on the root-window itself is not dispatched.
- ui::ScrollEvent scroll1(ui::ET_SCROLL, gfx::Point(10, 10), 0, 0, -10);
+ // A scroll event on the root-window itself is dispatched.
+ ui::ScrollEvent scroll1(ui::ET_SCROLL, gfx::Point(10, 10), now, 0, 0, -10, 2);
root_window()->AsRootWindowHostDelegate()->OnHostScrollEvent(&scroll1);
- EXPECT_EQ(0, filter->num_scroll_events());
+ EXPECT_EQ(1, filter->num_scroll_events());
// Scroll event on a window should be dispatched properly.
- ui::ScrollEvent scroll2(ui::ET_SCROLL, gfx::Point(25, 30), 0, -10, 0);
+ ui::ScrollEvent scroll2(ui::ET_SCROLL, gfx::Point(25, 30), now, 0, -10, 0, 2);
root_window()->AsRootWindowHostDelegate()->OnHostScrollEvent(&scroll2);
- EXPECT_EQ(1, filter->num_scroll_events());
+ EXPECT_EQ(2, filter->num_scroll_events());
}
namespace {
« no previous file with comments | « ui/aura/root_window.cc ('k') | ui/aura/test/event_generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698