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/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/display/display_controller.h" | 8 #include "ash/display/display_controller.h" |
9 #include "ash/display/display_info.h" | 9 #include "ash/display/display_info.h" |
10 #include "ash/display/display_layout_store.h" | 10 #include "ash/display/display_layout_store.h" |
11 #include "ash/display/display_util.h" | 11 #include "ash/display/display_util.h" |
| 12 #include "ash/display/mirror_window_controller.h" |
12 #include "ash/screen_util.h" | 13 #include "ash/screen_util.h" |
13 #include "ash/shell.h" | 14 #include "ash/shell.h" |
14 #include "ash/test/ash_test_base.h" | 15 #include "ash/test/ash_test_base.h" |
15 #include "ash/test/display_manager_test_api.h" | 16 #include "ash/test/display_manager_test_api.h" |
16 #include "ash/test/mirror_window_test_api.h" | 17 #include "ash/test/mirror_window_test_api.h" |
17 #include "base/command_line.h" | 18 #include "base/command_line.h" |
18 #include "base/format_macros.h" | 19 #include "base/format_macros.h" |
19 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
20 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
21 #include "ui/aura/env.h" | 22 #include "ui/aura/env.h" |
(...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1335 | 1336 |
1336 // Overscan insets are ignored. | 1337 // Overscan insets are ignored. |
1337 UpdateDisplay("400x600/o,600x800/o"); | 1338 UpdateDisplay("400x600/o,600x800/o"); |
1338 EXPECT_FALSE(display_observer.changed_and_reset()); | 1339 EXPECT_FALSE(display_observer.changed_and_reset()); |
1339 EXPECT_EQ("400x600", | 1340 EXPECT_EQ("400x600", |
1340 test_api.GetHost()->window()->bounds().size().ToString()); | 1341 test_api.GetHost()->window()->bounds().size().ToString()); |
1341 | 1342 |
1342 Shell::GetScreen()->RemoveObserver(&display_observer); | 1343 Shell::GetScreen()->RemoveObserver(&display_observer); |
1343 } | 1344 } |
1344 | 1345 |
| 1346 TEST_F(DisplayManagerTest, SingleDisplayToSoftwareMirroring) { |
| 1347 if (!SupportsMultipleDisplays()) |
| 1348 return; |
| 1349 UpdateDisplay("600x400"); |
| 1350 |
| 1351 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 1352 display_manager->SetSecondDisplayMode(DisplayManager::MIRRORING); |
| 1353 UpdateDisplay("600x400,600x400"); |
| 1354 |
| 1355 EXPECT_TRUE(display_manager->IsMirrored()); |
| 1356 EXPECT_EQ(1U, display_manager->GetNumDisplays()); |
| 1357 DisplayController* display_controller = |
| 1358 ash::Shell::GetInstance()->display_controller(); |
| 1359 EXPECT_TRUE(display_controller->mirror_window_controller()->GetWindow()); |
| 1360 |
| 1361 UpdateDisplay("600x400"); |
| 1362 EXPECT_FALSE(display_manager->IsMirrored()); |
| 1363 EXPECT_EQ(1U, display_manager->GetNumDisplays()); |
| 1364 EXPECT_FALSE(display_controller->mirror_window_controller()->GetWindow()); |
| 1365 } |
| 1366 |
1345 #if defined(OS_CHROMEOS) | 1367 #if defined(OS_CHROMEOS) |
1346 // Make sure this does not cause any crashes. See http://crbug.com/412910 | 1368 // Make sure this does not cause any crashes. See http://crbug.com/412910 |
1347 // This test is limited to OS_CHROMEOS because CursorCompositingEnabled is only | 1369 // This test is limited to OS_CHROMEOS because CursorCompositingEnabled is only |
1348 // for ChromeOS. | 1370 // for ChromeOS. |
1349 TEST_F(DisplayManagerTest, SoftwareMirroringWithCompositingCursor) { | 1371 TEST_F(DisplayManagerTest, SoftwareMirroringWithCompositingCursor) { |
1350 if (!SupportsMultipleDisplays()) | 1372 if (!SupportsMultipleDisplays()) |
1351 return; | 1373 return; |
1352 | 1374 |
1353 UpdateDisplay("300x400,400x500"); | 1375 UpdateDisplay("300x400,400x500"); |
1354 | 1376 |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1678 1.25f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); | 1700 1.25f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); |
1679 EXPECT_TRUE(IsTextSubpixelPositioningEnabled()); | 1701 EXPECT_TRUE(IsTextSubpixelPositioningEnabled()); |
1680 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); | 1702 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); |
1681 | 1703 |
1682 DisplayInfo::SetUse125DSFForUIScaling(false); | 1704 DisplayInfo::SetUse125DSFForUIScaling(false); |
1683 } | 1705 } |
1684 | 1706 |
1685 #endif // OS_CHROMEOS | 1707 #endif // OS_CHROMEOS |
1686 | 1708 |
1687 } // namespace ash | 1709 } // namespace ash |
OLD | NEW |