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