| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/mirror_window_controller.h" | 5 #include "ash/display/mirror_window_controller.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
| 9 #include "ash/display/window_tree_host_manager.h" | 9 #include "ash/display/window_tree_host_manager.h" |
| 10 #include "ash/screen_util.h" | 10 #include "ash/screen_util.h" |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 test::ScopedSetInternalDisplayId set_internal(primary_display_id); | 220 test::ScopedSetInternalDisplayId set_internal(primary_display_id); |
| 221 | 221 |
| 222 // Chrome uses the internal display as the source display for software mirror | 222 // Chrome uses the internal display as the source display for software mirror |
| 223 // mode. Move the cursor to the external display. | 223 // mode. Move the cursor to the external display. |
| 224 aura::Window* secondary_root_window = | 224 aura::Window* secondary_root_window = |
| 225 window_tree_host_manager->GetRootWindowForDisplayId(secondary_display_id); | 225 window_tree_host_manager->GetRootWindowForDisplayId(secondary_display_id); |
| 226 secondary_root_window->MoveCursorTo(gfx::Point(100, 200)); | 226 secondary_root_window->MoveCursorTo(gfx::Point(100, 200)); |
| 227 EXPECT_EQ("300,200", env->last_mouse_location().ToString()); | 227 EXPECT_EQ("300,200", env->last_mouse_location().ToString()); |
| 228 test::CursorManagerTestApi cursor_test_api(shell->cursor_manager()); | 228 test::CursorManagerTestApi cursor_test_api(shell->cursor_manager()); |
| 229 EXPECT_EQ(1.0f, cursor_test_api.GetCurrentCursor().device_scale_factor()); | 229 EXPECT_EQ(1.0f, cursor_test_api.GetCurrentCursor().device_scale_factor()); |
| 230 EXPECT_EQ(gfx::Display::ROTATE_0, cursor_test_api.GetCurrentCursorRotation()); | 230 EXPECT_EQ(display::Display::ROTATE_0, |
| 231 cursor_test_api.GetCurrentCursorRotation()); |
| 231 | 232 |
| 232 shell->display_manager()->SetMultiDisplayMode(DisplayManager::MIRRORING); | 233 shell->display_manager()->SetMultiDisplayMode(DisplayManager::MIRRORING); |
| 233 UpdateDisplay("400x400*2/r,400x400"); | 234 UpdateDisplay("400x400*2/r,400x400"); |
| 234 | 235 |
| 235 // Entering mirror mode should have centered the cursor on the primary display | 236 // Entering mirror mode should have centered the cursor on the primary display |
| 236 // because the cursor's previous position is out of bounds. | 237 // because the cursor's previous position is out of bounds. |
| 237 // Check real cursor's position and properties. | 238 // Check real cursor's position and properties. |
| 238 EXPECT_EQ("100,100", env->last_mouse_location().ToString()); | 239 EXPECT_EQ("100,100", env->last_mouse_location().ToString()); |
| 239 EXPECT_EQ(2.0f, cursor_test_api.GetCurrentCursor().device_scale_factor()); | 240 EXPECT_EQ(2.0f, cursor_test_api.GetCurrentCursor().device_scale_factor()); |
| 240 EXPECT_EQ(gfx::Display::ROTATE_90, | 241 EXPECT_EQ(display::Display::ROTATE_90, |
| 241 cursor_test_api.GetCurrentCursorRotation()); | 242 cursor_test_api.GetCurrentCursorRotation()); |
| 242 | 243 |
| 243 // Check mirrored cursor's location. | 244 // Check mirrored cursor's location. |
| 244 test::MirrorWindowTestApi test_api; | 245 test::MirrorWindowTestApi test_api; |
| 245 gfx::Point hot_point = test_api.GetCursorHotPoint(); | 246 gfx::Point hot_point = test_api.GetCursorHotPoint(); |
| 246 // Rotated hot point must be (25-7, 7). | 247 // Rotated hot point must be (25-7, 7). |
| 247 EXPECT_EQ("18,7", test_api.GetCursorHotPoint().ToString()); | 248 EXPECT_EQ("18,7", test_api.GetCursorHotPoint().ToString()); |
| 248 // New coordinates are not (200,200) because (200,200) is not the center of | 249 // New coordinates are not (200,200) because (200,200) is not the center of |
| 249 // the display. | 250 // the display. |
| 250 EXPECT_EQ("199,200", | 251 EXPECT_EQ("199,200", |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 300 |
| 300 TEST_F(MirrorOnBootTest, MAYBE_MirrorOnBoot) { | 301 TEST_F(MirrorOnBootTest, MAYBE_MirrorOnBoot) { |
| 301 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 302 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 302 EXPECT_TRUE(display_manager->IsInMirrorMode()); | 303 EXPECT_TRUE(display_manager->IsInMirrorMode()); |
| 303 RunAllPendingInMessageLoop(); | 304 RunAllPendingInMessageLoop(); |
| 304 test::MirrorWindowTestApi test_api; | 305 test::MirrorWindowTestApi test_api; |
| 305 EXPECT_TRUE(test_api.GetHost()); | 306 EXPECT_TRUE(test_api.GetHost()); |
| 306 } | 307 } |
| 307 | 308 |
| 308 } // namespace ash | 309 } // namespace ash |
| OLD | NEW |