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> |
11 | 11 |
12 #include "base/test/scoped_task_environment.h" | 12 #include "base/test/scoped_task_environment.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "content/browser/renderer_host/input/touch_emulator_client.h" | 14 #include "content/browser/renderer_host/input/touch_emulator_client.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "third_party/WebKit/public/platform/WebKeyboardEvent.h" | 16 #include "third_party/WebKit/public/platform/WebKeyboardEvent.h" |
17 #include "third_party/WebKit/public/platform/WebMouseWheelEvent.h" | 17 #include "third_party/WebKit/public/platform/WebMouseWheelEvent.h" |
| 18 #include "ui/base/ui_base_types.h" |
18 #include "ui/events/blink/web_input_event_traits.h" | 19 #include "ui/events/blink/web_input_event_traits.h" |
19 | 20 |
20 using blink::WebGestureEvent; | 21 using blink::WebGestureEvent; |
21 using blink::WebInputEvent; | 22 using blink::WebInputEvent; |
22 using blink::WebKeyboardEvent; | 23 using blink::WebKeyboardEvent; |
23 using blink::WebMouseEvent; | 24 using blink::WebMouseEvent; |
24 using blink::WebMouseWheelEvent; | 25 using blink::WebMouseWheelEvent; |
25 using blink::WebTouchEvent; | 26 using blink::WebTouchEvent; |
26 using blink::WebTouchPoint; | 27 using blink::WebTouchPoint; |
27 | 28 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 if (ack_touches_synchronously_) { | 81 if (ack_touches_synchronously_) { |
81 emulator()->HandleTouchEventAck( | 82 emulator()->HandleTouchEventAck( |
82 event, INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); | 83 event, INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); |
83 } | 84 } |
84 } | 85 } |
85 | 86 |
86 void SetCursor(const WebCursor& cursor) override { | 87 void SetCursor(const WebCursor& cursor) override { |
87 cursor_ = cursor; | 88 cursor_ = cursor; |
88 } | 89 } |
89 | 90 |
90 void ShowContextMenuAtPoint(const gfx::Point& point) override {} | 91 void ShowContextMenuAtPoint(const gfx::Point& point, |
| 92 const ui::MenuSourceType source_type) override {} |
91 | 93 |
92 protected: | 94 protected: |
93 TouchEmulator* emulator() const { | 95 TouchEmulator* emulator() const { |
94 return emulator_.get(); | 96 return emulator_.get(); |
95 } | 97 } |
96 | 98 |
97 int modifiers() const { | 99 int modifiers() const { |
98 return (shift_pressed_ ? WebInputEvent::kShiftKey : 0) | | 100 return (shift_pressed_ ? WebInputEvent::kShiftKey : 0) | |
99 (mouse_pressed_ ? WebInputEvent::kLeftButtonDown : 0); | 101 (mouse_pressed_ ? WebInputEvent::kLeftButtonDown : 0); |
100 } | 102 } |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 emulator()->SetDeviceScaleFactor(1.0f); | 592 emulator()->SetDeviceScaleFactor(1.0f); |
591 EXPECT_EQ(1.0f, GetCursorScaleFactor()); | 593 EXPECT_EQ(1.0f, GetCursorScaleFactor()); |
592 | 594 |
593 TouchEmulator another(this, 4.0f); | 595 TouchEmulator another(this, 4.0f); |
594 EXPECT_EQ(1.0f, GetCursorScaleFactor()); | 596 EXPECT_EQ(1.0f, GetCursorScaleFactor()); |
595 another.Enable(ui::GestureProviderConfigType::GENERIC_MOBILE); | 597 another.Enable(ui::GestureProviderConfigType::GENERIC_MOBILE); |
596 EXPECT_EQ(2.0f, GetCursorScaleFactor()); | 598 EXPECT_EQ(2.0f, GetCursorScaleFactor()); |
597 } | 599 } |
598 | 600 |
599 } // namespace content | 601 } // namespace content |
OLD | NEW |