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

Unified Diff: ui/aura/window_event_dispatcher_unittest.cc

Issue 2858633005: Add WindowEventDispatcherTest.TouchDownState for Env::is_touch_down(). (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b13935272fd4e1a5af37c23f3b60980292fb508e..3d4e153ca6ed61cb3eca7b448e3b23c377f4c875 100644
--- a/ui/aura/window_event_dispatcher_unittest.cc
+++ b/ui/aura/window_event_dispatcher_unittest.cc
@@ -165,6 +165,38 @@ TEST_P(WindowEventDispatcherTest, RepostEvent) {
EXPECT_TRUE(Env::GetInstance()->is_touch_down());
}
+// Check that we correctly track whether any touch devices are down in response
+// to touch press and release events with two WindowTreeHost.
+TEST_P(WindowEventDispatcherTest, TouchDownState) {
+ std::unique_ptr<WindowTreeHost> second_host(
+ WindowTreeHost::Create(gfx::Rect(20, 30, 100, 50)));
+ second_host->InitHost();
+ second_host->window()->Show();
+
+ ui::TouchEvent touch_pressed_event1(
+ ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), ui::EventTimeForNow(),
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
+ ui::TouchEvent touch_pressed_event2(
+ ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), ui::EventTimeForNow(),
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
+ ui::TouchEvent touch_released_event1(
+ ui::ET_TOUCH_RELEASED, gfx::Point(10, 10), ui::EventTimeForNow(),
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1));
+ ui::TouchEvent touch_released_event2(
+ ui::ET_TOUCH_RELEASED, gfx::Point(10, 10), ui::EventTimeForNow(),
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2));
+
+ EXPECT_FALSE(Env::GetInstance()->is_touch_down());
+ host()->dispatcher()->OnEventFromSource(&touch_pressed_event1);
+ EXPECT_TRUE(Env::GetInstance()->is_touch_down());
+ second_host->dispatcher()->OnEventFromSource(&touch_pressed_event2);
+ EXPECT_TRUE(Env::GetInstance()->is_touch_down());
+ host()->dispatcher()->OnEventFromSource(&touch_released_event1);
+ EXPECT_TRUE(Env::GetInstance()->is_touch_down());
+ second_host->dispatcher()->OnEventFromSource(&touch_released_event2);
+ EXPECT_FALSE(Env::GetInstance()->is_touch_down());
+}
+
// Check that we correctly track the state of the mouse buttons in response to
// button press and release events.
TEST_P(WindowEventDispatcherTest, MouseButtonState) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698