| 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_controller.h" |
| 8 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
| 10 #include "ash/screen_util.h" |
| 9 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 10 #include "ash/test/ash_test_base.h" | 12 #include "ash/test/ash_test_base.h" |
| 13 #include "ash/test/cursor_manager_test_api.h" |
| 11 #include "ash/test/display_manager_test_api.h" | 14 #include "ash/test/display_manager_test_api.h" |
| 12 #include "ash/test/mirror_window_test_api.h" | 15 #include "ash/test/mirror_window_test_api.h" |
| 13 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 14 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
| 18 #include "ui/aura/env.h" |
| 15 #include "ui/aura/test/test_window_delegate.h" | 19 #include "ui/aura/test/test_window_delegate.h" |
| 16 #include "ui/aura/test/test_windows.h" | 20 #include "ui/aura/test/test_windows.h" |
| 17 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
| 18 #include "ui/aura/window_event_dispatcher.h" | 22 #include "ui/aura/window_event_dispatcher.h" |
| 19 #include "ui/base/hit_test.h" | 23 #include "ui/base/hit_test.h" |
| 20 #include "ui/events/test/event_generator.h" | 24 #include "ui/events/test/event_generator.h" |
| 21 | 25 |
| 22 namespace ash { | 26 namespace ash { |
| 23 | 27 |
| 24 namespace { | 28 namespace { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 47 }; | 51 }; |
| 48 | 52 |
| 49 } | 53 } |
| 50 | 54 |
| 51 typedef test::AshTestBase MirrorWindowControllerTest; | 55 typedef test::AshTestBase MirrorWindowControllerTest; |
| 52 | 56 |
| 53 #if defined(OS_WIN) | 57 #if defined(OS_WIN) |
| 54 // Software mirroring does not work on win. | 58 // Software mirroring does not work on win. |
| 55 #define MAYBE_MirrorCursorBasic DISABLED_MirrorCursorBasic | 59 #define MAYBE_MirrorCursorBasic DISABLED_MirrorCursorBasic |
| 56 #define MAYBE_MirrorCursorLocations DISABLED_MirrorCursorLocations | 60 #define MAYBE_MirrorCursorLocations DISABLED_MirrorCursorLocations |
| 61 #define MAYBE_MirrorCursorMoveOnEnter DISABLED_MirrorCursorMoveOnEnter |
| 57 #define MAYBE_MirrorCursorRotate DISABLED_MirrorCursorRotate | 62 #define MAYBE_MirrorCursorRotate DISABLED_MirrorCursorRotate |
| 58 #define MAYBE_DockMode DISABLED_DockMode | 63 #define MAYBE_DockMode DISABLED_DockMode |
| 59 #define MAYBE_MirrorOnBoot DISABLED_MirrorOnBoot | 64 #define MAYBE_MirrorOnBoot DISABLED_MirrorOnBoot |
| 60 #else | 65 #else |
| 61 #define MAYBE_MirrorCursorBasic MirrorCursorBasic | 66 #define MAYBE_MirrorCursorBasic MirrorCursorBasic |
| 62 #define MAYBE_MirrorCursorLocations MirrorCursorLocations | 67 #define MAYBE_MirrorCursorLocations MirrorCursorLocations |
| 68 #define MAYBE_MirrorCursorMoveOnEnter MirrorCursorMoveOnEnter |
| 63 #define MAYBE_MirrorCursorRotate MirrorCursorRotate | 69 #define MAYBE_MirrorCursorRotate MirrorCursorRotate |
| 64 #define MAYBE_DockMode DockMode | 70 #define MAYBE_DockMode DockMode |
| 65 #define MAYBE_MirrorOnBoot MirrorOnBoot | 71 #define MAYBE_MirrorOnBoot MirrorOnBoot |
| 66 #endif | 72 #endif |
| 67 | 73 |
| 68 TEST_F(MirrorWindowControllerTest, MAYBE_MirrorCursorBasic) { | 74 TEST_F(MirrorWindowControllerTest, MAYBE_MirrorCursorBasic) { |
| 69 test::MirrorWindowTestApi test_api; | 75 test::MirrorWindowTestApi test_api; |
| 70 aura::test::TestWindowDelegate test_window_delegate; | 76 aura::test::TestWindowDelegate test_window_delegate; |
| 71 test_window_delegate.set_window_component(HTTOP); | 77 test_window_delegate.set_window_component(HTTOP); |
| 72 | 78 |
| 73 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 79 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 74 display_manager->SetSecondDisplayMode(DisplayManager::MIRRORING); | 80 display_manager->SetSecondDisplayMode(DisplayManager::MIRRORING); |
| 75 UpdateDisplay("400x400,400x400"); | 81 UpdateDisplay("400x400,400x400"); |
| 76 aura::Window* root = Shell::GetInstance()->GetPrimaryRootWindow(); | 82 aura::Window* root = Shell::GetInstance()->GetPrimaryRootWindow(); |
| 77 scoped_ptr<aura::Window> window(aura::test::CreateTestWindowWithDelegate( | 83 scoped_ptr<aura::Window> window(aura::test::CreateTestWindowWithDelegate( |
| 78 &test_window_delegate, | 84 &test_window_delegate, |
| 79 0, | 85 0, |
| 80 gfx::Rect(50, 50, 100, 100), | 86 gfx::Rect(50, 50, 100, 100), |
| 81 root)); | 87 root)); |
| 82 window->Show(); | 88 window->Show(); |
| 83 window->SetName("foo"); | 89 window->SetName("foo"); |
| 84 | 90 |
| 85 EXPECT_TRUE(test_api.GetCursorWindow()); | 91 EXPECT_TRUE(test_api.GetCursorWindow()); |
| 86 EXPECT_EQ("50,50 100x100", window->bounds().ToString()); | 92 EXPECT_EQ("50,50 100x100", window->bounds().ToString()); |
| 87 | 93 |
| 88 ui::test::EventGenerator generator(root); | 94 ui::test::EventGenerator generator(root); |
| 89 generator.MoveMouseTo(10, 10); | 95 generator.MoveMouseTo(10, 10); |
| 90 | 96 |
| 91 // Test if cursor movement is propertly reflected in mirror window. | 97 // Test if cursor movement is propertly reflected in mirror window. |
| 92 gfx::Point hot_point = test_api.GetCursorHotPoint(); | 98 EXPECT_EQ("4,4", test_api.GetCursorHotPoint().ToString()); |
| 93 gfx::Point cursor_window_origin = | 99 EXPECT_EQ("10,10", |
| 94 test_api.GetCursorWindow()->bounds().origin(); | 100 test_api.GetCursorHotPointLocationInRootWindow().ToString()); |
| 95 EXPECT_EQ("4,4", hot_point.ToString()); | |
| 96 EXPECT_EQ(10 - hot_point.x(), cursor_window_origin.x()); | |
| 97 EXPECT_EQ(10 - hot_point.y(), cursor_window_origin.y()); | |
| 98 EXPECT_EQ(ui::kCursorNull, test_api.GetCurrentCursorType()); | 101 EXPECT_EQ(ui::kCursorNull, test_api.GetCurrentCursorType()); |
| 99 EXPECT_TRUE(test_api.GetCursorWindow()->IsVisible()); | 102 EXPECT_TRUE(test_api.GetCursorWindow()->IsVisible()); |
| 100 | 103 |
| 101 // Test if cursor type change is propertly reflected in mirror window. | 104 // Test if cursor type change is propertly reflected in mirror window. |
| 102 generator.MoveMouseTo(100, 100); | 105 generator.MoveMouseTo(100, 100); |
| 103 hot_point = test_api.GetCursorHotPoint(); | 106 EXPECT_EQ("100,100", |
| 104 cursor_window_origin = test_api.GetCursorWindow()->bounds().origin(); | 107 test_api.GetCursorHotPointLocationInRootWindow().ToString()); |
| 105 EXPECT_EQ(100 - hot_point.x(), cursor_window_origin.x()); | |
| 106 EXPECT_EQ(100 - hot_point.y(), cursor_window_origin.y()); | |
| 107 EXPECT_EQ(ui::kCursorNorthResize, test_api.GetCurrentCursorType()); | 108 EXPECT_EQ(ui::kCursorNorthResize, test_api.GetCurrentCursorType()); |
| 108 | 109 |
| 109 // Test if visibility change is propertly reflected in mirror window. | 110 // Test if visibility change is propertly reflected in mirror window. |
| 110 // A key event hides cursor. | 111 // A key event hides cursor. |
| 111 generator.PressKey(ui::VKEY_A, 0); | 112 generator.PressKey(ui::VKEY_A, 0); |
| 112 generator.ReleaseKey(ui::VKEY_A, 0); | 113 generator.ReleaseKey(ui::VKEY_A, 0); |
| 113 EXPECT_FALSE(test_api.GetCursorWindow()->IsVisible()); | 114 EXPECT_FALSE(test_api.GetCursorWindow()->IsVisible()); |
| 114 | 115 |
| 115 // Mouse event makes it visible again. | 116 // Mouse event makes it visible again. |
| 116 generator.MoveMouseTo(300, 300); | 117 generator.MoveMouseTo(300, 300); |
| 117 hot_point = test_api.GetCursorHotPoint(); | 118 EXPECT_EQ("300,300", |
| 118 cursor_window_origin = test_api.GetCursorWindow()->bounds().origin(); | 119 test_api.GetCursorHotPointLocationInRootWindow().ToString()); |
| 119 EXPECT_EQ(300 - hot_point.x(), cursor_window_origin.x()); | |
| 120 EXPECT_EQ(300 - hot_point.y(), cursor_window_origin.y()); | |
| 121 EXPECT_EQ(ui::kCursorNull, test_api.GetCurrentCursorType()); | 120 EXPECT_EQ(ui::kCursorNull, test_api.GetCurrentCursorType()); |
| 122 EXPECT_TRUE(test_api.GetCursorWindow()->IsVisible()); | 121 EXPECT_TRUE(test_api.GetCursorWindow()->IsVisible()); |
| 123 } | 122 } |
| 124 | 123 |
| 125 TEST_F(MirrorWindowControllerTest, MAYBE_MirrorCursorRotate) { | 124 TEST_F(MirrorWindowControllerTest, MAYBE_MirrorCursorRotate) { |
| 126 test::MirrorWindowTestApi test_api; | 125 test::MirrorWindowTestApi test_api; |
| 127 aura::test::TestWindowDelegate test_window_delegate; | 126 aura::test::TestWindowDelegate test_window_delegate; |
| 128 test_window_delegate.set_window_component(HTTOP); | 127 test_window_delegate.set_window_component(HTTOP); |
| 129 | 128 |
| 130 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 129 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 131 display_manager->SetSecondDisplayMode(DisplayManager::MIRRORING); | 130 display_manager->SetSecondDisplayMode(DisplayManager::MIRRORING); |
| 132 UpdateDisplay("400x400,400x400"); | 131 UpdateDisplay("400x400,400x400"); |
| 133 aura::Window* root = Shell::GetInstance()->GetPrimaryRootWindow(); | 132 aura::Window* root = Shell::GetInstance()->GetPrimaryRootWindow(); |
| 134 scoped_ptr<aura::Window> window(aura::test::CreateTestWindowWithDelegate( | 133 scoped_ptr<aura::Window> window(aura::test::CreateTestWindowWithDelegate( |
| 135 &test_window_delegate, | 134 &test_window_delegate, |
| 136 0, | 135 0, |
| 137 gfx::Rect(50, 50, 100, 100), | 136 gfx::Rect(50, 50, 100, 100), |
| 138 root)); | 137 root)); |
| 139 window->Show(); | 138 window->Show(); |
| 140 window->SetName("foo"); | 139 window->SetName("foo"); |
| 141 | 140 |
| 142 EXPECT_TRUE(test_api.GetCursorWindow()); | 141 EXPECT_TRUE(test_api.GetCursorWindow()); |
| 143 EXPECT_EQ("50,50 100x100", window->bounds().ToString()); | 142 EXPECT_EQ("50,50 100x100", window->bounds().ToString()); |
| 144 | 143 |
| 145 ui::test::EventGenerator generator(root); | 144 ui::test::EventGenerator generator(root); |
| 146 generator.MoveMouseToInHost(100, 100); | 145 generator.MoveMouseToInHost(100, 100); |
| 147 | 146 |
| 148 // Test if cursor movement is propertly reflected in mirror window. | 147 // Test if cursor movement is propertly reflected in mirror window. |
| 149 gfx::Point hot_point = test_api.GetCursorHotPoint(); | 148 EXPECT_EQ("11,12", test_api.GetCursorHotPoint().ToString()); |
| 150 gfx::Point cursor_window_origin = | 149 EXPECT_EQ("100,100", |
| 151 test_api.GetCursorWindow()->bounds().origin(); | 150 test_api.GetCursorHotPointLocationInRootWindow().ToString()); |
| 152 EXPECT_EQ("11,12", hot_point.ToString()); | |
| 153 EXPECT_EQ(100 - hot_point.x(), cursor_window_origin.x()); | |
| 154 EXPECT_EQ(100 - hot_point.y(), cursor_window_origin.y()); | |
| 155 EXPECT_EQ(ui::kCursorNorthResize, test_api.GetCurrentCursorType()); | 151 EXPECT_EQ(ui::kCursorNorthResize, test_api.GetCurrentCursorType()); |
| 156 | 152 |
| 157 UpdateDisplay("400x400/r,400x400"); // 90 degrees. | 153 UpdateDisplay("400x400/r,400x400"); // 90 degrees. |
| 158 generator.MoveMouseToInHost(300, 100); | 154 generator.MoveMouseToInHost(300, 100); |
| 159 hot_point = test_api.GetCursorHotPoint(); | |
| 160 cursor_window_origin = test_api.GetCursorWindow()->bounds().origin(); | |
| 161 EXPECT_EQ(ui::kCursorNorthResize, test_api.GetCurrentCursorType()); | 155 EXPECT_EQ(ui::kCursorNorthResize, test_api.GetCurrentCursorType()); |
| 162 // The size of cursor image is 25x25, so the rotated hot point must | 156 // The size of cursor image is 25x25, so the rotated hot point must |
| 163 // be (25-12, 11). | 157 // be (25-12, 11). |
| 164 EXPECT_EQ("13,11", hot_point.ToString()); | 158 EXPECT_EQ("13,11", test_api.GetCursorHotPoint().ToString()); |
| 165 EXPECT_EQ(300 - hot_point.x(), cursor_window_origin.x()); | 159 EXPECT_EQ("300,100", |
| 166 EXPECT_EQ(100 - hot_point.y(), cursor_window_origin.y()); | 160 test_api.GetCursorHotPointLocationInRootWindow().ToString()); |
| 167 | 161 |
| 168 UpdateDisplay("400x400/u,400x400"); // 180 degrees. | 162 UpdateDisplay("400x400/u,400x400"); // 180 degrees. |
| 169 generator.MoveMouseToInHost(300, 300); | 163 generator.MoveMouseToInHost(300, 300); |
| 170 hot_point = test_api.GetCursorHotPoint(); | |
| 171 cursor_window_origin = test_api.GetCursorWindow()->bounds().origin(); | |
| 172 EXPECT_EQ(ui::kCursorNorthResize, test_api.GetCurrentCursorType()); | 164 EXPECT_EQ(ui::kCursorNorthResize, test_api.GetCurrentCursorType()); |
| 173 // Rotated hot point must be (25-11, 25-12). | 165 // Rotated hot point must be (25-11, 25-12). |
| 174 EXPECT_EQ("14,13", hot_point.ToString()); | 166 EXPECT_EQ("14,13", test_api.GetCursorHotPoint().ToString()); |
| 175 EXPECT_EQ(300 - hot_point.x(), cursor_window_origin.x()); | 167 EXPECT_EQ("300,300", |
| 176 EXPECT_EQ(300 - hot_point.y(), cursor_window_origin.y()); | 168 test_api.GetCursorHotPointLocationInRootWindow().ToString()); |
| 177 | 169 |
| 178 UpdateDisplay("400x400/l,400x400"); // 270 degrees. | 170 UpdateDisplay("400x400/l,400x400"); // 270 degrees. |
| 179 generator.MoveMouseToInHost(100, 300); | 171 generator.MoveMouseToInHost(100, 300); |
| 180 hot_point = test_api.GetCursorHotPoint(); | |
| 181 cursor_window_origin = test_api.GetCursorWindow()->bounds().origin(); | |
| 182 EXPECT_EQ(ui::kCursorNorthResize, test_api.GetCurrentCursorType()); | 172 EXPECT_EQ(ui::kCursorNorthResize, test_api.GetCurrentCursorType()); |
| 183 // Rotated hot point must be (12, 25-11). | 173 // Rotated hot point must be (12, 25-11). |
| 184 EXPECT_EQ("12,14", hot_point.ToString()); | 174 EXPECT_EQ("12,14", test_api.GetCursorHotPoint().ToString()); |
| 185 EXPECT_EQ(100 - hot_point.x(), cursor_window_origin.x()); | 175 EXPECT_EQ("100,300", |
| 186 EXPECT_EQ(300 - hot_point.y(), cursor_window_origin.y()); | 176 test_api.GetCursorHotPointLocationInRootWindow().ToString()); |
| 187 } | 177 } |
| 188 | 178 |
| 189 // Make sure that the mirror cursor's location is same as | 179 // Make sure that the mirror cursor's location is same as |
| 190 // the source display's host location in the mirror root window's | 180 // the source display's host location in the mirror root window's |
| 191 // coordinates. | 181 // coordinates. |
| 192 TEST_F(MirrorWindowControllerTest, MAYBE_MirrorCursorLocations) { | 182 TEST_F(MirrorWindowControllerTest, MAYBE_MirrorCursorLocations) { |
| 193 test::MirrorWindowTestApi test_api; | 183 test::MirrorWindowTestApi test_api; |
| 194 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 184 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 195 display_manager->SetSecondDisplayMode(DisplayManager::MIRRORING); | 185 display_manager->SetSecondDisplayMode(DisplayManager::MIRRORING); |
| 196 | 186 |
| 197 // Test with device scale factor. | 187 // Test with device scale factor. |
| 198 UpdateDisplay("400x600*2,400x600"); | 188 UpdateDisplay("400x600*2,400x600"); |
| 199 | 189 |
| 200 aura::Window* root = Shell::GetInstance()->GetPrimaryRootWindow(); | 190 aura::Window* root = Shell::GetInstance()->GetPrimaryRootWindow(); |
| 201 ui::test::EventGenerator generator(root); | 191 ui::test::EventGenerator generator(root); |
| 202 generator.MoveMouseToInHost(10, 20); | 192 generator.MoveMouseToInHost(10, 20); |
| 203 | 193 |
| 204 gfx::Point hot_point = test_api.GetCursorHotPoint(); | 194 EXPECT_EQ("8,9", test_api.GetCursorHotPoint().ToString()); |
| 205 EXPECT_EQ("8,9", hot_point.ToString()); | 195 EXPECT_EQ("10,20", |
| 206 gfx::Point cursor_window_origin = | 196 test_api.GetCursorHotPointLocationInRootWindow().ToString()); |
| 207 test_api.GetCursorWindow()->bounds().origin(); | |
| 208 EXPECT_EQ(10 - hot_point.x(), cursor_window_origin.x()); | |
| 209 EXPECT_EQ(20 - hot_point.y(), cursor_window_origin.y()); | |
| 210 | 197 |
| 211 // Test with ui scale | 198 // Test with ui scale |
| 212 UpdateDisplay("400x600*0.5,400x600"); | 199 UpdateDisplay("400x600*0.5,400x600"); |
| 213 generator.MoveMouseToInHost(20, 30); | 200 generator.MoveMouseToInHost(20, 30); |
| 214 | 201 |
| 215 hot_point = test_api.GetCursorHotPoint(); | 202 EXPECT_EQ("4,4", test_api.GetCursorHotPoint().ToString()); |
| 216 EXPECT_EQ("4,4", hot_point.ToString()); | 203 EXPECT_EQ("20,30", |
| 217 cursor_window_origin = test_api.GetCursorWindow()->bounds().origin(); | 204 test_api.GetCursorHotPointLocationInRootWindow().ToString()); |
| 218 EXPECT_EQ(20 - hot_point.x(), cursor_window_origin.x()); | |
| 219 EXPECT_EQ(30 - hot_point.y(), cursor_window_origin.y()); | |
| 220 | 205 |
| 221 // Test with rotation | 206 // Test with rotation |
| 222 UpdateDisplay("400x600/r,400x600"); | 207 UpdateDisplay("400x600/r,400x600"); |
| 223 generator.MoveMouseToInHost(30, 40); | 208 generator.MoveMouseToInHost(30, 40); |
| 224 | 209 |
| 225 hot_point = test_api.GetCursorHotPoint(); | 210 EXPECT_EQ("21,4", test_api.GetCursorHotPoint().ToString()); |
| 226 EXPECT_EQ("21,4", hot_point.ToString()); | 211 EXPECT_EQ("30,40", |
| 227 cursor_window_origin = test_api.GetCursorWindow()->bounds().origin(); | 212 test_api.GetCursorHotPointLocationInRootWindow().ToString()); |
| 228 EXPECT_EQ(30 - hot_point.x(), cursor_window_origin.x()); | 213 } |
| 229 EXPECT_EQ(40 - hot_point.y(), cursor_window_origin.y()); | 214 |
| 215 // Test the behavior of the cursor when entering software mirror mode swaps the |
| 216 // cursor's display. |
| 217 TEST_F(MirrorWindowControllerTest, MAYBE_MirrorCursorMoveOnEnter) { |
| 218 aura::Env* env = aura::Env::GetInstance(); |
| 219 Shell* shell = Shell::GetInstance(); |
| 220 DisplayController* display_controller = shell->display_controller(); |
| 221 DisplayManager* display_manager = shell->display_manager(); |
| 222 |
| 223 UpdateDisplay("400x400*2/r,400x400"); |
| 224 int64 primary_display_id = display_controller->GetPrimaryDisplayId(); |
| 225 int64 secondary_display_id = ScreenUtil::GetSecondaryDisplay().id(); |
| 226 test::DisplayManagerTestApi(display_manager) |
| 227 .SetInternalDisplayId(primary_display_id); |
| 228 |
| 229 // Chrome uses the internal display as the source display for software mirror |
| 230 // mode. Move the cursor to the external display. |
| 231 aura::Window* secondary_root_window = |
| 232 display_controller->GetRootWindowForDisplayId(secondary_display_id); |
| 233 secondary_root_window->MoveCursorTo(gfx::Point(100, 200)); |
| 234 EXPECT_EQ("300,200", env->last_mouse_location().ToString()); |
| 235 test::CursorManagerTestApi cursor_test_api(shell->cursor_manager()); |
| 236 EXPECT_EQ(1.0f, cursor_test_api.GetCurrentCursor().device_scale_factor()); |
| 237 EXPECT_EQ(gfx::Display::ROTATE_0, cursor_test_api.GetCurrentCursorRotation()); |
| 238 |
| 239 display_manager->SetSecondDisplayMode(DisplayManager::MIRRORING); |
| 240 UpdateDisplay("400x400*2/r,400x400"); |
| 241 |
| 242 // Entering mirror mode should have centered the cursor on the primary display |
| 243 // because the cursor's previous position is out of bounds. |
| 244 // Check real cursor's position and properties. |
| 245 EXPECT_EQ("100,100", env->last_mouse_location().ToString()); |
| 246 EXPECT_EQ(2.0f, cursor_test_api.GetCurrentCursor().device_scale_factor()); |
| 247 EXPECT_EQ(gfx::Display::ROTATE_90, |
| 248 cursor_test_api.GetCurrentCursorRotation()); |
| 249 |
| 250 // Check mirrored cursor's location. |
| 251 test::MirrorWindowTestApi test_api; |
| 252 gfx::Point hot_point = test_api.GetCursorHotPoint(); |
| 253 // Rotated hot point must be (25-9, 8). |
| 254 EXPECT_EQ("16,8", test_api.GetCursorHotPoint().ToString()); |
| 255 // New coordinates are not (200,200) because (200,200) is not the center of |
| 256 // the display. |
| 257 EXPECT_EQ("199,200", |
| 258 test_api.GetCursorHotPointLocationInRootWindow().ToString()); |
| 230 } | 259 } |
| 231 | 260 |
| 232 // Make sure that the compositor based mirroring can switch | 261 // Make sure that the compositor based mirroring can switch |
| 233 // from/to dock mode. | 262 // from/to dock mode. |
| 234 TEST_F(MirrorWindowControllerTest, MAYBE_DockMode) { | 263 TEST_F(MirrorWindowControllerTest, MAYBE_DockMode) { |
| 235 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 264 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 236 const int64 internal_id = 1; | 265 const int64 internal_id = 1; |
| 237 const int64 external_id = 2; | 266 const int64 external_id = 2; |
| 238 | 267 |
| 239 const DisplayInfo internal_display_info = | 268 const DisplayInfo internal_display_info = |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 307 |
| 279 TEST_F(MirrorOnBootTest, MAYBE_MirrorOnBoot) { | 308 TEST_F(MirrorOnBootTest, MAYBE_MirrorOnBoot) { |
| 280 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 309 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 281 EXPECT_TRUE(display_manager->IsMirrored()); | 310 EXPECT_TRUE(display_manager->IsMirrored()); |
| 282 RunAllPendingInMessageLoop(); | 311 RunAllPendingInMessageLoop(); |
| 283 test::MirrorWindowTestApi test_api; | 312 test::MirrorWindowTestApi test_api; |
| 284 EXPECT_TRUE(test_api.GetHost()); | 313 EXPECT_TRUE(test_api.GetHost()); |
| 285 } | 314 } |
| 286 | 315 |
| 287 } // namespace ash | 316 } // namespace ash |
| OLD | NEW |