| 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/location.h" | |
| 7 #include "base/logging.h" | 6 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 10 #include "base/single_thread_task_runner.h" | |
| 11 #include "base/thread_task_runner_handle.h" | |
| 12 #include "content/browser/renderer_host/input/timeout_monitor.h" | 9 #include "content/browser/renderer_host/input/timeout_monitor.h" |
| 13 #include "content/browser/renderer_host/input/touch_event_queue.h" | 10 #include "content/browser/renderer_host/input/touch_event_queue.h" |
| 14 #include "content/common/input/synthetic_web_input_event_builders.h" | 11 #include "content/common/input/synthetic_web_input_event_builders.h" |
| 15 #include "content/common/input/web_touch_event_traits.h" | 12 #include "content/common/input/web_touch_event_traits.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 17 #include "third_party/WebKit/public/web/WebInputEvent.h" | 14 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 18 | 15 |
| 19 using blink::WebGestureEvent; | 16 using blink::WebGestureEvent; |
| 20 using blink::WebInputEvent; | 17 using blink::WebInputEvent; |
| 21 using blink::WebTouchEvent; | 18 using blink::WebTouchEvent; |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 275 |
| 279 const std::vector<WebTouchEvent>& all_sent_events() const { | 276 const std::vector<WebTouchEvent>& all_sent_events() const { |
| 280 return sent_events_; | 277 return sent_events_; |
| 281 } | 278 } |
| 282 | 279 |
| 283 InputEventAckState acked_event_state() const { | 280 InputEventAckState acked_event_state() const { |
| 284 return last_acked_event_state_; | 281 return last_acked_event_state_; |
| 285 } | 282 } |
| 286 | 283 |
| 287 static void RunTasksAndWait(base::TimeDelta delay) { | 284 static void RunTasksAndWait(base::TimeDelta delay) { |
| 288 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 285 base::MessageLoop::current()->PostDelayedTask( |
| 289 FROM_HERE, base::MessageLoop::QuitClosure(), delay); | 286 FROM_HERE, base::MessageLoop::QuitClosure(), delay); |
| 290 base::MessageLoop::current()->Run(); | 287 base::MessageLoop::current()->Run(); |
| 291 } | 288 } |
| 292 | 289 |
| 293 size_t uncancelable_touch_moves_pending_ack_count() const { | 290 size_t uncancelable_touch_moves_pending_ack_count() const { |
| 294 return queue_->uncancelable_touch_moves_pending_ack_count(); | 291 return queue_->uncancelable_touch_moves_pending_ack_count(); |
| 295 } | 292 } |
| 296 | 293 |
| 297 int GetUniqueTouchEventID() { return sent_events_ids_.back(); } | 294 int GetUniqueTouchEventID() { return sent_events_ids_.back(); } |
| 298 | 295 |
| (...skipping 2259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2558 // TouchMove should be allowed and test for touches state. | 2555 // TouchMove should be allowed and test for touches state. |
| 2559 const WebTouchEvent& event2 = sent_event(); | 2556 const WebTouchEvent& event2 = sent_event(); |
| 2560 EXPECT_EQ(WebInputEvent::TouchMove, event2.type); | 2557 EXPECT_EQ(WebInputEvent::TouchMove, event2.type); |
| 2561 EXPECT_EQ(WebTouchPoint::StateStationary, event2.touches[0].state); | 2558 EXPECT_EQ(WebTouchPoint::StateStationary, event2.touches[0].state); |
| 2562 EXPECT_EQ(WebTouchPoint::StateMoved, event2.touches[1].state); | 2559 EXPECT_EQ(WebTouchPoint::StateMoved, event2.touches[1].state); |
| 2563 EXPECT_EQ(1U, GetAndResetSentEventCount()); | 2560 EXPECT_EQ(1U, GetAndResetSentEventCount()); |
| 2564 EXPECT_EQ(1U, GetAndResetAckedEventCount()); | 2561 EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
| 2565 } | 2562 } |
| 2566 | 2563 |
| 2567 } // namespace content | 2564 } // namespace content |
| OLD | NEW |