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

Unified Diff: services/ui/public/cpp/tests/window_tree_client_unittest.cc

Issue 2248263003: Updates PointerEventRouter to handle switching move type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge again Created 4 years, 4 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
Index: services/ui/public/cpp/tests/window_tree_client_unittest.cc
diff --git a/services/ui/public/cpp/tests/window_tree_client_unittest.cc b/services/ui/public/cpp/tests/window_tree_client_unittest.cc
index 10dcf996f2f6e09f7346daf0689c24770aa8ce6a..b05ba4317de2a33bf9b46fcd3f2bda78224a6979 100644
--- a/services/ui/public/cpp/tests/window_tree_client_unittest.cc
+++ b/services/ui/public/cpp/tests/window_tree_client_unittest.cc
@@ -97,10 +97,6 @@ class WindowTreeSetup {
: *client()->GetRoots().begin();
}
- uint32_t GetPointerWatcherId() {
- return WindowTreeClientPrivate(&tree_client_).pointer_watcher_id();
- }
-
private:
TestWindowTree window_tree_;
TestWindowTreeClientDelegate window_tree_delegate_;
@@ -479,13 +475,12 @@ TEST_F(WindowTreeClientTest, OnPointerEventObserved) {
setup.client()->StartPointerWatcher(false /* want_moves */);
// Simulate the server sending an observed event.
- uint32_t pointer_watcher_id = setup.GetPointerWatcherId();
std::unique_ptr<ui::PointerEvent> pointer_event_down(new ui::PointerEvent(
ui::ET_POINTER_DOWN, gfx::Point(), gfx::Point(), ui::EF_CONTROL_DOWN, 1,
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH),
base::TimeTicks()));
setup.window_tree_client()->OnPointerEventObserved(
- std::move(pointer_event_down), pointer_watcher_id, 0u);
+ std::move(pointer_event_down), 0u);
// Delegate sensed the event.
ui::Event* last_event = setup.window_tree_delegate()->last_event_observed();
@@ -502,7 +497,7 @@ TEST_F(WindowTreeClientTest, OnPointerEventObserved) {
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH),
base::TimeTicks()));
setup.window_tree_client()->OnPointerEventObserved(
- std::move(pointer_event_up), pointer_watcher_id, 0u);
+ std::move(pointer_event_up), 0u);
// No event was sensed.
EXPECT_FALSE(setup.window_tree_delegate()->last_event_observed());
@@ -518,13 +513,12 @@ TEST_F(WindowTreeClientTest, OnWindowInputEventWithPointerWatcher) {
setup.client()->StartPointerWatcher(false /* want_moves */);
// Simulate the server dispatching an event that also matched the observer.
- uint32_t pointer_watcher_id = setup.GetPointerWatcherId();
std::unique_ptr<ui::PointerEvent> pointer_event_down(new ui::PointerEvent(
ui::ET_POINTER_DOWN, gfx::Point(), gfx::Point(), ui::EF_CONTROL_DOWN, 1,
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH),
base::TimeTicks()));
setup.window_tree_client()->OnWindowInputEvent(
- 1, server_id(root), std::move(pointer_event_down), pointer_watcher_id);
+ 1, server_id(root), std::move(pointer_event_down), true);
// Delegate sensed the event.
ui::Event* last_event = setup.window_tree_delegate()->last_event_observed();
@@ -532,47 +526,6 @@ TEST_F(WindowTreeClientTest, OnWindowInputEventWithPointerWatcher) {
EXPECT_EQ(ui::EF_CONTROL_DOWN, last_event->flags());
}
-// Tests that replacing a pointer watcher with a new one that has different
-// |want_moves| values results in only new events being observed.
-TEST_F(WindowTreeClientTest, PointerWatcherReplaced) {
- WindowTreeSetup setup;
- Window* root = setup.GetFirstRoot();
- ASSERT_TRUE(root);
-
- // Start a pointer watcher for all events excluding move events.
- setup.client()->StartPointerWatcher(false /* want_moves */);
- uint32_t pointer_watcher_id1 = setup.GetPointerWatcherId();
-
- // Replace it with a second watcher that also watches for move events.
- setup.client()->StartPointerWatcher(true /* want_moves */);
- uint32_t pointer_watcher_id2 = setup.GetPointerWatcherId();
-
- // Simulate the server sending an observed event that matched the old watcher
- // (e.g. that was in-flight when the observer was replaced).
- std::unique_ptr<ui::PointerEvent> pointer_event_down(new ui::PointerEvent(
- ui::ET_POINTER_DOWN, gfx::Point(), gfx::Point(), ui::EF_CONTROL_DOWN, 1,
- ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH),
- base::TimeTicks()));
- setup.window_tree_client()->OnPointerEventObserved(
- std::move(pointer_event_down), pointer_watcher_id1, 0u);
-
- // The event was not sensed, because it does not match the current watcher.
- EXPECT_FALSE(setup.window_tree_delegate()->last_event_observed());
-
- // Simulate another event that matches the new watcher.
- std::unique_ptr<ui::PointerEvent> pointer_event_move(new ui::PointerEvent(
- ui::ET_POINTER_MOVED, gfx::Point(), gfx::Point(), ui::EF_CONTROL_DOWN, 1,
- ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH),
- base::TimeTicks()));
- setup.window_tree_client()->OnPointerEventObserved(
- std::move(pointer_event_move), pointer_watcher_id2, 0u);
-
- // The delegate sensed the event.
- ui::Event* last_event = setup.window_tree_delegate()->last_event_observed();
- EXPECT_EQ(ui::ET_POINTER_MOVED, last_event->type());
- EXPECT_EQ(ui::EF_CONTROL_DOWN, last_event->flags());
-}
-
// Verifies focus is reverted if the server replied that the change failed.
TEST_F(WindowTreeClientTest, SetFocusFailed) {
WindowTreeSetup setup;
« no previous file with comments | « services/ui/public/cpp/tests/window_tree_client_private.cc ('k') | services/ui/public/cpp/window_tree_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698