| 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 "content/browser/renderer_host/input/mock_web_input_event_builders.h" | 8 #include "content/browser/renderer_host/input/mock_web_input_event_builders.h" |
| 9 #include "content/browser/renderer_host/input/touch_event_queue.h" | 9 #include "content/browser/renderer_host/input/touch_event_queue.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 } | 36 } |
| 37 | 37 |
| 38 // TouchEventQueueClient | 38 // TouchEventQueueClient |
| 39 virtual void SendTouchEventImmediately( | 39 virtual void SendTouchEventImmediately( |
| 40 const TouchEventWithLatencyInfo& event) OVERRIDE { | 40 const TouchEventWithLatencyInfo& event) OVERRIDE { |
| 41 ++sent_event_count_; | 41 ++sent_event_count_; |
| 42 last_sent_event_ = event.event; | 42 last_sent_event_ = event.event; |
| 43 } | 43 } |
| 44 | 44 |
| 45 virtual void OnTouchEventAck( | 45 virtual void OnTouchEventAck( |
| 46 const TouchEventWithLatencyInfo& event, | 46 const WebKit::WebTouchEvent& event, |
| 47 InputEventAckState ack_result) OVERRIDE { | 47 InputEventAckState ack_result, |
| 48 ui::LatencyInfo* latency) OVERRIDE { |
| 48 ++acked_event_count_; | 49 ++acked_event_count_; |
| 49 last_acked_event_ = event.event; | 50 last_acked_event_ = event; |
| 50 last_acked_event_state_ = ack_result; | 51 last_acked_event_state_ = ack_result; |
| 51 if (followup_touch_event_) { | 52 if (followup_touch_event_) { |
| 52 scoped_ptr<WebTouchEvent> followup_touch_event = | 53 scoped_ptr<WebTouchEvent> followup_touch_event = |
| 53 followup_touch_event_.Pass(); | 54 followup_touch_event_.Pass(); |
| 54 SendTouchEvent(*followup_touch_event); | 55 SendTouchEvent(*followup_touch_event); |
| 55 } | 56 } |
| 56 } | 57 } |
| 57 | 58 |
| 58 protected: | 59 protected: |
| 59 | 60 |
| 60 void SendTouchEvent(const WebTouchEvent& event) { | 61 void SendTouchEvent(const WebTouchEvent& event) { |
| 61 queue_->QueueEvent(TouchEventWithLatencyInfo(event, ui::LatencyInfo())); | 62 queue_->QueueEvent(TouchEventWithLatencyInfo(event, ui::LatencyInfo())); |
| 62 } | 63 } |
| 63 | 64 |
| 64 void SendTouchEvent() { | 65 void SendTouchEvent() { |
| 65 SendTouchEvent(touch_event_); | 66 SendTouchEvent(touch_event_); |
| 66 touch_event_.ResetPoints(); | 67 touch_event_.ResetPoints(); |
| 67 } | 68 } |
| 68 | 69 |
| 69 void SendTouchEventACK(InputEventAckState ack_result) { | 70 void SendTouchEventACK(InputEventAckState ack_result) { |
| 70 queue_->ProcessTouchAck(ack_result, ui::LatencyInfo()); | 71 ui::LatencyInfo latency; |
| 72 queue_->ProcessTouchAck(ack_result, &latency); |
| 71 } | 73 } |
| 72 | 74 |
| 73 void SetFollowupEvent(const WebTouchEvent& event) { | 75 void SetFollowupEvent(const WebTouchEvent& event) { |
| 74 followup_touch_event_.reset(new WebTouchEvent(event)); | 76 followup_touch_event_.reset(new WebTouchEvent(event)); |
| 75 } | 77 } |
| 76 | 78 |
| 77 int PressTouchPoint(int x, int y) { | 79 int PressTouchPoint(int x, int y) { |
| 78 return touch_event_.PressPoint(x, y); | 80 return touch_event_.PressPoint(x, y); |
| 79 } | 81 } |
| 80 | 82 |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 EXPECT_EQ(1U, GetAndResetAckedEventCount()); | 680 EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
| 679 | 681 |
| 680 ReleaseTouchPoint(0); | 682 ReleaseTouchPoint(0); |
| 681 SendTouchEvent(); | 683 SendTouchEvent(); |
| 682 EXPECT_EQ(1U, GetAndResetSentEventCount()); | 684 EXPECT_EQ(1U, GetAndResetSentEventCount()); |
| 683 SendTouchEventACK(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 685 SendTouchEventACK(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 684 EXPECT_EQ(1U, GetAndResetAckedEventCount()); | 686 EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
| 685 } | 687 } |
| 686 | 688 |
| 687 } // namespace content | 689 } // namespace content |
| OLD | NEW |