| 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_dispatch_type = |
| 67 EXPECT_EQ(expected_cancelable, !!event.cancelable); | 67 event.type == WebInputEvent::TouchCancel |
| 68 ? WebInputEvent::EventNonBlocking |
| 69 : WebInputEvent::Blocking; |
| 70 EXPECT_EQ(expected_dispatch_type, event.dispatchType); |
| 68 if (ack_touches_synchronously_) { | 71 if (ack_touches_synchronously_) { |
| 69 emulator()->HandleTouchEventAck( | 72 emulator()->HandleTouchEventAck( |
| 70 event, INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); | 73 event, INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); |
| 71 } | 74 } |
| 72 } | 75 } |
| 73 | 76 |
| 74 void SetCursor(const WebCursor& cursor) override {} | 77 void SetCursor(const WebCursor& cursor) override {} |
| 75 | 78 |
| 76 void ShowContextMenuAtPoint(const gfx::Point& point) override {} | 79 void ShowContextMenuAtPoint(const gfx::Point& point) override {} |
| 77 | 80 |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 emulator()->Disable(); | 559 emulator()->Disable(); |
| 557 EXPECT_EQ("TouchStart TouchCancel", ExpectedEvents()); | 560 EXPECT_EQ("TouchStart TouchCancel", ExpectedEvents()); |
| 558 emulator()->CancelTouch(); | 561 emulator()->CancelTouch(); |
| 559 } | 562 } |
| 560 | 563 |
| 561 TEST_F(TouchEmulatorTest, ConstructorWithHighDeviceScaleDoesNotCrash) { | 564 TEST_F(TouchEmulatorTest, ConstructorWithHighDeviceScaleDoesNotCrash) { |
| 562 TouchEmulator(this, 4.0f); | 565 TouchEmulator(this, 4.0f); |
| 563 } | 566 } |
| 564 | 567 |
| 565 } // namespace content | 568 } // namespace content |
| OLD | NEW |