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/auto_reset.h" | 5 #include "base/auto_reset.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/location.h" |
7 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" |
8 #include "content/browser/gpu/compositor_util.h" | 11 #include "content/browser/gpu/compositor_util.h" |
9 #include "content/browser/renderer_host/render_widget_host_impl.h" | 12 #include "content/browser/renderer_host/render_widget_host_impl.h" |
10 #include "content/browser/web_contents/web_contents_impl.h" | 13 #include "content/browser/web_contents/web_contents_impl.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_messages.h" | 15 #include "content/common/input_messages.h" |
13 #include "content/public/browser/browser_message_filter.h" | 16 #include "content/public/browser/browser_message_filter.h" |
14 #include "content/public/browser/render_view_host.h" | 17 #include "content/public/browser/render_view_host.h" |
15 #include "content/public/browser/render_widget_host_view.h" | 18 #include "content/public/browser/render_widget_host_view.h" |
16 #include "content/public/common/content_switches.h" | 19 #include "content/public/common/content_switches.h" |
17 #include "content/public/test/content_browser_test.h" | 20 #include "content/public/test/content_browser_test.h" |
18 #include "content/public/test/content_browser_test_utils.h" | 21 #include "content/public/test/content_browser_test_utils.h" |
19 #include "content/shell/browser/shell.h" | 22 #include "content/shell/browser/shell.h" |
20 #include "third_party/WebKit/public/web/WebInputEvent.h" | 23 #include "third_party/WebKit/public/web/WebInputEvent.h" |
21 #include "ui/events/event_switches.h" | 24 #include "ui/events/event_switches.h" |
22 #include "ui/events/latency_info.h" | 25 #include "ui/events/latency_info.h" |
23 | 26 |
24 using blink::WebInputEvent; | 27 using blink::WebInputEvent; |
25 | 28 |
26 namespace { | 29 namespace { |
27 | 30 |
28 void GiveItSomeTime() { | 31 void GiveItSomeTime() { |
29 base::RunLoop run_loop; | 32 base::RunLoop run_loop; |
30 base::MessageLoop::current()->PostDelayedTask( | 33 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
31 FROM_HERE, | 34 FROM_HERE, run_loop.QuitClosure(), base::TimeDelta::FromMilliseconds(10)); |
32 run_loop.QuitClosure(), | |
33 base::TimeDelta::FromMilliseconds(10)); | |
34 run_loop.Run(); | 35 run_loop.Run(); |
35 } | 36 } |
36 | 37 |
37 const char kTouchEventDataURL[] = | 38 const char kTouchEventDataURL[] = |
38 "data:text/html;charset=utf-8," | 39 "data:text/html;charset=utf-8," |
39 #if defined(OS_ANDROID) | 40 #if defined(OS_ANDROID) |
40 "<head>" | 41 "<head>" |
41 "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">" | 42 "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">" |
42 "</head>" | 43 "</head>" |
43 #endif | 44 #endif |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 EXPECT_EQ(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS, | 250 EXPECT_EQ(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS, |
250 filter()->last_ack_state()); | 251 filter()->last_ack_state()); |
251 | 252 |
252 touch.PressPoint(25, 125); | 253 touch.PressPoint(25, 125); |
253 GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo()); | 254 GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo()); |
254 filter()->WaitForAck(WebInputEvent::TouchStart); | 255 filter()->WaitForAck(WebInputEvent::TouchStart); |
255 EXPECT_EQ(INPUT_EVENT_ACK_STATE_CONSUMED, filter()->last_ack_state()); | 256 EXPECT_EQ(INPUT_EVENT_ACK_STATE_CONSUMED, filter()->last_ack_state()); |
256 } | 257 } |
257 | 258 |
258 } // namespace content | 259 } // namespace content |
OLD | NEW |