OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/memory/scoped_vector.h" | 6 #include "base/memory/scoped_vector.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 while(!queue_.empty()) { | 343 while(!queue_.empty()) { |
344 delete queue_.front(); | 344 delete queue_.front(); |
345 queue_.pop(); | 345 queue_.pop(); |
346 } | 346 } |
347 } | 347 } |
348 | 348 |
349 virtual void OnTouchEvent(ui::TouchEvent* event) override { | 349 virtual void OnTouchEvent(ui::TouchEvent* event) override { |
350 if (queue_events_) { | 350 if (queue_events_) { |
351 queue_.push(new ui::TouchEvent(*event, window_, window_)); | 351 queue_.push(new ui::TouchEvent(*event, window_, window_)); |
352 event->StopPropagation(); | 352 event->StopPropagation(); |
| 353 CHECK(window_); |
| 354 window_->GetHost()->dispatcher()->OnForwardingAsyncTouchEvent(event); |
353 } | 355 } |
354 } | 356 } |
355 | 357 |
356 void ReceivedAck() { | 358 void ReceivedAck() { |
357 ReceivedAckImpl(false); | 359 ReceivedAckImpl(false); |
358 } | 360 } |
359 | 361 |
360 void ReceivedAckPreventDefaulted() { | 362 void ReceivedAckPreventDefaulted() { |
361 ReceivedAckImpl(true); | 363 ReceivedAckImpl(true); |
362 } | 364 } |
(...skipping 3859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4222 ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(65, 202), | 4224 ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(65, 202), |
4223 kTouchId1, tes.Now()); | 4225 kTouchId1, tes.Now()); |
4224 DispatchEventUsingWindowDispatcher(&move2); | 4226 DispatchEventUsingWindowDispatcher(&move2); |
4225 EXPECT_2_EVENTS(delegate->events(), | 4227 EXPECT_2_EVENTS(delegate->events(), |
4226 ui::ET_GESTURE_SCROLL_UPDATE, | 4228 ui::ET_GESTURE_SCROLL_UPDATE, |
4227 ui::ET_GESTURE_PINCH_UPDATE); | 4229 ui::ET_GESTURE_PINCH_UPDATE); |
4228 } | 4230 } |
4229 | 4231 |
4230 // Tests that delaying the ack of a touch release doesn't trigger a long press | 4232 // Tests that delaying the ack of a touch release doesn't trigger a long press |
4231 // gesture. | 4233 // gesture. |
4232 TEST_F(GestureRecognizerTest, DISABLED_EagerGestureDetection) { | 4234 TEST_F(GestureRecognizerTest, EagerGestureDetection) { |
4233 scoped_ptr<QueueTouchEventDelegate> delegate( | 4235 scoped_ptr<QueueTouchEventDelegate> delegate( |
4234 new QueueTouchEventDelegate(host()->dispatcher())); | 4236 new QueueTouchEventDelegate(host()->dispatcher())); |
4235 TimedEvents tes; | 4237 TimedEvents tes; |
4236 const int kTouchId = 2; | 4238 const int kTouchId = 2; |
4237 gfx::Rect bounds(100, 200, 100, 100); | 4239 gfx::Rect bounds(100, 200, 100, 100); |
4238 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 4240 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
4239 delegate.get(), -1234, bounds, root_window())); | 4241 delegate.get(), -1234, bounds, root_window())); |
4240 delegate->set_window(window.get()); | 4242 delegate->set_window(window.get()); |
4241 | 4243 |
4242 delegate->Reset(); | 4244 delegate->Reset(); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4306 ui::TouchEvent move3( | 4308 ui::TouchEvent move3( |
4307 ui::ET_TOUCH_MOVED, gfx::Point(65, 202), kTouchId1, tes.Now()); | 4309 ui::ET_TOUCH_MOVED, gfx::Point(65, 202), kTouchId1, tes.Now()); |
4308 DispatchEventUsingWindowDispatcher(&move3); | 4310 DispatchEventUsingWindowDispatcher(&move3); |
4309 | 4311 |
4310 delegate->ReceivedAck(); | 4312 delegate->ReceivedAck(); |
4311 EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE); | 4313 EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE); |
4312 } | 4314 } |
4313 | 4315 |
4314 } // namespace test | 4316 } // namespace test |
4315 } // namespace aura | 4317 } // namespace aura |
OLD | NEW |