| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "content/browser/renderer_host/input/timeout_monitor.h" | 9 #include "content/browser/renderer_host/input/timeout_monitor.h" |
| 10 #include "content/browser/renderer_host/input/touch_event_queue.h" | 10 #include "content/browser/renderer_host/input/touch_event_queue.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 TouchEventQueueTest() | 33 TouchEventQueueTest() |
| 34 : sent_event_count_(0), | 34 : sent_event_count_(0), |
| 35 acked_event_count_(0), | 35 acked_event_count_(0), |
| 36 last_acked_event_state_(INPUT_EVENT_ACK_STATE_UNKNOWN), | 36 last_acked_event_state_(INPUT_EVENT_ACK_STATE_UNKNOWN), |
| 37 slop_length_dips_(0), | 37 slop_length_dips_(0), |
| 38 touch_scrolling_mode_(TouchEventQueue::TOUCH_SCROLLING_MODE_DEFAULT) {} | 38 touch_scrolling_mode_(TouchEventQueue::TOUCH_SCROLLING_MODE_DEFAULT) {} |
| 39 | 39 |
| 40 virtual ~TouchEventQueueTest() {} | 40 virtual ~TouchEventQueueTest() {} |
| 41 | 41 |
| 42 // testing::Test | 42 // testing::Test |
| 43 virtual void SetUp() OVERRIDE { ResetQueueWithConfig(CreateConfig()); } | 43 virtual void SetUp() override { ResetQueueWithConfig(CreateConfig()); } |
| 44 | 44 |
| 45 virtual void TearDown() OVERRIDE { | 45 virtual void TearDown() override { |
| 46 queue_.reset(); | 46 queue_.reset(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 // TouchEventQueueClient | 49 // TouchEventQueueClient |
| 50 virtual void SendTouchEventImmediately( | 50 virtual void SendTouchEventImmediately( |
| 51 const TouchEventWithLatencyInfo& event) OVERRIDE { | 51 const TouchEventWithLatencyInfo& event) override { |
| 52 ++sent_event_count_; | 52 ++sent_event_count_; |
| 53 last_sent_event_ = event.event; | 53 last_sent_event_ = event.event; |
| 54 if (sync_ack_result_) { | 54 if (sync_ack_result_) { |
| 55 auto sync_ack_result = sync_ack_result_.Pass(); | 55 auto sync_ack_result = sync_ack_result_.Pass(); |
| 56 SendTouchEventAck(*sync_ack_result); | 56 SendTouchEventAck(*sync_ack_result); |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 virtual void OnTouchEventAck( | 60 virtual void OnTouchEventAck( |
| 61 const TouchEventWithLatencyInfo& event, | 61 const TouchEventWithLatencyInfo& event, |
| 62 InputEventAckState ack_result) OVERRIDE { | 62 InputEventAckState ack_result) override { |
| 63 ++acked_event_count_; | 63 ++acked_event_count_; |
| 64 last_acked_event_ = event.event; | 64 last_acked_event_ = event.event; |
| 65 last_acked_event_state_ = ack_result; | 65 last_acked_event_state_ = ack_result; |
| 66 if (followup_touch_event_) { | 66 if (followup_touch_event_) { |
| 67 scoped_ptr<WebTouchEvent> followup_touch_event = | 67 scoped_ptr<WebTouchEvent> followup_touch_event = |
| 68 followup_touch_event_.Pass(); | 68 followup_touch_event_.Pass(); |
| 69 SendTouchEvent(*followup_touch_event); | 69 SendTouchEvent(*followup_touch_event); |
| 70 } | 70 } |
| 71 if (followup_gesture_event_) { | 71 if (followup_gesture_event_) { |
| 72 scoped_ptr<WebGestureEvent> followup_gesture_event = | 72 scoped_ptr<WebGestureEvent> followup_gesture_event = |
| (...skipping 2149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2222 | 2222 |
| 2223 // Give the touchmove a valid id; it should be sent. | 2223 // Give the touchmove a valid id; it should be sent. |
| 2224 event.touches[0].id = press_id; | 2224 event.touches[0].id = press_id; |
| 2225 SendTouchEvent(event); | 2225 SendTouchEvent(event); |
| 2226 EXPECT_EQ(1U, GetAndResetSentEventCount()); | 2226 EXPECT_EQ(1U, GetAndResetSentEventCount()); |
| 2227 SendTouchEventAck(INPUT_EVENT_ACK_STATE_CONSUMED); | 2227 SendTouchEventAck(INPUT_EVENT_ACK_STATE_CONSUMED); |
| 2228 EXPECT_EQ(1U, GetAndResetAckedEventCount()); | 2228 EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
| 2229 } | 2229 } |
| 2230 | 2230 |
| 2231 } // namespace content | 2231 } // namespace content |
| OLD | NEW |