| 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 bool SendTouchEvent(WebInputEvent::Type type, WebTouchPoint::State state, | 212 bool SendTouchEvent(WebInputEvent::Type type, WebTouchPoint::State state, |
| 213 int x, int y, bool ack) { | 213 int x, int y, bool ack) { |
| 214 WebTouchEvent event = MakeTouchEvent(type, state, x, y); | 214 WebTouchEvent event = MakeTouchEvent(type, state, x, y); |
| 215 if (emulator()->HandleTouchEvent(event)) { | 215 if (emulator()->HandleTouchEvent(event)) { |
| 216 // Touch event is not forwarded. | 216 // Touch event is not forwarded. |
| 217 return false; | 217 return false; |
| 218 } | 218 } |
| 219 | 219 |
| 220 if (ack) { | 220 if (ack) { |
| 221 // Can't send ack if there are some pending acks. | 221 // Can't send ack if there are some pending acks. |
| 222 DCHECK(!touch_events_to_ack_.size()); | 222 DCHECK(touch_events_to_ack_.empty()); |
| 223 | 223 |
| 224 // Touch event is forwarded, ack should not be handled by emulator. | 224 // Touch event is forwarded, ack should not be handled by emulator. |
| 225 EXPECT_FALSE(emulator()->HandleTouchEventAck( | 225 EXPECT_FALSE(emulator()->HandleTouchEventAck( |
| 226 event, INPUT_EVENT_ACK_STATE_CONSUMED)); | 226 event, INPUT_EVENT_ACK_STATE_CONSUMED)); |
| 227 } else { | 227 } else { |
| 228 touch_events_to_ack_.push_back(event); | 228 touch_events_to_ack_.push_back(event); |
| 229 } | 229 } |
| 230 return true; | 230 return true; |
| 231 } | 231 } |
| 232 | 232 |
| (...skipping 330 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 |