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" |
11 #include "ui/aura/env.h" | 11 #include "ui/aura/env.h" |
12 #include "ui/aura/test/aura_test_base.h" | 12 #include "ui/aura/test/aura_test_base.h" |
13 #include "ui/aura/test/event_generator.h" | 13 #include "ui/aura/test/event_generator.h" |
14 #include "ui/aura/test/test_window_delegate.h" | 14 #include "ui/aura/test/test_window_delegate.h" |
15 #include "ui/aura/test/test_windows.h" | 15 #include "ui/aura/test/test_windows.h" |
16 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
17 #include "ui/aura/window_event_dispatcher.h" | 17 #include "ui/aura/window_event_dispatcher.h" |
18 #include "ui/base/hit_test.h" | 18 #include "ui/base/hit_test.h" |
19 #include "ui/base/ui_base_switches.h" | 19 #include "ui/base/ui_base_switches.h" |
20 #include "ui/events/event.h" | 20 #include "ui/events/event.h" |
21 #include "ui/events/event_switches.h" | 21 #include "ui/events/event_switches.h" |
22 #include "ui/events/event_utils.h" | 22 #include "ui/events/event_utils.h" |
23 #include "ui/events/gestures/gesture_configuration.h" | 23 #include "ui/events/gestures/gesture_configuration.h" |
24 #include "ui/events/gestures/gesture_recognizer_impl.h" | 24 #include "ui/events/gestures/gesture_recognizer_impl.h" |
25 #include "ui/events/gestures/gesture_sequence.h" | 25 #include "ui/events/gestures/gesture_sequence.h" |
26 #include "ui/events/gestures/gesture_types.h" | 26 #include "ui/events/gestures/gesture_types.h" |
| 27 #include "ui/events/test/events_test_utils.h" |
27 #include "ui/gfx/point.h" | 28 #include "ui/gfx/point.h" |
28 #include "ui/gfx/rect.h" | 29 #include "ui/gfx/rect.h" |
29 | 30 |
30 #include <queue> | 31 #include <queue> |
31 | 32 |
32 namespace aura { | 33 namespace aura { |
33 namespace test { | 34 namespace test { |
34 | 35 |
35 namespace { | 36 namespace { |
36 | 37 |
(...skipping 2244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2281 gfx::Rect bounds(0, 0, 10, 10); | 2282 gfx::Rect bounds(0, 0, 10, 10); |
2282 scoped_ptr<aura::Window> window( | 2283 scoped_ptr<aura::Window> window( |
2283 CreateTestWindowWithDelegate(delegate.get(), 0, bounds, root_window())); | 2284 CreateTestWindowWithDelegate(delegate.get(), 0, bounds, root_window())); |
2284 | 2285 |
2285 const int kTouchId1 = 8; | 2286 const int kTouchId1 = 8; |
2286 const int kTouchId2 = 2; | 2287 const int kTouchId2 = 2; |
2287 TimedEvents tes; | 2288 TimedEvents tes; |
2288 | 2289 |
2289 ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(5, 5), | 2290 ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(5, 5), |
2290 kTouchId1, tes.Now()); | 2291 kTouchId1, tes.Now()); |
2291 press1.set_source_device_id(1); | 2292 ui::EventTestApi test_press1(&press1); |
| 2293 test_press1.set_source_device_id(1); |
2292 DispatchEventUsingWindowDispatcher(&press1); | 2294 DispatchEventUsingWindowDispatcher(&press1); |
2293 | 2295 |
2294 ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(20, 20), | 2296 ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(20, 20), |
2295 kTouchId2, tes.Now()); | 2297 kTouchId2, tes.Now()); |
2296 press2.set_source_device_id(2); | 2298 ui::EventTestApi test_press2(&press2); |
| 2299 test_press2.set_source_device_id(2); |
2297 DispatchEventUsingWindowDispatcher(&press2); | 2300 DispatchEventUsingWindowDispatcher(&press2); |
2298 | 2301 |
2299 // The second press should not have been locked to the same target as the | 2302 // The second press should not have been locked to the same target as the |
2300 // first, as they occured on different displays. | 2303 // first, as they occured on different displays. |
2301 EXPECT_NE( | 2304 EXPECT_NE( |
2302 ui::GestureRecognizer::Get()->GetTouchLockedTarget(press1), | 2305 ui::GestureRecognizer::Get()->GetTouchLockedTarget(press1), |
2303 ui::GestureRecognizer::Get()->GetTouchLockedTarget(press2)); | 2306 ui::GestureRecognizer::Get()->GetTouchLockedTarget(press2)); |
2304 } | 2307 } |
2305 | 2308 |
2306 // Check that touch events outside the root window are still handled | 2309 // Check that touch events outside the root window are still handled |
(...skipping 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4383 delegate.WaitUntilReceivedGesture(ui::ET_GESTURE_LONG_PRESS); | 4386 delegate.WaitUntilReceivedGesture(ui::ET_GESTURE_LONG_PRESS); |
4384 EXPECT_EQ(NULL, window); | 4387 EXPECT_EQ(NULL, window); |
4385 } | 4388 } |
4386 | 4389 |
4387 INSTANTIATE_TEST_CASE_P(GestureRecognizer, | 4390 INSTANTIATE_TEST_CASE_P(GestureRecognizer, |
4388 GestureRecognizerTest, | 4391 GestureRecognizerTest, |
4389 ::testing::Bool()); | 4392 ::testing::Bool()); |
4390 | 4393 |
4391 } // namespace test | 4394 } // namespace test |
4392 } // namespace aura | 4395 } // namespace aura |
OLD | NEW |