Index: ui/views/mus/window_manager_connection_unittest.cc |
diff --git a/ui/views/mus/window_manager_connection_unittest.cc b/ui/views/mus/window_manager_connection_unittest.cc |
index 967b5ad83d0f64a9593e3529092820ef1ca34cb9..8fe1f4b66cc40ca2ef8a7b194611f873303a308b 100644 |
--- a/ui/views/mus/window_manager_connection_unittest.cc |
+++ b/ui/views/mus/window_manager_connection_unittest.cc |
@@ -22,27 +22,51 @@ class TestPointerWatcher : public PointerWatcher { |
bool mouse_pressed() const { return mouse_pressed_; } |
bool touch_pressed() const { return touch_pressed_; } |
+ bool touch_released() const { return touch_released_; } |
+ bool touch_moved() const { return touch_moved_; } |
+ bool touch_cancelled() const { return touch_cancelled_; } |
void Reset() { |
mouse_pressed_ = false; |
touch_pressed_ = false; |
+ touch_released_ = false; |
+ touch_moved_ = false; |
+ touch_cancelled_ = false; |
} |
// PointerWatcher: |
- void OnMousePressed(const ui::MouseEvent& event, |
- const gfx::Point& location_in_screen, |
- Widget* target) override { |
+ void OnMousePressObserved(const ui::MouseEvent& event, |
+ const gfx::Point& location_in_screen, |
+ views::Widget* target) override { |
mouse_pressed_ = true; |
} |
- void OnTouchPressed(const ui::TouchEvent& event, |
- const gfx::Point& location_in_screen, |
- Widget* target) override { |
+ void OnTouchPressObserved(const ui::TouchEvent& event, |
+ const gfx::Point& location_in_screen, |
+ views::Widget* target) override { |
touch_pressed_ = true; |
} |
+ void OnTouchReleaseObserved(const ui::TouchEvent& event, |
+ const gfx::Point& location_in_screen, |
+ views::Widget* target) override { |
+ touch_released_ = true; |
+ } |
+ void OnTouchMoveObserved(const ui::TouchEvent& event, |
+ const gfx::Point& location_in_screen, |
+ views::Widget* target) override { |
+ touch_moved_ = true; |
+ } |
+ void OnTouchCancellObserved(const ui::TouchEvent& event, |
+ const gfx::Point& location_in_screen, |
+ views::Widget* target) override { |
+ touch_cancelled_ = true; |
+ } |
private: |
bool mouse_pressed_ = false; |
bool touch_pressed_ = false; |
+ bool touch_released_ = false; |
+ bool touch_moved_ = false; |
+ bool touch_cancelled_ = false; |
DISALLOW_COPY_AND_ASSIGN(TestPointerWatcher); |
}; |
@@ -71,6 +95,12 @@ TEST_F(WindowManagerConnectionTest, PointerWatcher) { |
base::TimeTicks(), ui::EF_NONE, 0); |
ui::TouchEvent touch_pressed(ui::ET_TOUCH_PRESSED, gfx::Point(), 1, |
base::TimeTicks()); |
+ ui::TouchEvent touch_released(ui::ET_TOUCH_RELEASED, gfx::Point(), 1, |
+ base::TimeTicks()); |
+ ui::TouchEvent touch_moved(ui::ET_TOUCH_MOVED, gfx::Point(), 1, |
+ base::TimeTicks()); |
+ ui::TouchEvent touch_cancelled(ui::ET_TOUCH_CANCELLED, gfx::Point(), 1, |
+ base::TimeTicks()); |
ui::KeyEvent key_pressed(ui::ET_KEY_PRESSED, ui::VKEY_A, 0); |
// PointerWatchers receive mouse events. |
@@ -85,6 +115,18 @@ TEST_F(WindowManagerConnectionTest, PointerWatcher) { |
EXPECT_TRUE(watcher1.touch_pressed()); |
watcher1.Reset(); |
+ OnEventObserved(touch_released); |
+ EXPECT_TRUE(watcher1.touch_released()); |
+ watcher1.Reset(); |
+ |
+ OnEventObserved(touch_moved); |
+ EXPECT_TRUE(watcher1.touch_moved()); |
+ watcher1.Reset(); |
+ |
+ OnEventObserved(touch_cancelled); |
+ EXPECT_TRUE(watcher1.touch_cancelled()); |
+ watcher1.Reset(); |
+ |
// PointerWatchers do not trigger for key events. |
OnEventObserved(key_pressed); |
EXPECT_FALSE(watcher1.mouse_pressed()); |