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/display/display_controller.h" | 5 #include "ash/display/display_controller.h" |
6 #include "ash/display/display_manager.h" | 6 #include "ash/display/display_manager.h" |
| 7 #include "ash/root_window_controller.h" |
7 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
8 #include "ash/shell.h" | 9 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
10 #include "ash/system/tray/system_tray.h" | 11 #include "ash/system/tray/system_tray.h" |
11 #include "ash/test/ash_test_base.h" | 12 #include "ash/test/ash_test_base.h" |
12 #include "ash/wm/coordinate_conversion.h" | 13 #include "ash/wm/coordinate_conversion.h" |
13 #include "ash/wm/property_util.h" | 14 #include "ash/wm/property_util.h" |
14 #include "ash/wm/window_cycle_controller.h" | 15 #include "ash/wm/window_cycle_controller.h" |
15 #include "ash/wm/window_properties.h" | 16 #include "ash/wm/window_properties.h" |
16 #include "ash/wm/window_util.h" | 17 #include "ash/wm/window_util.h" |
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 } | 801 } |
801 | 802 |
802 TEST_F(ExtendedDesktopTest, PassiveGrab) { | 803 TEST_F(ExtendedDesktopTest, PassiveGrab) { |
803 if (!SupportsMultipleDisplays()) | 804 if (!SupportsMultipleDisplays()) |
804 return; | 805 return; |
805 | 806 |
806 EventLocationRecordingEventHandler event_handler; | 807 EventLocationRecordingEventHandler event_handler; |
807 ash::Shell::GetInstance()->AddPreTargetHandler(&event_handler); | 808 ash::Shell::GetInstance()->AddPreTargetHandler(&event_handler); |
808 | 809 |
809 UpdateDisplay("300x300,200x200"); | 810 UpdateDisplay("300x300,200x200"); |
| 811 // close all notification for display change. Otherwise some event may |
| 812 // happen on the notification bubble, which breaks the test expectation. |
| 813 // TODO(mukai): remove this when the display change notification has moved |
| 814 // to the message_center. |
| 815 Shell::RootWindowControllerList root_controllers = |
| 816 Shell::GetAllRootWindowControllers(); |
| 817 for (size_t i = 0; i < root_controllers.size(); ++i) |
| 818 root_controllers[i]->GetSystemTray()->CloseNotificationBubbleForTest(); |
810 | 819 |
811 views::Widget* widget = CreateTestWidget(gfx::Rect(50, 50, 200, 200)); | 820 views::Widget* widget = CreateTestWidget(gfx::Rect(50, 50, 200, 200)); |
812 widget->Show(); | 821 widget->Show(); |
813 ASSERT_EQ("50,50 200x200", widget->GetWindowBoundsInScreen().ToString()); | 822 ASSERT_EQ("50,50 200x200", widget->GetWindowBoundsInScreen().ToString()); |
814 | 823 |
815 aura::test::EventGenerator& generator(GetEventGenerator()); | 824 aura::test::EventGenerator& generator(GetEventGenerator()); |
816 generator.MoveMouseTo(150, 150); | 825 generator.MoveMouseTo(150, 150); |
817 EXPECT_EQ("100,100 150,150", event_handler.GetLocationsAndReset()); | 826 EXPECT_EQ("100,100 150,150", event_handler.GetLocationsAndReset()); |
818 | 827 |
819 generator.PressLeftButton(); | 828 generator.PressLeftButton(); |
820 generator.MoveMouseTo(400, 150); | 829 generator.MoveMouseTo(400, 150); |
821 | 830 |
822 EXPECT_EQ("350,100 400,150", event_handler.GetLocationsAndReset()); | 831 EXPECT_EQ("350,100 400,150", event_handler.GetLocationsAndReset()); |
823 | 832 |
824 generator.ReleaseLeftButton(); | 833 generator.ReleaseLeftButton(); |
825 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset()); | 834 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset()); |
826 | 835 |
827 generator.MoveMouseTo(400, 150); | 836 generator.MoveMouseTo(400, 150); |
828 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset()); | 837 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset()); |
829 | 838 |
830 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler); | 839 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler); |
831 } | 840 } |
832 | 841 |
833 } // namespace internal | 842 } // namespace internal |
834 } // namespace ash | 843 } // namespace ash |
OLD | NEW |