| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/common/wm_shell.h" | 5 #include "ash/common/wm_shell.h" |
| 6 #include "ash/test/ash_test_base.h" | 6 #include "ash/test/ash_test_base.h" |
| 7 #include "ui/events/base_event_utils.h" | 7 #include "ui/events/base_event_utils.h" |
| 8 #include "ui/events/event.h" | 8 #include "ui/events/event.h" |
| 9 #include "ui/events/test/event_generator.h" | 9 #include "ui/events/test/event_generator.h" |
| 10 #include "ui/views/pointer_watcher.h" | 10 #include "ui/views/pointer_watcher.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // Release: all (aura generates a capture event here). | 166 // Release: all (aura generates a capture event here). |
| 167 GetEventGenerator().ReleaseLeftButton(); | 167 GetEventGenerator().ReleaseLeftButton(); |
| 168 helper.ExpectCallCount(CAPTURE | PRESS_OR_RELEASE, CAPTURE | PRESS_OR_RELEASE, | 168 helper.ExpectCallCount(CAPTURE | PRESS_OR_RELEASE, CAPTURE | PRESS_OR_RELEASE, |
| 169 CAPTURE | PRESS_OR_RELEASE); | 169 CAPTURE | PRESS_OR_RELEASE); |
| 170 | 170 |
| 171 // Exit: none. | 171 // Exit: none. |
| 172 GetEventGenerator().SendMouseExit(); | 172 GetEventGenerator().SendMouseExit(); |
| 173 helper.ExpectCallCount(NONE, NONE, NONE); | 173 helper.ExpectCallCount(NONE, NONE, NONE); |
| 174 | 174 |
| 175 // Enter: none. | 175 // Enter: none. |
| 176 ui::MouseEvent enter_event(ui::ET_MOUSE_ENTERED, gfx::Point(), gfx::Point(), | 176 ui::MouseEvent enter_event( |
| 177 ui::EventTimeForNow(), 0, 0); | 177 ui::ET_MOUSE_ENTERED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), |
| 178 0, 0, ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 178 GetEventGenerator().Dispatch(&enter_event); | 179 GetEventGenerator().Dispatch(&enter_event); |
| 179 helper.ExpectCallCount(NONE, NONE, NONE); | 180 helper.ExpectCallCount(NONE, NONE, NONE); |
| 180 | 181 |
| 181 // Wheel: all | 182 // Wheel: all |
| 182 GetEventGenerator().MoveMouseWheel(10, 11); | 183 GetEventGenerator().MoveMouseWheel(10, 11); |
| 183 helper.ExpectCallCount(WHEEL, WHEEL, WHEEL); | 184 helper.ExpectCallCount(WHEEL, WHEEL, WHEEL); |
| 184 | 185 |
| 185 // Capture: all. | 186 // Capture: all. |
| 186 ui::MouseEvent capture_event(ui::ET_MOUSE_CAPTURE_CHANGED, gfx::Point(), | 187 ui::MouseEvent capture_event( |
| 187 gfx::Point(), ui::EventTimeForNow(), 0, 0); | 188 ui::ET_MOUSE_CAPTURE_CHANGED, gfx::Point(), gfx::Point(), |
| 189 ui::EventTimeForNow(), 0, 0, |
| 190 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 188 GetEventGenerator().Dispatch(&capture_event); | 191 GetEventGenerator().Dispatch(&capture_event); |
| 189 helper.ExpectCallCount(CAPTURE, CAPTURE, CAPTURE); | 192 helper.ExpectCallCount(CAPTURE, CAPTURE, CAPTURE); |
| 190 } | 193 } |
| 191 | 194 |
| 192 TEST_F(PointerWatcherAdapterTest, TouchEvents) { | 195 TEST_F(PointerWatcherAdapterTest, TouchEvents) { |
| 193 TestHelper helper; | 196 TestHelper helper; |
| 194 | 197 |
| 195 // Press: all. | 198 // Press: all. |
| 196 const int touch_id = 11; | 199 const int touch_id = 11; |
| 197 GetEventGenerator().PressTouchId(touch_id); | 200 GetEventGenerator().PressTouchId(touch_id); |
| 198 helper.ExpectCallCount(PRESS_OR_RELEASE, PRESS_OR_RELEASE, PRESS_OR_RELEASE); | 201 helper.ExpectCallCount(PRESS_OR_RELEASE, PRESS_OR_RELEASE, PRESS_OR_RELEASE); |
| 199 | 202 |
| 200 // Drag: only drag. | 203 // Drag: only drag. |
| 201 GetEventGenerator().MoveTouchId(gfx::Point(20, 30), touch_id); | 204 GetEventGenerator().MoveTouchId(gfx::Point(20, 30), touch_id); |
| 202 helper.ExpectCallCount(NONE, NONE, DRAG); | 205 helper.ExpectCallCount(NONE, NONE, DRAG); |
| 203 | 206 |
| 204 // Release: both (contrary to mouse above, touch does not implicitly generate | 207 // Release: both (contrary to mouse above, touch does not implicitly generate |
| 205 // capture). | 208 // capture). |
| 206 GetEventGenerator().ReleaseTouchId(touch_id); | 209 GetEventGenerator().ReleaseTouchId(touch_id); |
| 207 helper.ExpectCallCount(PRESS_OR_RELEASE, PRESS_OR_RELEASE, PRESS_OR_RELEASE); | 210 helper.ExpectCallCount(PRESS_OR_RELEASE, PRESS_OR_RELEASE, PRESS_OR_RELEASE); |
| 208 } | 211 } |
| 209 | 212 |
| 210 } // namespace ash | 213 } // namespace ash |
| OLD | NEW |