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 "ui/events/blink/web_input_event_traits.h" | 5 #include "ui/events/blink/web_input_event_traits.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "third_party/WebKit/public/platform/WebGestureEvent.h" | 8 #include "third_party/WebKit/public/platform/WebGestureEvent.h" |
9 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 9 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
10 #include "third_party/WebKit/public/platform/WebMouseWheelEvent.h" | 10 #include "third_party/WebKit/public/platform/WebMouseWheelEvent.h" |
11 | 11 |
12 using blink::WebGestureEvent; | 12 using blink::WebGestureEvent; |
13 using blink::WebInputEvent; | 13 using blink::WebInputEvent; |
14 using blink::WebKeyboardEvent; | 14 using blink::WebKeyboardEvent; |
15 using blink::WebMouseEvent; | 15 using blink::WebMouseEvent; |
16 using blink::WebMouseWheelEvent; | 16 using blink::WebMouseWheelEvent; |
17 using blink::WebTouchEvent; | 17 using blink::WebTouchEvent; |
18 | 18 |
19 namespace ui { | 19 namespace ui { |
20 namespace { | 20 namespace { |
21 | 21 |
22 using WebInputEventTraitsTest = testing::Test; | 22 using WebInputEventTraitsTest = testing::Test; |
23 | 23 |
24 // Very basic smoke test to ensure stringification doesn't explode. | 24 // Very basic smoke test to ensure stringification doesn't explode. |
25 TEST_F(WebInputEventTraitsTest, ToString) { | 25 TEST_F(WebInputEventTraitsTest, ToString) { |
26 WebKeyboardEvent key; | 26 WebKeyboardEvent key(WebInputEvent::RawKeyDown, WebInputEvent::NoModifiers, |
27 key.type = WebInputEvent::RawKeyDown; | 27 WebInputEvent::TimeStampForTesting); |
28 EXPECT_FALSE(WebInputEventTraits::ToString(key).empty()); | 28 EXPECT_FALSE(WebInputEventTraits::ToString(key).empty()); |
29 | 29 |
30 WebMouseEvent mouse; | 30 WebMouseEvent mouse(WebInputEvent::MouseMove, WebInputEvent::NoModifiers, |
31 mouse.type = WebInputEvent::MouseMove; | 31 WebInputEvent::TimeStampForTesting); |
32 EXPECT_FALSE(WebInputEventTraits::ToString(mouse).empty()); | 32 EXPECT_FALSE(WebInputEventTraits::ToString(mouse).empty()); |
33 | 33 |
34 WebMouseWheelEvent mouse_wheel; | 34 WebMouseWheelEvent mouse_wheel(WebInputEvent::MouseWheel, |
35 mouse_wheel.type = WebInputEvent::MouseWheel; | 35 WebInputEvent::NoModifiers, |
| 36 WebInputEvent::TimeStampForTesting); |
36 EXPECT_FALSE(WebInputEventTraits::ToString(mouse_wheel).empty()); | 37 EXPECT_FALSE(WebInputEventTraits::ToString(mouse_wheel).empty()); |
37 | 38 |
38 WebGestureEvent gesture; | 39 WebGestureEvent gesture(WebInputEvent::GesturePinchBegin, |
39 gesture.type = WebInputEvent::GesturePinchBegin; | 40 WebInputEvent::NoModifiers, |
| 41 WebInputEvent::TimeStampForTesting); |
40 gesture.x = 1; | 42 gesture.x = 1; |
41 gesture.y = 1; | 43 gesture.y = 1; |
42 EXPECT_FALSE(WebInputEventTraits::ToString(gesture).empty()); | 44 EXPECT_FALSE(WebInputEventTraits::ToString(gesture).empty()); |
43 | 45 |
44 WebTouchEvent touch; | 46 WebTouchEvent touch(WebInputEvent::TouchStart, WebInputEvent::NoModifiers, |
45 touch.type = WebInputEvent::TouchStart; | 47 WebInputEvent::TimeStampForTesting); |
46 touch.touchesLength = 1; | 48 touch.touchesLength = 1; |
47 EXPECT_FALSE(WebInputEventTraits::ToString(touch).empty()); | 49 EXPECT_FALSE(WebInputEventTraits::ToString(touch).empty()); |
48 } | 50 } |
49 | 51 |
50 } // namespace | 52 } // namespace |
51 } // namespace ui | 53 } // namespace ui |
OLD | NEW |