| 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 "content/browser/renderer_host/input/touch_event_queue.h" | 5 #include "content/browser/renderer_host/input/touch_event_queue.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/run_loop.h" |
| 15 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
| 16 #include "base/threading/thread_task_runner_handle.h" | 17 #include "base/threading/thread_task_runner_handle.h" |
| 17 #include "content/browser/renderer_host/input/timeout_monitor.h" | 18 #include "content/browser/renderer_host/input/timeout_monitor.h" |
| 18 #include "content/common/input/synthetic_web_input_event_builders.h" | 19 #include "content/common/input/synthetic_web_input_event_builders.h" |
| 19 #include "content/common/input/web_touch_event_traits.h" | 20 #include "content/common/input/web_touch_event_traits.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 21 #include "third_party/WebKit/public/web/WebInputEvent.h" | 22 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 22 | 23 |
| 23 using blink::WebGestureEvent; | 24 using blink::WebGestureEvent; |
| 24 using blink::WebInputEvent; | 25 using blink::WebInputEvent; |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 return sent_events_; | 302 return sent_events_; |
| 302 } | 303 } |
| 303 | 304 |
| 304 InputEventAckState acked_event_state() const { | 305 InputEventAckState acked_event_state() const { |
| 305 return last_acked_event_state_; | 306 return last_acked_event_state_; |
| 306 } | 307 } |
| 307 | 308 |
| 308 static void RunTasksAndWait(base::TimeDelta delay) { | 309 static void RunTasksAndWait(base::TimeDelta delay) { |
| 309 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 310 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 310 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), delay); | 311 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), delay); |
| 311 base::MessageLoop::current()->Run(); | 312 base::RunLoop().Run(); |
| 312 } | 313 } |
| 313 | 314 |
| 314 size_t uncancelable_touch_moves_pending_ack_count() const { | 315 size_t uncancelable_touch_moves_pending_ack_count() const { |
| 315 return queue_->uncancelable_touch_moves_pending_ack_count(); | 316 return queue_->uncancelable_touch_moves_pending_ack_count(); |
| 316 } | 317 } |
| 317 | 318 |
| 318 int GetUniqueTouchEventID() { return sent_events_ids_.back(); } | 319 int GetUniqueTouchEventID() { return sent_events_ids_.back(); } |
| 319 | 320 |
| 320 private: | 321 private: |
| 321 void SendTouchEvent() { | 322 void SendTouchEvent() { |
| (...skipping 2385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2707 EXPECT_EQ(0U, queued_event_count()); | 2708 EXPECT_EQ(0U, queued_event_count()); |
| 2708 | 2709 |
| 2709 EXPECT_EQ(WebInputEvent::TouchStart, all_sent_events()[0].type); | 2710 EXPECT_EQ(WebInputEvent::TouchStart, all_sent_events()[0].type); |
| 2710 EXPECT_EQ(WebInputEvent::TouchScrollStarted, all_sent_events()[1].type); | 2711 EXPECT_EQ(WebInputEvent::TouchScrollStarted, all_sent_events()[1].type); |
| 2711 EXPECT_EQ(WebInputEvent::TouchMove, all_sent_events()[2].type); | 2712 EXPECT_EQ(WebInputEvent::TouchMove, all_sent_events()[2].type); |
| 2712 EXPECT_EQ(WebInputEvent::TouchEnd, all_sent_events()[3].type); | 2713 EXPECT_EQ(WebInputEvent::TouchEnd, all_sent_events()[3].type); |
| 2713 EXPECT_EQ(4U, GetAndResetSentEventCount()); | 2714 EXPECT_EQ(4U, GetAndResetSentEventCount()); |
| 2714 } | 2715 } |
| 2715 | 2716 |
| 2716 } // namespace content | 2717 } // namespace content |
| OLD | NEW |