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/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "content/browser/gpu/compositor_util.h" | 8 #include "content/browser/gpu/compositor_util.h" |
9 #include "content/browser/renderer_host/render_widget_host_impl.h" | 9 #include "content/browser/renderer_host/render_widget_host_impl.h" |
10 #include "content/browser/web_contents/web_contents_impl.h" | 10 #include "content/browser/web_contents/web_contents_impl.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 IN_PROC_BROWSER_TEST_F(TouchInputBrowserTest, MAYBE_TouchNoHandler) { | 176 IN_PROC_BROWSER_TEST_F(TouchInputBrowserTest, MAYBE_TouchNoHandler) { |
177 LoadURLAndAddFilter(); | 177 LoadURLAndAddFilter(); |
178 SyntheticWebTouchEvent touch; | 178 SyntheticWebTouchEvent touch; |
179 | 179 |
180 // A press on |first| should be acked with NO_CONSUMER_EXISTS since there is | 180 // A press on |first| should be acked with NO_CONSUMER_EXISTS since there is |
181 // no touch-handler on it. | 181 // no touch-handler on it. |
182 touch.PressPoint(25, 25); | 182 touch.PressPoint(25, 25); |
183 GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo()); | 183 GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo()); |
184 filter()->WaitForAck(WebInputEvent::TouchStart); | 184 filter()->WaitForAck(WebInputEvent::TouchStart); |
185 | 185 |
186 if (content::IsThreadedCompositingEnabled()) { | 186 EXPECT_EQ(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS, |
187 EXPECT_EQ(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS, | 187 filter()->last_ack_state()); |
188 filter()->last_ack_state()); | |
189 } else { | |
190 // http://crbug.com/326232: This should be NO_CONSUMER_EXISTS once | |
191 // WebViewImpl::hasTouchEventHandlersAt() is implemented. | |
192 EXPECT_EQ(INPUT_EVENT_ACK_STATE_NOT_CONSUMED, filter()->last_ack_state()); | |
193 } | |
194 | 188 |
195 // If a touch-press is acked with NO_CONSUMER_EXISTS, then subsequent | 189 // If a touch-press is acked with NO_CONSUMER_EXISTS, then subsequent |
196 // touch-points don't need to be dispatched until the touch point is released. | 190 // touch-points don't need to be dispatched until the touch point is released. |
197 touch.ReleasePoint(0); | 191 touch.ReleasePoint(0); |
198 GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo()); | 192 GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo()); |
199 touch.ResetPoints(); | 193 touch.ResetPoints(); |
200 } | 194 } |
201 | 195 |
202 IN_PROC_BROWSER_TEST_F(TouchInputBrowserTest, TouchHandlerNoConsume) { | 196 IN_PROC_BROWSER_TEST_F(TouchInputBrowserTest, TouchHandlerNoConsume) { |
203 LoadURLAndAddFilter(); | 197 LoadURLAndAddFilter(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 #endif | 234 #endif |
241 IN_PROC_BROWSER_TEST_F(TouchInputBrowserTest, MAYBE_MultiPointTouchPress) { | 235 IN_PROC_BROWSER_TEST_F(TouchInputBrowserTest, MAYBE_MultiPointTouchPress) { |
242 LoadURLAndAddFilter(); | 236 LoadURLAndAddFilter(); |
243 SyntheticWebTouchEvent touch; | 237 SyntheticWebTouchEvent touch; |
244 | 238 |
245 // Press on |first|, which sould be acked with NO_CONSUMER_EXISTS. Then press | 239 // Press on |first|, which sould be acked with NO_CONSUMER_EXISTS. Then press |
246 // on |third|. That point should be acked with CONSUMED. | 240 // on |third|. That point should be acked with CONSUMED. |
247 touch.PressPoint(25, 25); | 241 touch.PressPoint(25, 25); |
248 GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo()); | 242 GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo()); |
249 filter()->WaitForAck(WebInputEvent::TouchStart); | 243 filter()->WaitForAck(WebInputEvent::TouchStart); |
250 if (content::IsThreadedCompositingEnabled()) { | 244 EXPECT_EQ(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS, |
251 EXPECT_EQ(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS, | 245 filter()->last_ack_state()); |
252 filter()->last_ack_state()); | |
253 } else { | |
254 // http://crbug.com/326232: This should be NO_CONSUMER_EXISTS once | |
255 // WebViewImpl::hasTouchEventHandlersAt() is implemented. | |
256 EXPECT_EQ(INPUT_EVENT_ACK_STATE_NOT_CONSUMED, filter()->last_ack_state()); | |
257 } | |
258 | 246 |
259 touch.PressPoint(25, 125); | 247 touch.PressPoint(25, 125); |
260 GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo()); | 248 GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo()); |
261 filter()->WaitForAck(WebInputEvent::TouchStart); | 249 filter()->WaitForAck(WebInputEvent::TouchStart); |
262 EXPECT_EQ(INPUT_EVENT_ACK_STATE_CONSUMED, filter()->last_ack_state()); | 250 EXPECT_EQ(INPUT_EVENT_ACK_STATE_CONSUMED, filter()->last_ack_state()); |
263 } | 251 } |
264 | 252 |
265 } // namespace content | 253 } // namespace content |
OLD | NEW |