| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 int modifiers() const { | 89 int modifiers() const { |
| 90 return (shift_pressed_ ? WebInputEvent::ShiftKey : 0) | | 90 return (shift_pressed_ ? WebInputEvent::ShiftKey : 0) | |
| 91 (mouse_pressed_ ? WebInputEvent::LeftButtonDown : 0); | 91 (mouse_pressed_ ? WebInputEvent::LeftButtonDown : 0); |
| 92 } | 92 } |
| 93 | 93 |
| 94 std::string ExpectedEvents() { | 94 std::string ExpectedEvents() { |
| 95 std::string result; | 95 std::string result; |
| 96 for (size_t i = 0; i < forwarded_events_.size(); ++i) { | 96 for (size_t i = 0; i < forwarded_events_.size(); ++i) { |
| 97 if (i != 0) | 97 if (i != 0) |
| 98 result += " "; | 98 result += " "; |
| 99 result += WebInputEventTraits::GetName(forwarded_events_[i]); | 99 result += WebInputEvent::GetName(forwarded_events_[i]); |
| 100 } | 100 } |
| 101 forwarded_events_.clear(); | 101 forwarded_events_.clear(); |
| 102 return result; | 102 return result; |
| 103 } | 103 } |
| 104 | 104 |
| 105 double GetNextEventTimeSeconds() { | 105 double GetNextEventTimeSeconds() { |
| 106 last_event_time_seconds_ += event_time_delta_seconds_; | 106 last_event_time_seconds_ += event_time_delta_seconds_; |
| 107 return last_event_time_seconds_; | 107 return last_event_time_seconds_; |
| 108 } | 108 } |
| 109 | 109 |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 emulator()->Disable(); | 563 emulator()->Disable(); |
| 564 EXPECT_EQ("TouchStart TouchCancel", ExpectedEvents()); | 564 EXPECT_EQ("TouchStart TouchCancel", ExpectedEvents()); |
| 565 emulator()->CancelTouch(); | 565 emulator()->CancelTouch(); |
| 566 } | 566 } |
| 567 | 567 |
| 568 TEST_F(TouchEmulatorTest, ConstructorWithHighDeviceScaleDoesNotCrash) { | 568 TEST_F(TouchEmulatorTest, ConstructorWithHighDeviceScaleDoesNotCrash) { |
| 569 TouchEmulator(this, 4.0f); | 569 TouchEmulator(this, 4.0f); |
| 570 } | 570 } |
| 571 | 571 |
| 572 } // namespace content | 572 } // namespace content |
| OLD | NEW |