OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/renderer_host/input/touch_emulator.h" | 5 #include "content/browser/renderer_host/input/touch_emulator.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 void ReleaseShift() { | 128 void ReleaseShift() { |
129 DCHECK(shift_pressed_); | 129 DCHECK(shift_pressed_); |
130 shift_pressed_ = false; | 130 shift_pressed_ = false; |
131 SendKeyboardEvent(WebInputEvent::KeyUp); | 131 SendKeyboardEvent(WebInputEvent::KeyUp); |
132 } | 132 } |
133 | 133 |
134 void SendMouseEvent(WebInputEvent::Type type, int x, int y) { | 134 void SendMouseEvent(WebInputEvent::Type type, int x, int y) { |
135 WebMouseEvent event; | 135 WebMouseEvent event; |
136 event.timeStampSeconds = GetNextEventTimeSeconds(); | 136 event.timeStampSeconds = GetNextEventTimeSeconds(); |
137 event.type = type; | 137 event.type = type; |
138 event.button = mouse_pressed_ ? WebMouseEvent::ButtonLeft : | 138 event.button = mouse_pressed_ ? WebMouseEvent::Button::Left : |
139 WebMouseEvent::ButtonNone; | 139 WebMouseEvent::Button::NoButton; |
140 event.modifiers = modifiers(); | 140 event.modifiers = modifiers(); |
141 last_mouse_x_ = x; | 141 last_mouse_x_ = x; |
142 last_mouse_y_ = y; | 142 last_mouse_y_ = y; |
143 event.x = event.windowX = event.globalX = x; | 143 event.x = event.windowX = event.globalX = x; |
144 event.y = event.windowY = event.globalY = y; | 144 event.y = event.windowY = event.globalY = y; |
145 emulator()->HandleMouseEvent(event); | 145 emulator()->HandleMouseEvent(event); |
146 } | 146 } |
147 | 147 |
148 bool SendMouseWheelEvent() { | 148 bool SendMouseWheelEvent() { |
149 WebMouseWheelEvent event; | 149 WebMouseWheelEvent event; |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 emulator()->Disable(); | 563 emulator()->Disable(); |
564 EXPECT_EQ("TouchStart TouchCancel", ExpectedEvents()); | 564 EXPECT_EQ("TouchStart TouchCancel", ExpectedEvents()); |
565 emulator()->CancelTouch(); | 565 emulator()->CancelTouch(); |
566 } | 566 } |
567 | 567 |
568 TEST_F(TouchEmulatorTest, ConstructorWithHighDeviceScaleDoesNotCrash) { | 568 TEST_F(TouchEmulatorTest, ConstructorWithHighDeviceScaleDoesNotCrash) { |
569 TouchEmulator(this, 4.0f); | 569 TouchEmulator(this, 4.0f); |
570 } | 570 } |
571 | 571 |
572 } // namespace content | 572 } // namespace content |
OLD | NEW |