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