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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 void ForwardEmulatedGestureEvent( | 56 void ForwardEmulatedGestureEvent( |
57 const blink::WebGestureEvent& event) override { | 57 const blink::WebGestureEvent& event) override { |
58 forwarded_events_.push_back(event.type); | 58 forwarded_events_.push_back(event.type); |
59 } | 59 } |
60 | 60 |
61 void ForwardEmulatedTouchEvent(const blink::WebTouchEvent& event) override { | 61 void ForwardEmulatedTouchEvent(const blink::WebTouchEvent& event) override { |
62 forwarded_events_.push_back(event.type); | 62 forwarded_events_.push_back(event.type); |
63 EXPECT_EQ(1U, event.touchesLength); | 63 EXPECT_EQ(1U, event.touchesLength); |
64 EXPECT_EQ(last_mouse_x_, event.touches[0].position.x); | 64 EXPECT_EQ(last_mouse_x_, event.touches[0].position.x); |
65 EXPECT_EQ(last_mouse_y_, event.touches[0].position.y); | 65 EXPECT_EQ(last_mouse_y_, event.touches[0].position.y); |
66 bool expected_cancelable = event.type != WebInputEvent::TouchCancel; | 66 WebInputEvent::DispatchType expected_cancelable = |
tdresser
2016/04/18 15:12:02
Rename to expected_dispatch_type
dtapuska
2016/04/18 19:19:33
Done.
| |
67 EXPECT_EQ(expected_cancelable, !!event.cancelable); | 67 event.type == WebInputEvent::TouchCancel ? WebInputEvent::NonBlocking |
68 : WebInputEvent::Blocking; | |
69 EXPECT_EQ(expected_cancelable, event.dispatchType); | |
68 if (ack_touches_synchronously_) { | 70 if (ack_touches_synchronously_) { |
69 emulator()->HandleTouchEventAck( | 71 emulator()->HandleTouchEventAck( |
70 event, INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); | 72 event, INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); |
71 } | 73 } |
72 } | 74 } |
73 | 75 |
74 void SetCursor(const WebCursor& cursor) override {} | 76 void SetCursor(const WebCursor& cursor) override {} |
75 | 77 |
76 void ShowContextMenuAtPoint(const gfx::Point& point) override {} | 78 void ShowContextMenuAtPoint(const gfx::Point& point) override {} |
77 | 79 |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
556 emulator()->Disable(); | 558 emulator()->Disable(); |
557 EXPECT_EQ("TouchStart TouchCancel", ExpectedEvents()); | 559 EXPECT_EQ("TouchStart TouchCancel", ExpectedEvents()); |
558 emulator()->CancelTouch(); | 560 emulator()->CancelTouch(); |
559 } | 561 } |
560 | 562 |
561 TEST_F(TouchEmulatorTest, ConstructorWithHighDeviceScaleDoesNotCrash) { | 563 TEST_F(TouchEmulatorTest, ConstructorWithHighDeviceScaleDoesNotCrash) { |
562 TouchEmulator(this, 4.0f); | 564 TouchEmulator(this, 4.0f); |
563 } | 565 } |
564 | 566 |
565 } // namespace content | 567 } // namespace content |
OLD | NEW |