| 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/accelerators/accelerator_commands.h" | 7 #include "ash/accelerators/accelerator_commands.h" |
| 8 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
| 9 #include "ash/display/display_configuration_controller.h" |
| 9 #include "ash/display/display_info.h" | 10 #include "ash/display/display_info.h" |
| 10 #include "ash/display/display_layout_store.h" | 11 #include "ash/display/display_layout_store.h" |
| 11 #include "ash/display/display_util.h" | 12 #include "ash/display/display_util.h" |
| 12 #include "ash/display/mirror_window_controller.h" | 13 #include "ash/display/mirror_window_controller.h" |
| 13 #include "ash/display/window_tree_host_manager.h" | 14 #include "ash/display/window_tree_host_manager.h" |
| 14 #include "ash/screen_util.h" | 15 #include "ash/screen_util.h" |
| 15 #include "ash/shell.h" | 16 #include "ash/shell.h" |
| 16 #include "ash/test/ash_test_base.h" | 17 #include "ash/test/ash_test_base.h" |
| 17 #include "ash/test/display_manager_test_api.h" | 18 #include "ash/test/display_manager_test_api.h" |
| 18 #include "ash/test/mirror_window_test_api.h" | 19 #include "ash/test/mirror_window_test_api.h" |
| 19 #include "ash/wm/common/window_state.h" | 20 #include "ash/wm/common/window_state.h" |
| 20 #include "ash/wm/window_state_aura.h" | 21 #include "ash/wm/window_state_aura.h" |
| 21 #include "base/command_line.h" | 22 #include "base/command_line.h" |
| 22 #include "base/format_macros.h" | 23 #include "base/format_macros.h" |
| 23 #include "base/strings/string_number_conversions.h" | 24 #include "base/strings/string_number_conversions.h" |
| 24 #include "base/strings/stringprintf.h" | 25 #include "base/strings/stringprintf.h" |
| 26 #include "grit/ash_strings.h" |
| 25 #include "ui/aura/client/aura_constants.h" | 27 #include "ui/aura/client/aura_constants.h" |
| 26 #include "ui/aura/env.h" | 28 #include "ui/aura/env.h" |
| 27 #include "ui/aura/window_observer.h" | 29 #include "ui/aura/window_observer.h" |
| 28 #include "ui/aura/window_tree_host.h" | 30 #include "ui/aura/window_tree_host.h" |
| 31 #include "ui/base/l10n/l10n_util.h" |
| 29 #include "ui/display/display.h" | 32 #include "ui/display/display.h" |
| 30 #include "ui/display/display_observer.h" | 33 #include "ui/display/display_observer.h" |
| 31 #include "ui/display/manager/display_layout_builder.h" | 34 #include "ui/display/manager/display_layout_builder.h" |
| 32 #include "ui/display/screen.h" | 35 #include "ui/display/screen.h" |
| 33 #include "ui/events/test/event_generator.h" | 36 #include "ui/events/test/event_generator.h" |
| 34 #include "ui/gfx/font_render_params.h" | 37 #include "ui/gfx/font_render_params.h" |
| 35 | 38 |
| 36 namespace ash { | 39 namespace ash { |
| 37 | 40 |
| 38 using std::vector; | 41 using std::vector; |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 EXPECT_EQ("-280,680 320x200", | 449 EXPECT_EQ("-280,680 320x200", |
| 447 display_manager()->GetDisplayAt(1).bounds().ToString()); | 450 display_manager()->GetDisplayAt(1).bounds().ToString()); |
| 448 } | 451 } |
| 449 } | 452 } |
| 450 | 453 |
| 451 TEST_F(DisplayManagerTest, NoMirrorInThreeDisplays) { | 454 TEST_F(DisplayManagerTest, NoMirrorInThreeDisplays) { |
| 452 if (!SupportsMultipleDisplays()) | 455 if (!SupportsMultipleDisplays()) |
| 453 return; | 456 return; |
| 454 | 457 |
| 455 UpdateDisplay("640x480,320x200,400x300"); | 458 UpdateDisplay("640x480,320x200,400x300"); |
| 456 display_manager()->SetMirrorMode(true); | 459 ash::Shell::GetInstance()->display_configuration_controller()->SetMirrorMode( |
| 460 true, true); |
| 457 EXPECT_FALSE(display_manager()->IsInMirrorMode()); | 461 EXPECT_FALSE(display_manager()->IsInMirrorMode()); |
| 458 EXPECT_EQ(3u, display_manager()->GetNumDisplays()); | 462 EXPECT_EQ(3u, display_manager()->GetNumDisplays()); |
| 463 #if defined(OS_CHROMEOS) |
| 464 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_MIRRORING_NOT_SUPPORTED), |
| 465 GetDisplayErrorNotificationMessageForTest()); |
| 466 #endif |
| 459 } | 467 } |
| 460 | 468 |
| 461 TEST_F(DisplayManagerTest, OverscanInsetsTest) { | 469 TEST_F(DisplayManagerTest, OverscanInsetsTest) { |
| 462 if (!SupportsMultipleDisplays()) | 470 if (!SupportsMultipleDisplays()) |
| 463 return; | 471 return; |
| 464 | 472 |
| 465 UpdateDisplay("0+0-500x500,0+501-400x400"); | 473 UpdateDisplay("0+0-500x500,0+501-400x400"); |
| 466 reset(); | 474 reset(); |
| 467 ASSERT_EQ(2u, display_manager()->GetNumDisplays()); | 475 ASSERT_EQ(2u, display_manager()->GetNumDisplays()); |
| 468 const DisplayInfo& display_info1 = GetDisplayInfoAt(0); | 476 const DisplayInfo& display_info1 = GetDisplayInfoAt(0); |
| (...skipping 1830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2299 const display::DisplayLayout& stored = | 2307 const display::DisplayLayout& stored = |
| 2300 layout_store->GetRegisteredDisplayLayout(list); | 2308 layout_store->GetRegisteredDisplayLayout(list); |
| 2301 | 2309 |
| 2302 EXPECT_EQ(id1, stored.placement_list[0].parent_display_id); | 2310 EXPECT_EQ(id1, stored.placement_list[0].parent_display_id); |
| 2303 EXPECT_EQ(id2, stored.placement_list[0].display_id); | 2311 EXPECT_EQ(id2, stored.placement_list[0].display_id); |
| 2304 } | 2312 } |
| 2305 | 2313 |
| 2306 #endif // OS_CHROMEOS | 2314 #endif // OS_CHROMEOS |
| 2307 | 2315 |
| 2308 } // namespace ash | 2316 } // namespace ash |
| OLD | NEW |