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 "ash/wm/system_gesture_event_filter.h" | 5 #include "ash/wm/system_gesture_event_filter.h" |
6 | 6 |
7 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
8 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
10 #include "ash/shelf/shelf.h" | 10 #include "ash/shelf/shelf.h" |
11 #include "ash/shelf/shelf_model.h" | 11 #include "ash/shelf/shelf_model.h" |
12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
13 #include "ash/system/tray/system_tray_delegate.h" | 13 #include "ash/system/tray/system_tray_delegate.h" |
14 #include "ash/test/ash_test_base.h" | 14 #include "ash/test/ash_test_base.h" |
15 #include "ash/test/display_manager_test_api.h" | 15 #include "ash/test/display_manager_test_api.h" |
16 #include "ash/test/shell_test_api.h" | 16 #include "ash/test/shell_test_api.h" |
17 #include "ash/test/test_shelf_delegate.h" | 17 #include "ash/test/test_shelf_delegate.h" |
18 #include "ash/wm/gestures/long_press_affordance_handler.h" | 18 #include "ash/wm/gestures/long_press_affordance_handler.h" |
19 #include "ash/wm/window_state.h" | 19 #include "ash/wm/window_state.h" |
20 #include "ash/wm/window_util.h" | 20 #include "ash/wm/window_util.h" |
21 #include "base/command_line.h" | 21 #include "base/command_line.h" |
22 #include "base/time/time.h" | 22 #include "base/time/time.h" |
23 #include "base/timer/timer.h" | 23 #include "base/timer/timer.h" |
24 #include "ui/aura/env.h" | 24 #include "ui/aura/env.h" |
25 #include "ui/aura/test/event_generator.h" | 25 #include "ui/aura/test/event_generator.h" |
26 #include "ui/aura/test/test_event_handler.h" | |
27 #include "ui/aura/test/test_window_delegate.h" | 26 #include "ui/aura/test/test_window_delegate.h" |
28 #include "ui/aura/test/test_windows.h" | 27 #include "ui/aura/test/test_windows.h" |
29 #include "ui/aura/window_event_dispatcher.h" | 28 #include "ui/aura/window_event_dispatcher.h" |
30 #include "ui/base/hit_test.h" | 29 #include "ui/base/hit_test.h" |
31 #include "ui/base/ui_base_switches.h" | 30 #include "ui/base/ui_base_switches.h" |
32 #include "ui/events/event.h" | 31 #include "ui/events/event.h" |
33 #include "ui/events/event_handler.h" | 32 #include "ui/events/event_handler.h" |
34 #include "ui/events/event_utils.h" | 33 #include "ui/events/event_utils.h" |
35 #include "ui/events/gestures/gesture_configuration.h" | 34 #include "ui/events/gestures/gesture_configuration.h" |
| 35 #include "ui/events/test/test_event_handler.h" |
36 #include "ui/gfx/screen.h" | 36 #include "ui/gfx/screen.h" |
37 #include "ui/gfx/size.h" | 37 #include "ui/gfx/size.h" |
38 #include "ui/views/widget/widget_delegate.h" | 38 #include "ui/views/widget/widget_delegate.h" |
39 | 39 |
40 namespace ash { | 40 namespace ash { |
41 namespace test { | 41 namespace test { |
42 | 42 |
43 namespace { | 43 namespace { |
44 | 44 |
45 class ResizableWidgetDelegate : public views::WidgetDelegateView { | 45 class ResizableWidgetDelegate : public views::WidgetDelegateView { |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 | 571 |
572 aura::test::EventCountDelegate delegate; | 572 aura::test::EventCountDelegate delegate; |
573 delegate.set_window_component(HTCLIENT); | 573 delegate.set_window_component(HTCLIENT); |
574 scoped_ptr<aura::Window> child(new aura::Window(&delegate)); | 574 scoped_ptr<aura::Window> child(new aura::Window(&delegate)); |
575 child->SetType(ui::wm::WINDOW_TYPE_CONTROL); | 575 child->SetType(ui::wm::WINDOW_TYPE_CONTROL); |
576 child->Init(aura::WINDOW_LAYER_TEXTURED); | 576 child->Init(aura::WINDOW_LAYER_TEXTURED); |
577 parent->AddChild(child.get()); | 577 parent->AddChild(child.get()); |
578 child->SetBounds(gfx::Rect(100, 100)); | 578 child->SetBounds(gfx::Rect(100, 100)); |
579 child->Show(); | 579 child->Show(); |
580 | 580 |
581 aura::test::TestEventHandler event_handler; | 581 ui::test::TestEventHandler event_handler; |
582 aura::Env::GetInstance()->PrependPreTargetHandler(&event_handler); | 582 aura::Env::GetInstance()->PrependPreTargetHandler(&event_handler); |
583 | 583 |
584 GetEventGenerator().MoveMouseTo(0, 0); | 584 GetEventGenerator().MoveMouseTo(0, 0); |
585 for (int i = 1; i <= 3; ++i) | 585 for (int i = 1; i <= 3; ++i) |
586 GetEventGenerator().PressTouchId(i); | 586 GetEventGenerator().PressTouchId(i); |
587 for (int i = 1; i <= 3; ++i) | 587 for (int i = 1; i <= 3; ++i) |
588 GetEventGenerator().ReleaseTouchId(i); | 588 GetEventGenerator().ReleaseTouchId(i); |
589 EXPECT_EQ(event_handler.num_gesture_events(), | 589 EXPECT_EQ(event_handler.num_gesture_events(), |
590 delegate.GetGestureCountAndReset()); | 590 delegate.GetGestureCountAndReset()); |
591 | 591 |
592 aura::Env::GetInstance()->RemovePreTargetHandler(&event_handler); | 592 aura::Env::GetInstance()->RemovePreTargetHandler(&event_handler); |
593 } | 593 } |
594 | 594 |
595 // Tests run twice - with docked windows disabled or enabled. | 595 // Tests run twice - with docked windows disabled or enabled. |
596 INSTANTIATE_TEST_CASE_P(DockedWindowsDisabledOrEnabled, | 596 INSTANTIATE_TEST_CASE_P(DockedWindowsDisabledOrEnabled, |
597 SystemGestureEventFilterTest, | 597 SystemGestureEventFilterTest, |
598 testing::Bool()); | 598 testing::Bool()); |
599 | 599 |
600 } // namespace test | 600 } // namespace test |
601 } // namespace ash | 601 } // namespace ash |
OLD | NEW |