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> |
11 | 11 |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "content/browser/renderer_host/input/touch_emulator_client.h" | 14 #include "content/browser/renderer_host/input/touch_emulator_client.h" |
15 #include "content/common/input/web_input_event_traits.h" | |
16 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "ui/events/blink/web_input_event_traits.h" |
17 | 17 |
18 using blink::WebGestureEvent; | 18 using blink::WebGestureEvent; |
19 using blink::WebInputEvent; | 19 using blink::WebInputEvent; |
20 using blink::WebKeyboardEvent; | 20 using blink::WebKeyboardEvent; |
21 using blink::WebMouseEvent; | 21 using blink::WebMouseEvent; |
22 using blink::WebMouseWheelEvent; | 22 using blink::WebMouseWheelEvent; |
23 using blink::WebTouchEvent; | 23 using blink::WebTouchEvent; |
24 using blink::WebTouchPoint; | 24 using blink::WebTouchPoint; |
25 | 25 |
26 namespace content { | 26 namespace content { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 int modifiers() const { | 89 int modifiers() const { |
90 return (shift_pressed_ ? WebInputEvent::ShiftKey : 0) | | 90 return (shift_pressed_ ? WebInputEvent::ShiftKey : 0) | |
91 (mouse_pressed_ ? WebInputEvent::LeftButtonDown : 0); | 91 (mouse_pressed_ ? WebInputEvent::LeftButtonDown : 0); |
92 } | 92 } |
93 | 93 |
94 std::string ExpectedEvents() { | 94 std::string ExpectedEvents() { |
95 std::string result; | 95 std::string result; |
96 for (size_t i = 0; i < forwarded_events_.size(); ++i) { | 96 for (size_t i = 0; i < forwarded_events_.size(); ++i) { |
97 if (i != 0) | 97 if (i != 0) |
98 result += " "; | 98 result += " "; |
99 result += WebInputEventTraits::GetName(forwarded_events_[i]); | 99 result += ui::WebInputEventTraits::GetName(forwarded_events_[i]); |
100 } | 100 } |
101 forwarded_events_.clear(); | 101 forwarded_events_.clear(); |
102 return result; | 102 return result; |
103 } | 103 } |
104 | 104 |
105 double GetNextEventTimeSeconds() { | 105 double GetNextEventTimeSeconds() { |
106 last_event_time_seconds_ += event_time_delta_seconds_; | 106 last_event_time_seconds_ += event_time_delta_seconds_; |
107 return last_event_time_seconds_; | 107 return last_event_time_seconds_; |
108 } | 108 } |
109 | 109 |
(...skipping 453 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 |