| 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_manager.h" | 5 #include "ash/display/display_manager.h" |
| 6 | 6 |
| 7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/display/display_layout_store.h" | 8 #include "ash/display/display_layout_store.h" |
| 9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "ash/test/ash_test_base.h" | 11 #include "ash/test/ash_test_base.h" |
| 12 #include "ash/test/display_manager_test_api.h" | 12 #include "ash/test/display_manager_test_api.h" |
| 13 #include "ash/test/mirror_window_test_api.h" | 13 #include "ash/test/mirror_window_test_api.h" |
| 14 #include "base/format_macros.h" | 14 #include "base/format_macros.h" |
| 15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
| 17 #include "ui/aura/env.h" | 17 #include "ui/aura/env.h" |
| 18 #include "ui/aura/test/event_generator.h" |
| 18 #include "ui/aura/window_observer.h" | 19 #include "ui/aura/window_observer.h" |
| 19 #include "ui/aura/window_tree_host.h" | 20 #include "ui/aura/window_tree_host.h" |
| 20 #include "ui/events/test/event_generator.h" | 21 #include "ui/gfx/display_observer.h" |
| 21 #include "ui/gfx/display.h" | 22 #include "ui/gfx/display.h" |
| 22 #include "ui/gfx/display_observer.h" | |
| 23 #include "ui/gfx/screen.h" | 23 #include "ui/gfx/screen.h" |
| 24 #include "ui/gfx/screen_type_delegate.h" | 24 #include "ui/gfx/screen_type_delegate.h" |
| 25 | 25 |
| 26 namespace ash { | 26 namespace ash { |
| 27 | 27 |
| 28 using std::vector; | 28 using std::vector; |
| 29 using std::string; | 29 using std::string; |
| 30 | 30 |
| 31 using base::StringPrintf; | 31 using base::StringPrintf; |
| 32 | 32 |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 #define MAYBE_EnsurePointerInDisplays EnsurePointerInDisplays | 606 #define MAYBE_EnsurePointerInDisplays EnsurePointerInDisplays |
| 607 #define MAYBE_EnsurePointerInDisplays_2ndOnLeft EnsurePointerInDisplays_2ndOnLef
t | 607 #define MAYBE_EnsurePointerInDisplays_2ndOnLeft EnsurePointerInDisplays_2ndOnLef
t |
| 608 #endif | 608 #endif |
| 609 | 609 |
| 610 TEST_F(DisplayManagerTest, MAYBE_EnsurePointerInDisplays) { | 610 TEST_F(DisplayManagerTest, MAYBE_EnsurePointerInDisplays) { |
| 611 UpdateDisplay("200x200,300x300"); | 611 UpdateDisplay("200x200,300x300"); |
| 612 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 612 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 613 | 613 |
| 614 aura::Env* env = aura::Env::GetInstance(); | 614 aura::Env* env = aura::Env::GetInstance(); |
| 615 | 615 |
| 616 ui::test::EventGenerator generator(root_windows[0]); | 616 aura::test::EventGenerator generator(root_windows[0]); |
| 617 | 617 |
| 618 // Set the initial position. | 618 // Set the initial position. |
| 619 generator.MoveMouseToInHost(350, 150); | 619 generator.MoveMouseToInHost(350, 150); |
| 620 EXPECT_EQ("350,150", env->last_mouse_location().ToString()); | 620 EXPECT_EQ("350,150", env->last_mouse_location().ToString()); |
| 621 | 621 |
| 622 // A mouse pointer will stay in the 2nd display. | 622 // A mouse pointer will stay in the 2nd display. |
| 623 UpdateDisplay("300x300,200x200"); | 623 UpdateDisplay("300x300,200x200"); |
| 624 EXPECT_EQ("450,50", env->last_mouse_location().ToString()); | 624 EXPECT_EQ("450,50", env->last_mouse_location().ToString()); |
| 625 | 625 |
| 626 // A mouse pointer will be outside of displays and move to the | 626 // A mouse pointer will be outside of displays and move to the |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 #else | 1012 #else |
| 1013 #define MAYBE_UpdateMouseCursorAfterRotateZoom UpdateMouseCursorAfterRotateZoom | 1013 #define MAYBE_UpdateMouseCursorAfterRotateZoom UpdateMouseCursorAfterRotateZoom |
| 1014 #endif | 1014 #endif |
| 1015 | 1015 |
| 1016 TEST_F(DisplayManagerTest, MAYBE_UpdateMouseCursorAfterRotateZoom) { | 1016 TEST_F(DisplayManagerTest, MAYBE_UpdateMouseCursorAfterRotateZoom) { |
| 1017 // Make sure just rotating will not change native location. | 1017 // Make sure just rotating will not change native location. |
| 1018 UpdateDisplay("300x200,200x150"); | 1018 UpdateDisplay("300x200,200x150"); |
| 1019 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 1019 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 1020 aura::Env* env = aura::Env::GetInstance(); | 1020 aura::Env* env = aura::Env::GetInstance(); |
| 1021 | 1021 |
| 1022 ui::test::EventGenerator generator1(root_windows[0]); | 1022 aura::test::EventGenerator generator1(root_windows[0]); |
| 1023 ui::test::EventGenerator generator2(root_windows[1]); | 1023 aura::test::EventGenerator generator2(root_windows[1]); |
| 1024 | 1024 |
| 1025 // Test on 1st display. | 1025 // Test on 1st display. |
| 1026 generator1.MoveMouseToInHost(150, 50); | 1026 generator1.MoveMouseToInHost(150, 50); |
| 1027 EXPECT_EQ("150,50", env->last_mouse_location().ToString()); | 1027 EXPECT_EQ("150,50", env->last_mouse_location().ToString()); |
| 1028 UpdateDisplay("300x200/r,200x150"); | 1028 UpdateDisplay("300x200/r,200x150"); |
| 1029 EXPECT_EQ("50,149", env->last_mouse_location().ToString()); | 1029 EXPECT_EQ("50,149", env->last_mouse_location().ToString()); |
| 1030 | 1030 |
| 1031 // Test on 2nd display. | 1031 // Test on 2nd display. |
| 1032 generator2.MoveMouseToInHost(50, 100); | 1032 generator2.MoveMouseToInHost(50, 100); |
| 1033 EXPECT_EQ("250,100", env->last_mouse_location().ToString()); | 1033 EXPECT_EQ("250,100", env->last_mouse_location().ToString()); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1281 DISALLOW_COPY_AND_ASSIGN(ScreenShutdownTest); | 1281 DISALLOW_COPY_AND_ASSIGN(ScreenShutdownTest); |
| 1282 }; | 1282 }; |
| 1283 | 1283 |
| 1284 TEST_F(ScreenShutdownTest, ScreenAfterShutdown) { | 1284 TEST_F(ScreenShutdownTest, ScreenAfterShutdown) { |
| 1285 if (!SupportsMultipleDisplays()) | 1285 if (!SupportsMultipleDisplays()) |
| 1286 return; | 1286 return; |
| 1287 UpdateDisplay("500x300,800x400"); | 1287 UpdateDisplay("500x300,800x400"); |
| 1288 } | 1288 } |
| 1289 | 1289 |
| 1290 } // namespace ash | 1290 } // namespace ash |
| OLD | NEW |