| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 emulator_->Enable(ui::GestureProviderConfigType::GENERIC_MOBILE); | 48 emulator_->Enable(ui::GestureProviderConfigType::GENERIC_MOBILE); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void TearDown() override { | 51 void TearDown() override { |
| 52 emulator_->Disable(); | 52 emulator_->Disable(); |
| 53 EXPECT_EQ("", ExpectedEvents()); | 53 EXPECT_EQ("", ExpectedEvents()); |
| 54 } | 54 } |
| 55 | 55 |
| 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 const int all_buttons = WebInputEvent::LeftButtonDown | | 66 const int all_buttons = WebInputEvent::LeftButtonDown | |
| 67 WebInputEvent::MiddleButtonDown | WebInputEvent::RightButtonDown; | 67 WebInputEvent::MiddleButtonDown | WebInputEvent::RightButtonDown; |
| 68 EXPECT_EQ(0, event.modifiers & all_buttons); | 68 EXPECT_EQ(0, event.modifiers() & all_buttons); |
| 69 WebInputEvent::DispatchType expected_dispatch_type = | 69 WebInputEvent::DispatchType expected_dispatch_type = |
| 70 event.type == WebInputEvent::TouchCancel | 70 event.type() == WebInputEvent::TouchCancel |
| 71 ? WebInputEvent::EventNonBlocking | 71 ? WebInputEvent::EventNonBlocking |
| 72 : WebInputEvent::Blocking; | 72 : WebInputEvent::Blocking; |
| 73 EXPECT_EQ(expected_dispatch_type, event.dispatchType); | 73 EXPECT_EQ(expected_dispatch_type, event.dispatchType); |
| 74 if (ack_touches_synchronously_) { | 74 if (ack_touches_synchronously_) { |
| 75 emulator()->HandleTouchEventAck( | 75 emulator()->HandleTouchEventAck( |
| 76 event, INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); | 76 event, INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 void SetCursor(const WebCursor& cursor) override { | 80 void SetCursor(const WebCursor& cursor) override { |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 emulator()->SetDeviceScaleFactor(1.0f); | 584 emulator()->SetDeviceScaleFactor(1.0f); |
| 585 EXPECT_EQ(1.0f, GetCursorScaleFactor()); | 585 EXPECT_EQ(1.0f, GetCursorScaleFactor()); |
| 586 | 586 |
| 587 TouchEmulator another(this, 4.0f); | 587 TouchEmulator another(this, 4.0f); |
| 588 EXPECT_EQ(1.0f, GetCursorScaleFactor()); | 588 EXPECT_EQ(1.0f, GetCursorScaleFactor()); |
| 589 another.Enable(ui::GestureProviderConfigType::GENERIC_MOBILE); | 589 another.Enable(ui::GestureProviderConfigType::GENERIC_MOBILE); |
| 590 EXPECT_EQ(2.0f, GetCursorScaleFactor()); | 590 EXPECT_EQ(2.0f, GetCursorScaleFactor()); |
| 591 } | 591 } |
| 592 | 592 |
| 593 } // namespace content | 593 } // namespace content |
| OLD | NEW |