Index: ui/aura/window_event_dispatcher_unittest.cc |
diff --git a/ui/aura/window_event_dispatcher_unittest.cc b/ui/aura/window_event_dispatcher_unittest.cc |
index 3f412b25120b6416a46f46e518597c3990633e77..c8ae024b1bd2ce693ccb5b29085b83ab824820e7 100644 |
--- a/ui/aura/window_event_dispatcher_unittest.cc |
+++ b/ui/aura/window_event_dispatcher_unittest.cc |
@@ -142,15 +142,22 @@ TEST_F(WindowEventDispatcherTest, OnHostMouseEvent) { |
} |
TEST_F(WindowEventDispatcherTest, RepostEvent) { |
- // Test RepostEvent in RootWindow. It only works for Mouse Press. |
+ // Test RepostEvent in RootWindow. It only works for Mouse Press and touch |
+ // press. |
EXPECT_FALSE(Env::GetInstance()->IsMouseButtonDown()); |
gfx::Point point(10, 10); |
ui::MouseEvent event(ui::ET_MOUSE_PRESSED, point, point, |
ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, |
ui::EF_LEFT_MOUSE_BUTTON); |
- host()->dispatcher()->RepostEvent(event); |
+ host()->dispatcher()->RepostEvent(&event); |
RunAllPendingInMessageLoop(); |
EXPECT_TRUE(Env::GetInstance()->IsMouseButtonDown()); |
+ |
+ ui::TouchEvent touch_pressed_event( |
+ ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, ui::EventTimeForNow()); |
+ host()->dispatcher()->RepostEvent(&touch_pressed_event); |
+ RunAllPendingInMessageLoop(); |
+ EXPECT_TRUE(Env::GetInstance()->is_touch_down()); |
} |
// Check that we correctly track the state of the mouse buttons in response to |
@@ -634,7 +641,7 @@ TEST_F(WindowEventDispatcherTest, MAYBE(RepostTargetsCaptureWindow)) { |
const ui::MouseEvent press_event( |
ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), |
ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); |
- host()->dispatcher()->RepostEvent(press_event); |
+ host()->dispatcher()->RepostEvent(&press_event); |
RunAllPendingInMessageLoop(); // Necessitated by RepostEvent(). |
// Mouse moves/enters may be generated. We only care about a pressed. |
EXPECT_TRUE(EventTypesToString(recorder.events()).find("MOUSE_PRESSED") != |
@@ -1419,7 +1426,7 @@ TEST_F(WindowEventDispatcherTest, RepostTapdownGestureTest) { |
0, |
ui::EventTimeForNow(), |
details); |
- host()->dispatcher()->RepostEvent(event); |
+ host()->dispatcher()->RepostEvent(&event); |
RunAllPendingInMessageLoop(); |
// TODO(rbyers): Currently disabled - crbug.com/170987 |
EXPECT_FALSE(EventTypesToString(recorder.events()).find("GESTURE_TAP_DOWN") != |
@@ -1457,7 +1464,7 @@ class RepostGestureEventRecorder : public EventFilterRecorder { |
if (!reposted_) { |
EXPECT_NE(repost_target_, event->target()); |
reposted_ = true; |
- repost_target_->GetHost()->dispatcher()->RepostEvent(*event); |
+ repost_target_->GetHost()->dispatcher()->RepostEvent(event); |
// Ensure that the reposted gesture event above goes to the |
// repost_target_; |
repost_source_->GetRootWindow()->RemoveChild(repost_source_); |
@@ -1720,7 +1727,7 @@ class DontResetHeldEventWindowDelegate : public test::TestWindowDelegate { |
ui::MouseEvent mouse_event(ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), |
gfx::Point(10, 10), ui::EventTimeForNow(), |
ui::EF_SHIFT_DOWN, 0); |
- root_->GetHost()->dispatcher()->RepostEvent(mouse_event); |
+ root_->GetHost()->dispatcher()->RepostEvent(&mouse_event); |
} |
} |
@@ -1745,7 +1752,7 @@ TEST_F(WindowEventDispatcherTest, DontResetHeldEvent) { |
ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), |
gfx::Point(10, 10), ui::EventTimeForNow(), |
ui::EF_SHIFT_DOWN, 0); |
- root_window()->GetHost()->dispatcher()->RepostEvent(pressed); |
+ root_window()->GetHost()->dispatcher()->RepostEvent(&pressed); |
ui::MouseEvent pressed2(ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), |
gfx::Point(10, 10), ui::EventTimeForNow(), 0, 0); |
// Dispatch an event to flush event scheduled by way of RepostEvent(). |
@@ -1806,7 +1813,7 @@ TEST_F(WindowEventDispatcherTest, DeleteHostFromHeldMouseEvent) { |
ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), |
gfx::Point(10, 10), ui::EventTimeForNow(), |
ui::EF_SHIFT_DOWN, 0); |
- h2->dispatcher()->RepostEvent(pressed); |
+ h2->dispatcher()->RepostEvent(&pressed); |
// RunAllPendingInMessageLoop() to make sure the |pressed| is run. |
RunAllPendingInMessageLoop(); |
EXPECT_TRUE(delegate.got_mouse_event()); |
@@ -2046,7 +2053,7 @@ class WindowEventDispatcherTestWithMessageLoop |
// Used to avoid a copying |event| when binding to a closure. |
static void RepostEventHelper(WindowEventDispatcher* dispatcher, |
scoped_ptr<ui::MouseEvent> event) { |
- dispatcher->RepostEvent(*event); |
+ dispatcher->RepostEvent(event.get()); |
} |
scoped_ptr<Window> window_; |
@@ -2207,7 +2214,7 @@ TEST_F(WindowEventDispatcherTestInHighDPI, |
new ui::MouseEvent(ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), |
gfx::Point(10, 10), ui::EventTimeForNow(), |
ui::EF_RIGHT_MOUSE_BUTTON, ui::EF_RIGHT_MOUSE_BUTTON)); |
- host()->dispatcher()->RepostEvent(*mouse); |
+ host()->dispatcher()->RepostEvent(mouse.get()); |
EXPECT_EQ(0, handler.num_mouse_events()); |
base::RunLoop run_loop; |