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 EXPECT_EQ(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS, | 186 if (content::IsThreadedCompositingEnabled()) { |
187 filter()->last_ack_state()); | 187 EXPECT_EQ(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS, |
| 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 } |
188 | 194 |
189 // If a touch-press is acked with NO_CONSUMER_EXISTS, then subsequent | 195 // If a touch-press is acked with NO_CONSUMER_EXISTS, then subsequent |
190 // touch-points don't need to be dispatched until the touch point is released. | 196 // touch-points don't need to be dispatched until the touch point is released. |
191 touch.ReleasePoint(0); | 197 touch.ReleasePoint(0); |
192 GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo()); | 198 GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo()); |
193 touch.ResetPoints(); | 199 touch.ResetPoints(); |
194 } | 200 } |
195 | 201 |
196 IN_PROC_BROWSER_TEST_F(TouchInputBrowserTest, TouchHandlerNoConsume) { | 202 IN_PROC_BROWSER_TEST_F(TouchInputBrowserTest, TouchHandlerNoConsume) { |
197 LoadURLAndAddFilter(); | 203 LoadURLAndAddFilter(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 #endif | 240 #endif |
235 IN_PROC_BROWSER_TEST_F(TouchInputBrowserTest, MAYBE_MultiPointTouchPress) { | 241 IN_PROC_BROWSER_TEST_F(TouchInputBrowserTest, MAYBE_MultiPointTouchPress) { |
236 LoadURLAndAddFilter(); | 242 LoadURLAndAddFilter(); |
237 SyntheticWebTouchEvent touch; | 243 SyntheticWebTouchEvent touch; |
238 | 244 |
239 // Press on |first|, which sould be acked with NO_CONSUMER_EXISTS. Then press | 245 // Press on |first|, which sould be acked with NO_CONSUMER_EXISTS. Then press |
240 // on |third|. That point should be acked with CONSUMED. | 246 // on |third|. That point should be acked with CONSUMED. |
241 touch.PressPoint(25, 25); | 247 touch.PressPoint(25, 25); |
242 GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo()); | 248 GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo()); |
243 filter()->WaitForAck(WebInputEvent::TouchStart); | 249 filter()->WaitForAck(WebInputEvent::TouchStart); |
244 EXPECT_EQ(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS, | 250 if (content::IsThreadedCompositingEnabled()) { |
245 filter()->last_ack_state()); | 251 EXPECT_EQ(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS, |
| 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 } |
246 | 258 |
247 touch.PressPoint(25, 125); | 259 touch.PressPoint(25, 125); |
248 GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo()); | 260 GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo()); |
249 filter()->WaitForAck(WebInputEvent::TouchStart); | 261 filter()->WaitForAck(WebInputEvent::TouchStart); |
250 EXPECT_EQ(INPUT_EVENT_ACK_STATE_CONSUMED, filter()->last_ack_state()); | 262 EXPECT_EQ(INPUT_EVENT_ACK_STATE_CONSUMED, filter()->last_ack_state()); |
251 } | 263 } |
252 | 264 |
253 } // namespace content | 265 } // namespace content |
OLD | NEW |