Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: ui/events/blink/web_input_event_traits_unittest.cc

Issue 2569273002: Add constructors to WebInputEvents and setters so we can work at cleaning up these public structs. (Closed)
Patch Set: Fix mouse up event sender not modifying modifiers Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/WebInputEvent.h" 8 #include "third_party/WebKit/public/platform/WebInputEvent.h"
9 9
10 using blink::WebGestureEvent; 10 using blink::WebGestureEvent;
11 using blink::WebInputEvent; 11 using blink::WebInputEvent;
12 using blink::WebKeyboardEvent; 12 using blink::WebKeyboardEvent;
13 using blink::WebMouseEvent; 13 using blink::WebMouseEvent;
14 using blink::WebMouseWheelEvent; 14 using blink::WebMouseWheelEvent;
15 using blink::WebTouchEvent; 15 using blink::WebTouchEvent;
16 16
17 namespace ui { 17 namespace ui {
18 namespace { 18 namespace {
19 19
20 using WebInputEventTraitsTest = testing::Test; 20 using WebInputEventTraitsTest = testing::Test;
21 21
22 // Very basic smoke test to ensure stringification doesn't explode. 22 // Very basic smoke test to ensure stringification doesn't explode.
23 TEST_F(WebInputEventTraitsTest, ToString) { 23 TEST_F(WebInputEventTraitsTest, ToString) {
24 WebKeyboardEvent key; 24 WebKeyboardEvent key(WebInputEvent::RawKeyDown, WebInputEvent::NoModifiers,
25 key.type = WebInputEvent::RawKeyDown; 25 WebInputEvent::TimeStampForTesting);
26 EXPECT_FALSE(WebInputEventTraits::ToString(key).empty()); 26 EXPECT_FALSE(WebInputEventTraits::ToString(key).empty());
27 27
28 WebMouseEvent mouse; 28 WebMouseEvent mouse(WebInputEvent::MouseMove, WebInputEvent::NoModifiers,
29 mouse.type = WebInputEvent::MouseMove; 29 WebInputEvent::TimeStampForTesting);
30 EXPECT_FALSE(WebInputEventTraits::ToString(mouse).empty()); 30 EXPECT_FALSE(WebInputEventTraits::ToString(mouse).empty());
31 31
32 WebMouseWheelEvent mouse_wheel; 32 WebMouseWheelEvent mouse_wheel(WebInputEvent::MouseWheel,
33 mouse_wheel.type = WebInputEvent::MouseWheel; 33 WebInputEvent::NoModifiers,
34 WebInputEvent::TimeStampForTesting);
34 EXPECT_FALSE(WebInputEventTraits::ToString(mouse_wheel).empty()); 35 EXPECT_FALSE(WebInputEventTraits::ToString(mouse_wheel).empty());
35 36
36 WebGestureEvent gesture; 37 WebGestureEvent gesture(WebInputEvent::GesturePinchBegin,
37 gesture.type = WebInputEvent::GesturePinchBegin; 38 WebInputEvent::NoModifiers,
39 WebInputEvent::TimeStampForTesting);
38 gesture.x = 1; 40 gesture.x = 1;
39 gesture.y = 1; 41 gesture.y = 1;
40 EXPECT_FALSE(WebInputEventTraits::ToString(gesture).empty()); 42 EXPECT_FALSE(WebInputEventTraits::ToString(gesture).empty());
41 43
42 WebTouchEvent touch; 44 WebTouchEvent touch(WebInputEvent::TouchStart, WebInputEvent::NoModifiers,
43 touch.type = WebInputEvent::TouchStart; 45 WebInputEvent::TimeStampForTesting);
44 touch.touchesLength = 1; 46 touch.touchesLength = 1;
45 EXPECT_FALSE(WebInputEventTraits::ToString(touch).empty()); 47 EXPECT_FALSE(WebInputEventTraits::ToString(touch).empty());
46 } 48 }
47 49
48 } // namespace 50 } // namespace
49 } // namespace ui 51 } // namespace ui
OLDNEW
« third_party/WebKit/public/platform/WebInputEvent.h ('K') | « ui/events/blink/web_input_event.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698