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/location.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
11 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "content/browser/gpu/compositor_util.h" | 13 #include "content/browser/gpu/compositor_util.h" |
14 #include "content/browser/renderer_host/render_widget_host_impl.h" | 14 #include "content/browser/renderer_host/render_widget_host_impl.h" |
15 #include "content/browser/web_contents/web_contents_impl.h" | 15 #include "content/browser/web_contents/web_contents_impl.h" |
16 #include "content/common/input/synthetic_web_input_event_builders.h" | 16 #include "content/common/input/synthetic_web_input_event_builders.h" |
17 #include "content/common/input_messages.h" | 17 #include "content/common/input_messages.h" |
18 #include "content/public/browser/browser_message_filter.h" | 18 #include "content/public/browser/browser_message_filter.h" |
19 #include "content/public/browser/render_view_host.h" | 19 #include "content/public/browser/render_view_host.h" |
20 #include "content/public/browser/render_widget_host_view.h" | 20 #include "content/public/browser/render_widget_host_view.h" |
21 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
22 #include "content/public/test/browser_test_utils.h" | 22 #include "content/public/test/browser_test_utils.h" |
23 #include "content/public/test/content_browser_test.h" | 23 #include "content/public/test/content_browser_test.h" |
24 #include "content/public/test/content_browser_test_utils.h" | 24 #include "content/public/test/content_browser_test_utils.h" |
25 #include "content/shell/browser/shell.h" | 25 #include "content/shell/browser/shell.h" |
26 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 26 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
27 #include "ui/events/event_switches.h" | |
28 #include "ui/events/latency_info.h" | 27 #include "ui/events/latency_info.h" |
29 | 28 |
30 using blink::WebInputEvent; | 29 using blink::WebInputEvent; |
31 | 30 |
32 namespace { | 31 namespace { |
33 | 32 |
34 void GiveItSomeTime() { | 33 void GiveItSomeTime() { |
35 base::RunLoop run_loop; | 34 base::RunLoop run_loop; |
36 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 35 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
37 FROM_HERE, run_loop.QuitClosure(), base::TimeDelta::FromMilliseconds(10)); | 36 FROM_HERE, run_loop.QuitClosure(), base::TimeDelta::FromMilliseconds(10)); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 109 |
111 RenderWidgetHostImpl* host = GetWidgetHost(); | 110 RenderWidgetHostImpl* host = GetWidgetHost(); |
112 host->GetView()->SetSize(gfx::Size(400, 400)); | 111 host->GetView()->SetSize(gfx::Size(400, 400)); |
113 | 112 |
114 // The page is loaded in the renderer, wait for a new frame to arrive. | 113 // The page is loaded in the renderer, wait for a new frame to arrive. |
115 while (!host->ScheduleComposite()) | 114 while (!host->ScheduleComposite()) |
116 GiveItSomeTime(); | 115 GiveItSomeTime(); |
117 } | 116 } |
118 | 117 |
119 void SetUpCommandLine(base::CommandLine* cmd) override { | 118 void SetUpCommandLine(base::CommandLine* cmd) override { |
120 cmd->AppendSwitchASCII(switches::kTouchEvents, | 119 cmd->AppendSwitchASCII(switches::kTouchEventFeatureDetection, |
121 switches::kTouchEventsEnabled); | 120 switches::kTouchEventFeatureDetectionEnabled); |
122 } | 121 } |
123 }; | 122 }; |
124 | 123 |
125 #if defined(OS_MACOSX) | 124 #if defined(OS_MACOSX) |
126 // TODO(ccameron): Failing on mac: crbug.com/346363 | 125 // TODO(ccameron): Failing on mac: crbug.com/346363 |
127 #define MAYBE_TouchNoHandler DISABLED_TouchNoHandler | 126 #define MAYBE_TouchNoHandler DISABLED_TouchNoHandler |
128 #else | 127 #else |
129 #define MAYBE_TouchNoHandler TouchNoHandler | 128 #define MAYBE_TouchNoHandler TouchNoHandler |
130 #endif | 129 #endif |
131 IN_PROC_BROWSER_TEST_F(TouchInputBrowserTest, MAYBE_TouchNoHandler) { | 130 IN_PROC_BROWSER_TEST_F(TouchInputBrowserTest, MAYBE_TouchNoHandler) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo()); | 213 GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo()); |
215 EXPECT_EQ(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS, filter->WaitForAck()); | 214 EXPECT_EQ(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS, filter->WaitForAck()); |
216 | 215 |
217 touch.PressPoint(25, 125); | 216 touch.PressPoint(25, 125); |
218 filter = AddFilter(WebInputEvent::TouchStart); | 217 filter = AddFilter(WebInputEvent::TouchStart); |
219 GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo()); | 218 GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo()); |
220 EXPECT_EQ(INPUT_EVENT_ACK_STATE_CONSUMED, filter->WaitForAck()); | 219 EXPECT_EQ(INPUT_EVENT_ACK_STATE_CONSUMED, filter->WaitForAck()); |
221 } | 220 } |
222 | 221 |
223 } // namespace content | 222 } // namespace content |
OLD | NEW |