OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/root_window_transformers.h" | 5 #include "ash/display/root_window_transformers.h" |
6 | 6 |
7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/display/display_info.h" | 8 #include "ash/display/display_info.h" |
9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
10 #include "ash/launcher/launcher.h" | 10 #include "ash/launcher/launcher.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 float GetStoredUIScale(int64 id) { | 114 float GetStoredUIScale(int64 id) { |
115 return Shell::GetInstance()->display_manager()->GetDisplayInfo(id).ui_scale(); | 115 return Shell::GetInstance()->display_manager()->GetDisplayInfo(id).ui_scale(); |
116 } | 116 } |
117 | 117 |
118 } // namespace | 118 } // namespace |
119 | 119 |
120 typedef test::AshTestBase AshRootWindowTransformerTest; | 120 typedef test::AshTestBase AshRootWindowTransformerTest; |
121 | 121 |
122 #if defined(OS_WIN) | 122 #if defined(OS_WIN) |
123 // On Win8 bots, the host window can't be resized and | 123 // TODO(scottmg): RootWindow doesn't get resized on Windows |
124 // SetTransform updates the window using the orignal host window | 124 // Ash. http://crbug.com/247916. |
125 // size. | |
126 #define MAYBE_RotateAndMagnify DISABLED_RotateAndMagniy | 125 #define MAYBE_RotateAndMagnify DISABLED_RotateAndMagniy |
127 #define MAYBE_ScaleAndMagnify DISABLED_ScaleAndMagnify | |
128 #define MAYBE_TouchScaleAndMagnify DISABLED_TouchScaleAndMagnify | 126 #define MAYBE_TouchScaleAndMagnify DISABLED_TouchScaleAndMagnify |
129 #define MAYBE_ConvertHostToRootCoords DISABLED_ConvertHostToRootCoords | 127 #define MAYBE_ConvertHostToRootCoords DISABLED_ConvertHostToRootCoords |
130 #else | 128 #else |
131 #define MAYBE_RotateAndMagnify RotateAndMagniy | 129 #define MAYBE_RotateAndMagnify RotateAndMagniy |
132 #define MAYBE_ScaleAndMagnify ScaleAndMagnify | |
133 #define MAYBE_TouchScaleAndMagnify TouchScaleAndMagnify | 130 #define MAYBE_TouchScaleAndMagnify TouchScaleAndMagnify |
134 #define MAYBE_ConvertHostToRootCoords ConvertHostToRootCoords | 131 #define MAYBE_ConvertHostToRootCoords ConvertHostToRootCoords |
135 #endif | 132 #endif |
136 | 133 |
137 TEST_F(AshRootWindowTransformerTest, MAYBE_RotateAndMagnify) { | 134 TEST_F(AshRootWindowTransformerTest, MAYBE_RotateAndMagnify) { |
138 DisplayController* display_controller = | 135 DisplayController* display_controller = |
139 Shell::GetInstance()->display_controller(); | 136 Shell::GetInstance()->display_controller(); |
140 MagnificationController* magnifier = | 137 MagnificationController* magnifier = |
141 Shell::GetInstance()->magnification_controller(); | 138 Shell::GetInstance()->magnification_controller(); |
142 internal::DisplayManager* display_manager = | 139 internal::DisplayManager* display_manager = |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 ScreenAsh::GetSecondaryDisplay().bounds().ToString()); | 219 ScreenAsh::GetSecondaryDisplay().bounds().ToString()); |
223 generator1.MoveMouseToInHost(39, 59); | 220 generator1.MoveMouseToInHost(39, 59); |
224 EXPECT_EQ("70,120", event_handler.GetLocationAndReset()); | 221 EXPECT_EQ("70,120", event_handler.GetLocationAndReset()); |
225 EXPECT_EQ(gfx::Display::ROTATE_180, GetStoredRotation(display1.id())); | 222 EXPECT_EQ(gfx::Display::ROTATE_180, GetStoredRotation(display1.id())); |
226 EXPECT_EQ(gfx::Display::ROTATE_270, GetStoredRotation(display2_id)); | 223 EXPECT_EQ(gfx::Display::ROTATE_270, GetStoredRotation(display2_id)); |
227 magnifier->SetEnabled(false); | 224 magnifier->SetEnabled(false); |
228 | 225 |
229 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); | 226 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); |
230 } | 227 } |
231 | 228 |
232 TEST_F(AshRootWindowTransformerTest, MAYBE_ScaleAndMagnify) { | 229 TEST_F(AshRootWindowTransformerTest, ScaleAndMagnify) { |
| 230 if (!SupportsMultipleDisplays()) |
| 231 return; |
| 232 |
233 TestEventHandler event_handler; | 233 TestEventHandler event_handler; |
234 Shell::GetInstance()->AddPreTargetHandler(&event_handler); | 234 Shell::GetInstance()->AddPreTargetHandler(&event_handler); |
235 | 235 |
236 UpdateDisplay("600x400*2@1.5,500x300"); | 236 UpdateDisplay("600x400*2@1.5,500x300"); |
237 | 237 |
238 gfx::Display display1 = Shell::GetScreen()->GetPrimaryDisplay(); | 238 gfx::Display display1 = Shell::GetScreen()->GetPrimaryDisplay(); |
239 gfx::Display::SetInternalDisplayId(display1.id()); | 239 gfx::Display::SetInternalDisplayId(display1.id()); |
240 gfx::Display display2 = ScreenAsh::GetSecondaryDisplay(); | 240 gfx::Display display2 = ScreenAsh::GetSecondaryDisplay(); |
241 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 241 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
242 MagnificationController* magnifier = | 242 MagnificationController* magnifier = |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 EXPECT_EQ("159,99", event_handler.GetLocationAndReset()); | 389 EXPECT_EQ("159,99", event_handler.GetLocationAndReset()); |
390 | 390 |
391 magnifier->SetEnabled(false); | 391 magnifier->SetEnabled(false); |
392 EXPECT_FLOAT_EQ(1.0f, magnifier->GetScale()); | 392 EXPECT_FLOAT_EQ(1.0f, magnifier->GetScale()); |
393 | 393 |
394 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); | 394 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); |
395 } | 395 } |
396 | 396 |
397 } // namespace test | 397 } // namespace test |
398 } // namespace ash | 398 } // namespace ash |
OLD | NEW |