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