| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <new> | 7 #include <new> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 queue_ = new MainThreadEventQueue(kTestRoutingID, this, main_task_runner_, | 68 queue_ = new MainThreadEventQueue(kTestRoutingID, this, main_task_runner_, |
| 69 &renderer_scheduler_); | 69 &renderer_scheduler_); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void HandleEventOnMainThread(int routing_id, | 72 void HandleEventOnMainThread(int routing_id, |
| 73 const blink::WebInputEvent* event, | 73 const blink::WebInputEvent* event, |
| 74 const ui::LatencyInfo& latency, | 74 const ui::LatencyInfo& latency, |
| 75 InputEventDispatchType type) override { | 75 InputEventDispatchType type) override { |
| 76 EXPECT_EQ(kTestRoutingID, routing_id); | 76 EXPECT_EQ(kTestRoutingID, routing_id); |
| 77 handled_events_.push_back(ui::WebInputEventTraits::Clone(*event)); | 77 handled_events_.push_back(ui::WebInputEventTraits::Clone(*event)); |
| 78 queue_->EventHandled(event->type(), | 78 queue_->EventHandled(event->type(), INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 79 blink::WebInputEventResult::HandledApplication, | |
| 80 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 81 } | 79 } |
| 82 | 80 |
| 83 void SendInputEventAck(int routing_id, | 81 void SendInputEventAck(int routing_id, |
| 84 blink::WebInputEvent::Type type, | 82 blink::WebInputEvent::Type type, |
| 85 InputEventAckState ack_result, | 83 InputEventAckState ack_result, |
| 86 uint32_t touch_event_id) override { | 84 uint32_t touch_event_id) override { |
| 87 additional_acked_events_.push_back(touch_event_id); | 85 additional_acked_events_.push_back(touch_event_id); |
| 88 } | 86 } |
| 89 | 87 |
| 90 bool HandleEvent(WebInputEvent& event, InputEventAckState ack_result) { | 88 bool HandleEvent(WebInputEvent& event, InputEventAckState ack_result) { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 base::HistogramTester histogram_tester; | 237 base::HistogramTester histogram_tester; |
| 240 SyntheticWebTouchEvent kEvents[4]; | 238 SyntheticWebTouchEvent kEvents[4]; |
| 241 kEvents[0].PressPoint(10, 10); | 239 kEvents[0].PressPoint(10, 10); |
| 242 kEvents[1].PressPoint(10, 10); | 240 kEvents[1].PressPoint(10, 10); |
| 243 kEvents[1].MovePoint(0, 20, 20); | 241 kEvents[1].MovePoint(0, 20, 20); |
| 244 kEvents[2].PressPoint(10, 10); | 242 kEvents[2].PressPoint(10, 10); |
| 245 kEvents[2].MovePoint(0, 30, 30); | 243 kEvents[2].MovePoint(0, 30, 30); |
| 246 kEvents[3].PressPoint(10, 10); | 244 kEvents[3].PressPoint(10, 10); |
| 247 kEvents[3].MovePoint(0, 35, 35); | 245 kEvents[3].MovePoint(0, 35, 35); |
| 248 | 246 |
| 249 EXPECT_CALL(renderer_scheduler_, | 247 EXPECT_CALL(renderer_scheduler_, DidHandleInputEventOnMainThread(testing::_)) |
| 250 DidHandleInputEventOnMainThread(testing::_, testing::_)) | |
| 251 .Times(2); | 248 .Times(2); |
| 252 // Ensure that coalescing takes place. | 249 // Ensure that coalescing takes place. |
| 253 HandleEvent(kEvents[0], INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING); | 250 HandleEvent(kEvents[0], INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING); |
| 254 HandleEvent(kEvents[1], INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 251 HandleEvent(kEvents[1], INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 255 HandleEvent(kEvents[2], INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 252 HandleEvent(kEvents[2], INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 256 HandleEvent(kEvents[3], INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 253 HandleEvent(kEvents[3], INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 257 | 254 |
| 258 EXPECT_EQ(2u, event_queue().size()); | 255 EXPECT_EQ(2u, event_queue().size()); |
| 259 EXPECT_TRUE(main_task_runner_->HasPendingTask()); | 256 EXPECT_TRUE(main_task_runner_->HasPendingTask()); |
| 260 RunPendingTasksWithSimulatedRaf(); | 257 RunPendingTasksWithSimulatedRaf(); |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 | 620 |
| 624 // The boolean parameterized test varies whether rAF aligned input | 621 // The boolean parameterized test varies whether rAF aligned input |
| 625 // is enabled or not. | 622 // is enabled or not. |
| 626 INSTANTIATE_TEST_CASE_P( | 623 INSTANTIATE_TEST_CASE_P( |
| 627 MainThreadEventQueueTests, | 624 MainThreadEventQueueTests, |
| 628 MainThreadEventQueueTest, | 625 MainThreadEventQueueTest, |
| 629 testing::Range(0u, | 626 testing::Range(0u, |
| 630 (kRafAlignedEnabledTouch | kRafAlignedEnabledMouse) + 1)); | 627 (kRafAlignedEnabledTouch | kRafAlignedEnabledMouse) + 1)); |
| 631 | 628 |
| 632 } // namespace content | 629 } // namespace content |
| OLD | NEW |