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_aura.h" | 7 #include "ash/accelerators/accelerator_commands_aura.h" |
8 #include "ash/common/material_design/material_design_controller.h" | 8 #include "ash/common/material_design/material_design_controller.h" |
9 #include "ash/common/wm/window_state.h" | 9 #include "ash/common/wm/window_state.h" |
10 #include "ash/display/display_configuration_controller.h" | 10 #include "ash/display/display_configuration_controller.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/display/mirror_window_controller.h" |
13 #include "ash/display/window_tree_host_manager.h" | 13 #include "ash/display/window_tree_host_manager.h" |
14 #include "ash/screen_util.h" | 14 #include "ash/screen_util.h" |
15 #include "ash/shell.h" | 15 #include "ash/shell.h" |
16 #include "ash/test/ash_md_test_base.h" | 16 #include "ash/test/ash_md_test_base.h" |
17 #include "ash/test/ash_test_base.h" | 17 #include "ash/test/ash_test_base.h" |
18 #include "ash/test/display_manager_test_api.h" | 18 #include "ash/test/display_manager_test_api.h" |
19 #include "ash/test/mirror_window_test_api.h" | 19 #include "ash/test/mirror_window_test_api.h" |
20 #include "ash/wm/window_state_aura.h" | 20 #include "ash/wm/window_state_aura.h" |
21 #include "base/command_line.h" | 21 #include "base/command_line.h" |
22 #include "base/format_macros.h" | 22 #include "base/format_macros.h" |
23 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
24 #include "base/strings/stringprintf.h" | 24 #include "base/strings/stringprintf.h" |
| 25 #include "build/build_config.h" |
25 #include "grit/ash_strings.h" | 26 #include "grit/ash_strings.h" |
26 #include "ui/aura/client/aura_constants.h" | 27 #include "ui/aura/client/aura_constants.h" |
27 #include "ui/aura/env.h" | 28 #include "ui/aura/env.h" |
28 #include "ui/aura/window_observer.h" | 29 #include "ui/aura/window_observer.h" |
29 #include "ui/aura/window_tree_host.h" | 30 #include "ui/aura/window_tree_host.h" |
30 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
31 #include "ui/display/display.h" | 32 #include "ui/display/display.h" |
32 #include "ui/display/display_observer.h" | 33 #include "ui/display/display_observer.h" |
33 #include "ui/display/display_switches.h" | 34 #include "ui/display/display_switches.h" |
34 #include "ui/display/manager/display_layout_builder.h" | 35 #include "ui/display/manager/display_layout_builder.h" |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 display_manager()->SetOverscanInsets(display2_id, gfx::Insets(1, 0, 0, 0)); | 620 display_manager()->SetOverscanInsets(display2_id, gfx::Insets(1, 0, 0, 0)); |
620 EXPECT_EQ(1u, changed().size()); | 621 EXPECT_EQ(1u, changed().size()); |
621 EXPECT_EQ(display2_id, changed()[0].id()); | 622 EXPECT_EQ(display2_id, changed()[0].id()); |
622 | 623 |
623 reset(); | 624 reset(); |
624 display_manager()->SetOverscanInsets(display2_id, gfx::Insets(0, 0, 0, 0)); | 625 display_manager()->SetOverscanInsets(display2_id, gfx::Insets(0, 0, 0, 0)); |
625 EXPECT_EQ(1u, changed().size()); | 626 EXPECT_EQ(1u, changed().size()); |
626 EXPECT_EQ(display2_id, changed()[0].id()); | 627 EXPECT_EQ(display2_id, changed()[0].id()); |
627 } | 628 } |
628 | 629 |
| 630 #if !defined(OS_WIN) |
| 631 // Disabled on windows because of http://crbug.com/650326. |
629 TEST_P(DisplayManagerTest, TestDeviceScaleOnlyChange) { | 632 TEST_P(DisplayManagerTest, TestDeviceScaleOnlyChange) { |
630 if (!SupportsHostWindowResize()) | |
631 return; | |
632 | |
633 UpdateDisplay("1000x600"); | 633 UpdateDisplay("1000x600"); |
634 aura::WindowTreeHost* host = Shell::GetPrimaryRootWindow()->GetHost(); | 634 aura::WindowTreeHost* host = Shell::GetPrimaryRootWindow()->GetHost(); |
635 EXPECT_EQ(1, host->compositor()->device_scale_factor()); | 635 EXPECT_EQ(1, host->compositor()->device_scale_factor()); |
636 EXPECT_EQ("1000x600", | 636 EXPECT_EQ("1000x600", |
637 Shell::GetPrimaryRootWindow()->bounds().size().ToString()); | 637 Shell::GetPrimaryRootWindow()->bounds().size().ToString()); |
638 EXPECT_EQ("1 0 0", GetCountSummary()); | 638 EXPECT_EQ("1 0 0", GetCountSummary()); |
639 | 639 |
640 UpdateDisplay("1000x600*2"); | 640 UpdateDisplay("1000x600*2"); |
641 EXPECT_EQ(2, host->compositor()->device_scale_factor()); | 641 EXPECT_EQ(2, host->compositor()->device_scale_factor()); |
642 EXPECT_EQ("2 0 0", GetCountSummary()); | 642 EXPECT_EQ("2 0 0", GetCountSummary()); |
643 EXPECT_EQ("500x300", | 643 EXPECT_EQ("500x300", |
644 Shell::GetPrimaryRootWindow()->bounds().size().ToString()); | 644 Shell::GetPrimaryRootWindow()->bounds().size().ToString()); |
645 } | 645 } |
| 646 #endif |
646 | 647 |
647 display::ManagedDisplayInfo CreateDisplayInfo(int64_t id, | 648 display::ManagedDisplayInfo CreateDisplayInfo(int64_t id, |
648 const gfx::Rect& bounds) { | 649 const gfx::Rect& bounds) { |
649 display::ManagedDisplayInfo info(id, ToDisplayName(id), false); | 650 display::ManagedDisplayInfo info(id, ToDisplayName(id), false); |
650 info.SetBounds(bounds); | 651 info.SetBounds(bounds); |
651 return info; | 652 return info; |
652 } | 653 } |
653 | 654 |
654 TEST_P(DisplayManagerTest, TestNativeDisplaysChanged) { | 655 TEST_P(DisplayManagerTest, TestNativeDisplaysChanged) { |
655 const int64_t internal_display_id = | 656 const int64_t internal_display_id = |
(...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2371 const display::DisplayLayout& stored = | 2372 const display::DisplayLayout& stored = |
2372 layout_store->GetRegisteredDisplayLayout(list); | 2373 layout_store->GetRegisteredDisplayLayout(list); |
2373 | 2374 |
2374 EXPECT_EQ(id1, stored.placement_list[0].parent_display_id); | 2375 EXPECT_EQ(id1, stored.placement_list[0].parent_display_id); |
2375 EXPECT_EQ(id2, stored.placement_list[0].display_id); | 2376 EXPECT_EQ(id2, stored.placement_list[0].display_id); |
2376 } | 2377 } |
2377 | 2378 |
2378 #endif // OS_CHROMEOS | 2379 #endif // OS_CHROMEOS |
2379 | 2380 |
2380 } // namespace ash | 2381 } // namespace ash |
OLD | NEW |