Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Side by Side Diff: ash/display/display_manager_unittest.cc

Issue 1924703002: Rename gfx::Display/Screen to display::Display/Screen in ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/display/display_manager.cc ('k') | ash/display/display_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_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/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_test_base.h" 16 #include "ash/test/ash_test_base.h"
17 #include "ash/test/display_manager_test_api.h" 17 #include "ash/test/display_manager_test_api.h"
18 #include "ash/test/mirror_window_test_api.h" 18 #include "ash/test/mirror_window_test_api.h"
19 #include "ash/wm/common/window_state.h" 19 #include "ash/wm/common/window_state.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 "ui/aura/client/aura_constants.h" 25 #include "ui/aura/client/aura_constants.h"
26 #include "ui/aura/env.h" 26 #include "ui/aura/env.h"
27 #include "ui/aura/window_observer.h" 27 #include "ui/aura/window_observer.h"
28 #include "ui/aura/window_tree_host.h" 28 #include "ui/aura/window_tree_host.h"
29 #include "ui/display/display.h"
30 #include "ui/display/display_observer.h"
29 #include "ui/display/manager/display_layout_builder.h" 31 #include "ui/display/manager/display_layout_builder.h"
32 #include "ui/display/screen.h"
30 #include "ui/events/test/event_generator.h" 33 #include "ui/events/test/event_generator.h"
31 #include "ui/gfx/display.h"
32 #include "ui/gfx/display_observer.h"
33 #include "ui/gfx/font_render_params.h" 34 #include "ui/gfx/font_render_params.h"
34 #include "ui/gfx/screen.h"
35 35
36 namespace ash { 36 namespace ash {
37 37
38 using std::vector; 38 using std::vector;
39 using std::string; 39 using std::string;
40 40
41 using base::StringPrintf; 41 using base::StringPrintf;
42 42
43 namespace { 43 namespace {
44 44
45 std::string ToDisplayName(int64_t id) { 45 std::string ToDisplayName(int64_t id) {
46 return "x-" + base::Int64ToString(id); 46 return "x-" + base::Int64ToString(id);
47 } 47 }
48 48
49 } // namespace 49 } // namespace
50 50
51 class DisplayManagerTest : public test::AshTestBase, 51 class DisplayManagerTest : public test::AshTestBase,
52 public gfx::DisplayObserver, 52 public display::DisplayObserver,
53 public aura::WindowObserver { 53 public aura::WindowObserver {
54 public: 54 public:
55 DisplayManagerTest() 55 DisplayManagerTest()
56 : removed_count_(0U), 56 : removed_count_(0U),
57 root_window_destroyed_(false), 57 root_window_destroyed_(false),
58 changed_metrics_(0U) { 58 changed_metrics_(0U) {
59 } 59 }
60 ~DisplayManagerTest() override {} 60 ~DisplayManagerTest() override {}
61 61
62 void SetUp() override { 62 void SetUp() override {
63 AshTestBase::SetUp(); 63 AshTestBase::SetUp();
64 gfx::Screen::GetScreen()->AddObserver(this); 64 display::Screen::GetScreen()->AddObserver(this);
65 Shell::GetPrimaryRootWindow()->AddObserver(this); 65 Shell::GetPrimaryRootWindow()->AddObserver(this);
66 } 66 }
67 void TearDown() override { 67 void TearDown() override {
68 Shell::GetPrimaryRootWindow()->RemoveObserver(this); 68 Shell::GetPrimaryRootWindow()->RemoveObserver(this);
69 gfx::Screen::GetScreen()->RemoveObserver(this); 69 display::Screen::GetScreen()->RemoveObserver(this);
70 AshTestBase::TearDown(); 70 AshTestBase::TearDown();
71 } 71 }
72 72
73 DisplayManager* display_manager() { 73 DisplayManager* display_manager() {
74 return Shell::GetInstance()->display_manager(); 74 return Shell::GetInstance()->display_manager();
75 } 75 }
76 const vector<gfx::Display>& changed() const { return changed_; } 76 const vector<display::Display>& changed() const { return changed_; }
77 const vector<gfx::Display>& added() const { return added_; } 77 const vector<display::Display>& added() const { return added_; }
78 uint32_t changed_metrics() const { return changed_metrics_; } 78 uint32_t changed_metrics() const { return changed_metrics_; }
79 79
80 string GetCountSummary() const { 80 string GetCountSummary() const {
81 return StringPrintf("%" PRIuS " %" PRIuS " %" PRIuS, 81 return StringPrintf("%" PRIuS " %" PRIuS " %" PRIuS,
82 changed_.size(), added_.size(), removed_count_); 82 changed_.size(), added_.size(), removed_count_);
83 } 83 }
84 84
85 void reset() { 85 void reset() {
86 changed_.clear(); 86 changed_.clear();
87 added_.clear(); 87 added_.clear();
88 removed_count_ = 0U; 88 removed_count_ = 0U;
89 changed_metrics_ = 0U; 89 changed_metrics_ = 0U;
90 root_window_destroyed_ = false; 90 root_window_destroyed_ = false;
91 } 91 }
92 92
93 bool root_window_destroyed() const { 93 bool root_window_destroyed() const {
94 return root_window_destroyed_; 94 return root_window_destroyed_;
95 } 95 }
96 96
97 const DisplayInfo& GetDisplayInfo(const gfx::Display& display) { 97 const DisplayInfo& GetDisplayInfo(const display::Display& display) {
98 return display_manager()->GetDisplayInfo(display.id()); 98 return display_manager()->GetDisplayInfo(display.id());
99 } 99 }
100 100
101 const DisplayInfo& GetDisplayInfoAt(int index) { 101 const DisplayInfo& GetDisplayInfoAt(int index) {
102 return GetDisplayInfo(display_manager()->GetDisplayAt(index)); 102 return GetDisplayInfo(display_manager()->GetDisplayAt(index));
103 } 103 }
104 104
105 const gfx::Display& GetDisplayForId(int64_t id) { 105 const display::Display& GetDisplayForId(int64_t id) {
106 return display_manager()->GetDisplayForId(id); 106 return display_manager()->GetDisplayForId(id);
107 } 107 }
108 108
109 const DisplayInfo& GetDisplayInfoForId(int64_t id) { 109 const DisplayInfo& GetDisplayInfoForId(int64_t id) {
110 return GetDisplayInfo(display_manager()->GetDisplayForId(id)); 110 return GetDisplayInfo(display_manager()->GetDisplayForId(id));
111 } 111 }
112 112
113 // aura::DisplayObserver overrides: 113 // aura::DisplayObserver overrides:
114 void OnDisplayMetricsChanged(const gfx::Display& display, 114 void OnDisplayMetricsChanged(const display::Display& display,
115 uint32_t changed_metrics) override { 115 uint32_t changed_metrics) override {
116 changed_.push_back(display); 116 changed_.push_back(display);
117 changed_metrics_ |= changed_metrics; 117 changed_metrics_ |= changed_metrics;
118 } 118 }
119 void OnDisplayAdded(const gfx::Display& new_display) override { 119 void OnDisplayAdded(const display::Display& new_display) override {
120 added_.push_back(new_display); 120 added_.push_back(new_display);
121 } 121 }
122 void OnDisplayRemoved(const gfx::Display& old_display) override { 122 void OnDisplayRemoved(const display::Display& old_display) override {
123 ++removed_count_; 123 ++removed_count_;
124 } 124 }
125 125
126 // aura::WindowObserver overrides: 126 // aura::WindowObserver overrides:
127 void OnWindowDestroying(aura::Window* window) override { 127 void OnWindowDestroying(aura::Window* window) override {
128 ASSERT_EQ(Shell::GetPrimaryRootWindow(), window); 128 ASSERT_EQ(Shell::GetPrimaryRootWindow(), window);
129 root_window_destroyed_ = true; 129 root_window_destroyed_ = true;
130 } 130 }
131 131
132 private: 132 private:
133 vector<gfx::Display> changed_; 133 vector<display::Display> changed_;
134 vector<gfx::Display> added_; 134 vector<display::Display> added_;
135 size_t removed_count_; 135 size_t removed_count_;
136 bool root_window_destroyed_; 136 bool root_window_destroyed_;
137 uint32_t changed_metrics_; 137 uint32_t changed_metrics_;
138 138
139 DISALLOW_COPY_AND_ASSIGN(DisplayManagerTest); 139 DISALLOW_COPY_AND_ASSIGN(DisplayManagerTest);
140 }; 140 };
141 141
142 TEST_F(DisplayManagerTest, UpdateDisplayTest) { 142 TEST_F(DisplayManagerTest, UpdateDisplayTest) {
143 if (!SupportsMultipleDisplays()) 143 if (!SupportsMultipleDisplays())
144 return; 144 return;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 EXPECT_EQ("0,0 800x600", 238 EXPECT_EQ("0,0 800x600",
239 display_manager()->GetDisplayAt(0).bounds().ToString()); 239 display_manager()->GetDisplayAt(0).bounds().ToString());
240 EXPECT_EQ("800,0 600x400", 240 EXPECT_EQ("800,0 600x400",
241 display_manager()->GetDisplayAt(1).bounds().ToString()); 241 display_manager()->GetDisplayAt(1).bounds().ToString());
242 } 242 }
243 243
244 TEST_F(DisplayManagerTest, ScaleOnlyChange) { 244 TEST_F(DisplayManagerTest, ScaleOnlyChange) {
245 if (!SupportsMultipleDisplays()) 245 if (!SupportsMultipleDisplays())
246 return; 246 return;
247 display_manager()->ToggleDisplayScaleFactor(); 247 display_manager()->ToggleDisplayScaleFactor();
248 EXPECT_TRUE(changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS);
249 EXPECT_TRUE(changed_metrics() & 248 EXPECT_TRUE(changed_metrics() &
250 gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA); 249 display::DisplayObserver::DISPLAY_METRIC_BOUNDS);
250 EXPECT_TRUE(changed_metrics() &
251 display::DisplayObserver::DISPLAY_METRIC_WORK_AREA);
251 } 252 }
252 253
253 // Test in emulation mode (use_fullscreen_host_window=false) 254 // Test in emulation mode (use_fullscreen_host_window=false)
254 TEST_F(DisplayManagerTest, EmulatorTest) { 255 TEST_F(DisplayManagerTest, EmulatorTest) {
255 if (!SupportsMultipleDisplays()) 256 if (!SupportsMultipleDisplays())
256 return; 257 return;
257 258
258 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 259 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
259 260
260 display_manager()->AddRemoveDisplay(); 261 display_manager()->AddRemoveDisplay();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 EXPECT_EQ("10,480 320x200", 330 EXPECT_EQ("10,480 320x200",
330 display_manager()->GetDisplayAt(1).bounds().ToString()); 331 display_manager()->GetDisplayAt(1).bounds().ToString());
331 EXPECT_EQ("20,680 400x300", 332 EXPECT_EQ("20,680 400x300",
332 display_manager()->GetDisplayAt(2).bounds().ToString()); 333 display_manager()->GetDisplayAt(2).bounds().ToString());
333 } 334 }
334 335
335 TEST_F(DisplayManagerTest, LayoutMorethanThreeDisplaysTest) { 336 TEST_F(DisplayManagerTest, LayoutMorethanThreeDisplaysTest) {
336 if (!SupportsMultipleDisplays()) 337 if (!SupportsMultipleDisplays())
337 return; 338 return;
338 339
339 int64_t primary_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id(); 340 int64_t primary_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
340 display::DisplayIdList list = ash::test::CreateDisplayIdListN( 341 display::DisplayIdList list = ash::test::CreateDisplayIdListN(
341 3, primary_id, primary_id + 1, primary_id + 2); 342 3, primary_id, primary_id + 1, primary_id + 2);
342 { 343 {
343 // Layout: [2] 344 // Layout: [2]
344 // [1][P] 345 // [1][P]
345 display::DisplayLayoutBuilder builder(primary_id); 346 display::DisplayLayoutBuilder builder(primary_id);
346 builder.AddDisplayPlacement(list[1], primary_id, 347 builder.AddDisplayPlacement(list[1], primary_id,
347 display::DisplayPlacement::LEFT, 10); 348 display::DisplayPlacement::LEFT, 10);
348 builder.AddDisplayPlacement(list[2], list[1], 349 builder.AddDisplayPlacement(list[2], list[1],
349 display::DisplayPlacement::TOP, 10); 350 display::DisplayPlacement::TOP, 10);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 return; 463 return;
463 464
464 UpdateDisplay("0+0-500x500,0+501-400x400"); 465 UpdateDisplay("0+0-500x500,0+501-400x400");
465 reset(); 466 reset();
466 ASSERT_EQ(2u, display_manager()->GetNumDisplays()); 467 ASSERT_EQ(2u, display_manager()->GetNumDisplays());
467 const DisplayInfo& display_info1 = GetDisplayInfoAt(0); 468 const DisplayInfo& display_info1 = GetDisplayInfoAt(0);
468 const DisplayInfo& display_info2 = GetDisplayInfoAt(1); 469 const DisplayInfo& display_info2 = GetDisplayInfoAt(1);
469 display_manager()->SetOverscanInsets( 470 display_manager()->SetOverscanInsets(
470 display_info2.id(), gfx::Insets(13, 12, 11, 10)); 471 display_info2.id(), gfx::Insets(13, 12, 11, 10));
471 472
472 std::vector<gfx::Display> changed_displays = changed(); 473 std::vector<display::Display> changed_displays = changed();
473 EXPECT_EQ(1u, changed_displays.size()); 474 EXPECT_EQ(1u, changed_displays.size());
474 EXPECT_EQ(display_info2.id(), changed_displays[0].id()); 475 EXPECT_EQ(display_info2.id(), changed_displays[0].id());
475 EXPECT_EQ("0,0 500x500", 476 EXPECT_EQ("0,0 500x500",
476 GetDisplayInfoAt(0).bounds_in_native().ToString()); 477 GetDisplayInfoAt(0).bounds_in_native().ToString());
477 DisplayInfo updated_display_info2 = GetDisplayInfoAt(1); 478 DisplayInfo updated_display_info2 = GetDisplayInfoAt(1);
478 EXPECT_EQ("0,501 400x400", 479 EXPECT_EQ("0,501 400x400",
479 updated_display_info2.bounds_in_native().ToString()); 480 updated_display_info2.bounds_in_native().ToString());
480 EXPECT_EQ("378x376", 481 EXPECT_EQ("378x376",
481 updated_display_info2.size_in_pixel().ToString()); 482 updated_display_info2.size_in_pixel().ToString());
482 EXPECT_EQ("13,12,11,10", 483 EXPECT_EQ("13,12,11,10",
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 550
550 // Make sure switching primary display applies the overscan offset only once. 551 // Make sure switching primary display applies the overscan offset only once.
551 ash::Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplayId( 552 ash::Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplayId(
552 ScreenUtil::GetSecondaryDisplay().id()); 553 ScreenUtil::GetSecondaryDisplay().id());
553 EXPECT_EQ("-500,0 500x500", 554 EXPECT_EQ("-500,0 500x500",
554 ScreenUtil::GetSecondaryDisplay().bounds().ToString()); 555 ScreenUtil::GetSecondaryDisplay().bounds().ToString());
555 EXPECT_EQ("0,0 500x500", 556 EXPECT_EQ("0,0 500x500",
556 GetDisplayInfo(ScreenUtil::GetSecondaryDisplay()). 557 GetDisplayInfo(ScreenUtil::GetSecondaryDisplay()).
557 bounds_in_native().ToString()); 558 bounds_in_native().ToString());
558 EXPECT_EQ("0,501 400x400", 559 EXPECT_EQ("0,501 400x400",
559 GetDisplayInfo(gfx::Screen::GetScreen()->GetPrimaryDisplay()) 560 GetDisplayInfo(display::Screen::GetScreen()->GetPrimaryDisplay())
560 .bounds_in_native() 561 .bounds_in_native()
561 .ToString()); 562 .ToString());
562 EXPECT_EQ("0,0 188x190", 563 EXPECT_EQ(
563 gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString()); 564 "0,0 188x190",
565 display::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString());
564 566
565 // Make sure just moving the overscan area should property notify observers. 567 // Make sure just moving the overscan area should property notify observers.
566 UpdateDisplay("0+0-500x500"); 568 UpdateDisplay("0+0-500x500");
567 int64_t primary_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id(); 569 int64_t primary_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
568 display_manager()->SetOverscanInsets(primary_id, gfx::Insets(0, 0, 20, 20)); 570 display_manager()->SetOverscanInsets(primary_id, gfx::Insets(0, 0, 20, 20));
569 EXPECT_EQ("0,0 480x480", 571 EXPECT_EQ(
570 gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString()); 572 "0,0 480x480",
573 display::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString());
571 reset(); 574 reset();
572 display_manager()->SetOverscanInsets(primary_id, gfx::Insets(10, 10, 10, 10)); 575 display_manager()->SetOverscanInsets(primary_id, gfx::Insets(10, 10, 10, 10));
573 EXPECT_TRUE(changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS); 576 EXPECT_TRUE(changed_metrics() &
574 EXPECT_TRUE( 577 display::DisplayObserver::DISPLAY_METRIC_BOUNDS);
575 changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA); 578 EXPECT_TRUE(changed_metrics() &
576 EXPECT_EQ("0,0 480x480", 579 display::DisplayObserver::DISPLAY_METRIC_WORK_AREA);
577 gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString()); 580 EXPECT_EQ(
581 "0,0 480x480",
582 display::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString());
578 reset(); 583 reset();
579 display_manager()->SetOverscanInsets(primary_id, gfx::Insets(0, 0, 0, 0)); 584 display_manager()->SetOverscanInsets(primary_id, gfx::Insets(0, 0, 0, 0));
580 EXPECT_TRUE(changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS); 585 EXPECT_TRUE(changed_metrics() &
581 EXPECT_TRUE( 586 display::DisplayObserver::DISPLAY_METRIC_BOUNDS);
582 changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA); 587 EXPECT_TRUE(changed_metrics() &
583 EXPECT_EQ("0,0 500x500", 588 display::DisplayObserver::DISPLAY_METRIC_WORK_AREA);
584 gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString()); 589 EXPECT_EQ(
590 "0,0 500x500",
591 display::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString());
585 } 592 }
586 593
587 TEST_F(DisplayManagerTest, ZeroOverscanInsets) { 594 TEST_F(DisplayManagerTest, ZeroOverscanInsets) {
588 if (!SupportsMultipleDisplays()) 595 if (!SupportsMultipleDisplays())
589 return; 596 return;
590 597
591 // Make sure the display change events is emitted for overscan inset changes. 598 // Make sure the display change events is emitted for overscan inset changes.
592 UpdateDisplay("0+0-500x500,0+501-400x400"); 599 UpdateDisplay("0+0-500x500,0+501-400x400");
593 ASSERT_EQ(2u, display_manager()->GetNumDisplays()); 600 ASSERT_EQ(2u, display_manager()->GetNumDisplays());
594 int64_t display2_id = display_manager()->GetDisplayAt(1).id(); 601 int64_t display2_id = display_manager()->GetDisplayAt(1).id();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 DisplayInfo info(id, ToDisplayName(id), false); 637 DisplayInfo info(id, ToDisplayName(id), false);
631 info.SetBounds(bounds); 638 info.SetBounds(bounds);
632 return info; 639 return info;
633 } 640 }
634 641
635 TEST_F(DisplayManagerTest, TestNativeDisplaysChanged) { 642 TEST_F(DisplayManagerTest, TestNativeDisplaysChanged) {
636 const int64_t internal_display_id = 643 const int64_t internal_display_id =
637 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay(); 644 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay();
638 const int external_id = 10; 645 const int external_id = 10;
639 const int mirror_id = 11; 646 const int mirror_id = 11;
640 const int64_t invalid_id = gfx::Display::kInvalidDisplayID; 647 const int64_t invalid_id = display::Display::kInvalidDisplayID;
641 const DisplayInfo internal_display_info = 648 const DisplayInfo internal_display_info =
642 CreateDisplayInfo(internal_display_id, gfx::Rect(0, 0, 500, 500)); 649 CreateDisplayInfo(internal_display_id, gfx::Rect(0, 0, 500, 500));
643 const DisplayInfo external_display_info = 650 const DisplayInfo external_display_info =
644 CreateDisplayInfo(external_id, gfx::Rect(1, 1, 100, 100)); 651 CreateDisplayInfo(external_id, gfx::Rect(1, 1, 100, 100));
645 const DisplayInfo mirroring_display_info = 652 const DisplayInfo mirroring_display_info =
646 CreateDisplayInfo(mirror_id, gfx::Rect(0, 0, 500, 500)); 653 CreateDisplayInfo(mirror_id, gfx::Rect(0, 0, 500, 500));
647 654
648 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 655 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
649 EXPECT_EQ(1U, display_manager()->num_connected_displays()); 656 EXPECT_EQ(1U, display_manager()->num_connected_displays());
650 std::string default_bounds = 657 std::string default_bounds =
(...skipping 14 matching lines...) Expand all
665 // External connected while primary was disconnected. 672 // External connected while primary was disconnected.
666 display_info_list.push_back(external_display_info); 673 display_info_list.push_back(external_display_info);
667 display_manager()->OnNativeDisplaysChanged(display_info_list); 674 display_manager()->OnNativeDisplaysChanged(display_info_list);
668 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 675 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
669 676
670 EXPECT_EQ(invalid_id, GetDisplayForId(internal_display_id).id()); 677 EXPECT_EQ(invalid_id, GetDisplayForId(internal_display_id).id());
671 EXPECT_EQ("1,1 100x100", 678 EXPECT_EQ("1,1 100x100",
672 GetDisplayInfoForId(external_id).bounds_in_native().ToString()); 679 GetDisplayInfoForId(external_id).bounds_in_native().ToString());
673 EXPECT_EQ(1U, display_manager()->num_connected_displays()); 680 EXPECT_EQ(1U, display_manager()->num_connected_displays());
674 EXPECT_FALSE(display_manager()->IsInMirrorMode()); 681 EXPECT_FALSE(display_manager()->IsInMirrorMode());
675 EXPECT_EQ(external_id, gfx::Screen::GetScreen()->GetPrimaryDisplay().id()); 682 EXPECT_EQ(external_id,
683 display::Screen::GetScreen()->GetPrimaryDisplay().id());
676 684
677 EXPECT_EQ(internal_display_id, gfx::Display::InternalDisplayId()); 685 EXPECT_EQ(internal_display_id, display::Display::InternalDisplayId());
678 686
679 // Primary connected, with different bounds. 687 // Primary connected, with different bounds.
680 display_info_list.clear(); 688 display_info_list.clear();
681 display_info_list.push_back(internal_display_info); 689 display_info_list.push_back(internal_display_info);
682 display_info_list.push_back(external_display_info); 690 display_info_list.push_back(external_display_info);
683 display_manager()->OnNativeDisplaysChanged(display_info_list); 691 display_manager()->OnNativeDisplaysChanged(display_info_list);
684 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); 692 EXPECT_EQ(2U, display_manager()->GetNumDisplays());
685 EXPECT_EQ(internal_display_id, 693 EXPECT_EQ(internal_display_id,
686 gfx::Screen::GetScreen()->GetPrimaryDisplay().id()); 694 display::Screen::GetScreen()->GetPrimaryDisplay().id());
687 695
688 // This combinatino is new, so internal display becomes primary. 696 // This combinatino is new, so internal display becomes primary.
689 EXPECT_EQ("0,0 500x500", 697 EXPECT_EQ("0,0 500x500",
690 GetDisplayForId(internal_display_id).bounds().ToString()); 698 GetDisplayForId(internal_display_id).bounds().ToString());
691 EXPECT_EQ("1,1 100x100", 699 EXPECT_EQ("1,1 100x100",
692 GetDisplayInfoForId(10).bounds_in_native().ToString()); 700 GetDisplayInfoForId(10).bounds_in_native().ToString());
693 EXPECT_EQ(2U, display_manager()->num_connected_displays()); 701 EXPECT_EQ(2U, display_manager()->num_connected_displays());
694 EXPECT_FALSE(display_manager()->IsInMirrorMode()); 702 EXPECT_FALSE(display_manager()->IsInMirrorMode());
695 EXPECT_EQ(ToDisplayName(internal_display_id), 703 EXPECT_EQ(ToDisplayName(internal_display_id),
696 display_manager()->GetDisplayNameForId(internal_display_id)); 704 display_manager()->GetDisplayNameForId(internal_display_id));
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 UpdateDisplay("200x200/l"); 1078 UpdateDisplay("200x200/l");
1071 EXPECT_EQ("1 0 0", GetCountSummary()); 1079 EXPECT_EQ("1 0 0", GetCountSummary());
1072 1080
1073 // Having the internal display deactivated should restore user rotation. Newly 1081 // Having the internal display deactivated should restore user rotation. Newly
1074 // set rotations should be applied. 1082 // set rotations should be applied.
1075 UpdateDisplay("200x200, 200x200"); 1083 UpdateDisplay("200x200, 200x200");
1076 const int64_t internal_display_id = 1084 const int64_t internal_display_id =
1077 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay(); 1085 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay();
1078 1086
1079 display_manager()->SetDisplayRotation(internal_display_id, 1087 display_manager()->SetDisplayRotation(internal_display_id,
1080 gfx::Display::ROTATE_90, 1088 display::Display::ROTATE_90,
1081 gfx::Display::ROTATION_SOURCE_USER); 1089 display::Display::ROTATION_SOURCE_USER);
1082 display_manager()->SetDisplayRotation(internal_display_id, 1090 display_manager()->SetDisplayRotation(
1083 gfx::Display::ROTATE_0, 1091 internal_display_id, display::Display::ROTATE_0,
1084 gfx::Display::ROTATION_SOURCE_ACTIVE); 1092 display::Display::ROTATION_SOURCE_ACTIVE);
1085 1093
1086 const DisplayInfo info = GetDisplayInfoForId(internal_display_id); 1094 const DisplayInfo info = GetDisplayInfoForId(internal_display_id);
1087 EXPECT_EQ(gfx::Display::ROTATE_0, info.GetActiveRotation()); 1095 EXPECT_EQ(display::Display::ROTATE_0, info.GetActiveRotation());
1088 1096
1089 // Deactivate internal display to simulate Docked Mode. 1097 // Deactivate internal display to simulate Docked Mode.
1090 vector<DisplayInfo> secondary_only; 1098 vector<DisplayInfo> secondary_only;
1091 secondary_only.push_back(GetDisplayInfoAt(1)); 1099 secondary_only.push_back(GetDisplayInfoAt(1));
1092 display_manager()->OnNativeDisplaysChanged(secondary_only); 1100 display_manager()->OnNativeDisplaysChanged(secondary_only);
1093 1101
1094 const DisplayInfo post_removal_info = 1102 const DisplayInfo post_removal_info =
1095 display_manager()->display_info_[internal_display_id]; 1103 display_manager()->display_info_[internal_display_id];
1096 EXPECT_NE(info.GetActiveRotation(), post_removal_info.GetActiveRotation()); 1104 EXPECT_NE(info.GetActiveRotation(), post_removal_info.GetActiveRotation());
1097 EXPECT_EQ(gfx::Display::ROTATE_90, post_removal_info.GetActiveRotation()); 1105 EXPECT_EQ(display::Display::ROTATE_90, post_removal_info.GetActiveRotation());
1098 1106
1099 display_manager()->SetDisplayRotation(internal_display_id, 1107 display_manager()->SetDisplayRotation(
1100 gfx::Display::ROTATE_180, 1108 internal_display_id, display::Display::ROTATE_180,
1101 gfx::Display::ROTATION_SOURCE_ACTIVE); 1109 display::Display::ROTATION_SOURCE_ACTIVE);
1102 const DisplayInfo post_rotation_info = 1110 const DisplayInfo post_rotation_info =
1103 display_manager()->display_info_[internal_display_id]; 1111 display_manager()->display_info_[internal_display_id];
1104 EXPECT_NE(info.GetActiveRotation(), post_rotation_info.GetActiveRotation()); 1112 EXPECT_NE(info.GetActiveRotation(), post_rotation_info.GetActiveRotation());
1105 EXPECT_EQ(gfx::Display::ROTATE_180, post_rotation_info.GetActiveRotation()); 1113 EXPECT_EQ(display::Display::ROTATE_180,
1114 post_rotation_info.GetActiveRotation());
1106 } 1115 }
1107 1116
1108 #if defined(OS_WIN) 1117 #if defined(OS_WIN)
1109 // TODO(msw): Broken on Windows. http://crbug.com/584038 1118 // TODO(msw): Broken on Windows. http://crbug.com/584038
1110 #define MAYBE_UIScale DISABLED_UIScale 1119 #define MAYBE_UIScale DISABLED_UIScale
1111 #else 1120 #else
1112 #define MAYBE_UIScale UIScale 1121 #define MAYBE_UIScale UIScale
1113 #endif 1122 #endif
1114 TEST_F(DisplayManagerTest, MAYBE_UIScale) { 1123 TEST_F(DisplayManagerTest, MAYBE_UIScale) {
1115 test::ScopedDisable125DSFForUIScaling disable; 1124 test::ScopedDisable125DSFForUIScaling disable;
1116 1125
1117 UpdateDisplay("1280x800"); 1126 UpdateDisplay("1280x800");
1118 int64_t display_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id(); 1127 int64_t display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
1119 SetDisplayUIScale(display_id, 1.125f); 1128 SetDisplayUIScale(display_id, 1.125f);
1120 EXPECT_EQ(1.0, GetDisplayInfoAt(0).configured_ui_scale()); 1129 EXPECT_EQ(1.0, GetDisplayInfoAt(0).configured_ui_scale());
1121 SetDisplayUIScale(display_id, 0.8f); 1130 SetDisplayUIScale(display_id, 0.8f);
1122 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale()); 1131 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale());
1123 SetDisplayUIScale(display_id, 0.75f); 1132 SetDisplayUIScale(display_id, 0.75f);
1124 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale()); 1133 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale());
1125 SetDisplayUIScale(display_id, 0.625f); 1134 SetDisplayUIScale(display_id, 0.625f);
1126 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale()); 1135 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale());
1127 1136
1128 test::ScopedSetInternalDisplayId set_internal(display_id); 1137 test::ScopedSetInternalDisplayId set_internal(display_id);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 UpdateDisplay("1280x850*2"); 1174 UpdateDisplay("1280x850*2");
1166 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale()); 1175 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale());
1167 SetDisplayUIScale(display_id, 1.5f); 1176 SetDisplayUIScale(display_id, 1.5f);
1168 EXPECT_EQ(1.5f, GetDisplayInfoAt(0).configured_ui_scale()); 1177 EXPECT_EQ(1.5f, GetDisplayInfoAt(0).configured_ui_scale());
1169 SetDisplayUIScale(display_id, 1.25f); 1178 SetDisplayUIScale(display_id, 1.25f);
1170 EXPECT_EQ(1.25f, GetDisplayInfoAt(0).configured_ui_scale()); 1179 EXPECT_EQ(1.25f, GetDisplayInfoAt(0).configured_ui_scale());
1171 SetDisplayUIScale(display_id, 1.125f); 1180 SetDisplayUIScale(display_id, 1.125f);
1172 EXPECT_EQ(1.125f, GetDisplayInfoAt(0).configured_ui_scale()); 1181 EXPECT_EQ(1.125f, GetDisplayInfoAt(0).configured_ui_scale());
1173 SetDisplayUIScale(display_id, 1.0f); 1182 SetDisplayUIScale(display_id, 1.0f);
1174 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale()); 1183 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale());
1175 gfx::Display display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); 1184 display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay();
1176 EXPECT_EQ(2.0f, display.device_scale_factor()); 1185 EXPECT_EQ(2.0f, display.device_scale_factor());
1177 EXPECT_EQ("640x425", display.bounds().size().ToString()); 1186 EXPECT_EQ("640x425", display.bounds().size().ToString());
1178 1187
1179 SetDisplayUIScale(display_id, 0.8f); 1188 SetDisplayUIScale(display_id, 0.8f);
1180 EXPECT_EQ(0.8f, GetDisplayInfoAt(0).configured_ui_scale()); 1189 EXPECT_EQ(0.8f, GetDisplayInfoAt(0).configured_ui_scale());
1181 SetDisplayUIScale(display_id, 0.75f); 1190 SetDisplayUIScale(display_id, 0.75f);
1182 EXPECT_EQ(0.8f, GetDisplayInfoAt(0).configured_ui_scale()); 1191 EXPECT_EQ(0.8f, GetDisplayInfoAt(0).configured_ui_scale());
1183 SetDisplayUIScale(display_id, 0.625f); 1192 SetDisplayUIScale(display_id, 0.625f);
1184 EXPECT_EQ(0.625f, GetDisplayInfoAt(0).configured_ui_scale()); 1193 EXPECT_EQ(0.625f, GetDisplayInfoAt(0).configured_ui_scale());
1185 SetDisplayUIScale(display_id, 0.6f); 1194 SetDisplayUIScale(display_id, 0.6f);
1186 EXPECT_EQ(0.625f, GetDisplayInfoAt(0).configured_ui_scale()); 1195 EXPECT_EQ(0.625f, GetDisplayInfoAt(0).configured_ui_scale());
1187 SetDisplayUIScale(display_id, 0.5f); 1196 SetDisplayUIScale(display_id, 0.5f);
1188 EXPECT_EQ(0.5f, GetDisplayInfoAt(0).configured_ui_scale()); 1197 EXPECT_EQ(0.5f, GetDisplayInfoAt(0).configured_ui_scale());
1189 1198
1190 SetDisplayUIScale(display_id, 2.0f); 1199 SetDisplayUIScale(display_id, 2.0f);
1191 EXPECT_EQ(2.0f, GetDisplayInfoAt(0).configured_ui_scale()); 1200 EXPECT_EQ(2.0f, GetDisplayInfoAt(0).configured_ui_scale());
1192 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale()); 1201 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale());
1193 display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); 1202 display = display::Screen::GetScreen()->GetPrimaryDisplay();
1194 EXPECT_EQ(1.0f, display.device_scale_factor()); 1203 EXPECT_EQ(1.0f, display.device_scale_factor());
1195 EXPECT_EQ("1280x850", display.bounds().size().ToString()); 1204 EXPECT_EQ("1280x850", display.bounds().size().ToString());
1196 1205
1197 // 1.25 ui scaling on 1.25 DSF device should use 1.0 DSF 1206 // 1.25 ui scaling on 1.25 DSF device should use 1.0 DSF
1198 // on screen. 1207 // on screen.
1199 UpdateDisplay("1280x850*1.25"); 1208 UpdateDisplay("1280x850*1.25");
1200 SetDisplayUIScale(display_id, 1.25f); 1209 SetDisplayUIScale(display_id, 1.25f);
1201 EXPECT_EQ(1.25f, GetDisplayInfoAt(0).configured_ui_scale()); 1210 EXPECT_EQ(1.25f, GetDisplayInfoAt(0).configured_ui_scale());
1202 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale()); 1211 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale());
1203 display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); 1212 display = display::Screen::GetScreen()->GetPrimaryDisplay();
1204 EXPECT_EQ(1.0f, display.device_scale_factor()); 1213 EXPECT_EQ(1.0f, display.device_scale_factor());
1205 EXPECT_EQ("1280x850", display.bounds().size().ToString()); 1214 EXPECT_EQ("1280x850", display.bounds().size().ToString());
1206 } 1215 }
1207 1216
1208 TEST_F(DisplayManagerTest, UIScaleWithDisplayMode) { 1217 TEST_F(DisplayManagerTest, UIScaleWithDisplayMode) {
1209 int display_id = 1000; 1218 int display_id = 1000;
1210 1219
1211 // Setup the display modes with UI-scale. 1220 // Setup the display modes with UI-scale.
1212 DisplayInfo native_display_info = 1221 DisplayInfo native_display_info =
1213 CreateDisplayInfo(display_id, gfx::Rect(0, 0, 1280, 800)); 1222 CreateDisplayInfo(display_id, gfx::Rect(0, 0, 1280, 800));
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 display_manager()->GetActiveModeForDisplayId(display_id))); 1273 display_manager()->GetActiveModeForDisplayId(display_id)));
1265 } 1274 }
1266 1275
1267 #if defined(OS_WIN) && !defined(USE_ASH) 1276 #if defined(OS_WIN) && !defined(USE_ASH)
1268 // TODO(msw): Broken on Windows. http://crbug.com/584038 1277 // TODO(msw): Broken on Windows. http://crbug.com/584038
1269 #define MAYBE_Use125DSFForUIScaling DISABLED_Use125DSFForUIScaling 1278 #define MAYBE_Use125DSFForUIScaling DISABLED_Use125DSFForUIScaling
1270 #else 1279 #else
1271 #define MAYBE_Use125DSFForUIScaling Use125DSFForUIScaling 1280 #define MAYBE_Use125DSFForUIScaling Use125DSFForUIScaling
1272 #endif 1281 #endif
1273 TEST_F(DisplayManagerTest, MAYBE_Use125DSFForUIScaling) { 1282 TEST_F(DisplayManagerTest, MAYBE_Use125DSFForUIScaling) {
1274 int64_t display_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id(); 1283 int64_t display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
1275 test::ScopedSetInternalDisplayId set_internal(display_id); 1284 test::ScopedSetInternalDisplayId set_internal(display_id);
1276 1285
1277 UpdateDisplay("1920x1080*1.25"); 1286 UpdateDisplay("1920x1080*1.25");
1278 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); 1287 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor());
1279 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale()); 1288 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale());
1280 1289
1281 SetDisplayUIScale(display_id, 0.8f); 1290 SetDisplayUIScale(display_id, 0.8f);
1282 EXPECT_EQ(1.25f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); 1291 EXPECT_EQ(1.25f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor());
1283 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale()); 1292 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale());
1284 EXPECT_EQ("1536x864", GetDisplayForId(display_id).size().ToString()); 1293 EXPECT_EQ("1536x864", GetDisplayForId(display_id).size().ToString());
(...skipping 13 matching lines...) Expand all
1298 if (!SupportsMultipleDisplays()) 1307 if (!SupportsMultipleDisplays())
1299 return; 1308 return;
1300 // Don't check root window destruction in unified mode. 1309 // Don't check root window destruction in unified mode.
1301 Shell::GetPrimaryRootWindow()->RemoveObserver(this); 1310 Shell::GetPrimaryRootWindow()->RemoveObserver(this);
1302 1311
1303 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 1312 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
1304 display_manager->SetUnifiedDesktopEnabled(true); 1313 display_manager->SetUnifiedDesktopEnabled(true);
1305 1314
1306 UpdateDisplay("200x200, 400x400"); 1315 UpdateDisplay("200x200, 400x400");
1307 1316
1308 int64_t unified_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id(); 1317 int64_t unified_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
1309 DisplayInfo info = display_manager->GetDisplayInfo(unified_id); 1318 DisplayInfo info = display_manager->GetDisplayInfo(unified_id);
1310 ASSERT_EQ(2u, info.display_modes().size()); 1319 ASSERT_EQ(2u, info.display_modes().size());
1311 EXPECT_EQ("400x200", info.display_modes()[0].size.ToString()); 1320 EXPECT_EQ("400x200", info.display_modes()[0].size.ToString());
1312 EXPECT_TRUE(info.display_modes()[0].native); 1321 EXPECT_TRUE(info.display_modes()[0].native);
1313 EXPECT_EQ("800x400", info.display_modes()[1].size.ToString()); 1322 EXPECT_EQ("800x400", info.display_modes()[1].size.ToString());
1314 EXPECT_FALSE(info.display_modes()[1].native); 1323 EXPECT_FALSE(info.display_modes()[1].native);
1315 EXPECT_EQ("400x200", 1324 EXPECT_EQ(
1316 gfx::Screen::GetScreen()->GetPrimaryDisplay().size().ToString()); 1325 "400x200",
1326 display::Screen::GetScreen()->GetPrimaryDisplay().size().ToString());
1317 DisplayMode active_mode = 1327 DisplayMode active_mode =
1318 display_manager->GetActiveModeForDisplayId(unified_id); 1328 display_manager->GetActiveModeForDisplayId(unified_id);
1319 EXPECT_EQ(1.0f, active_mode.ui_scale); 1329 EXPECT_EQ(1.0f, active_mode.ui_scale);
1320 EXPECT_EQ("400x200", active_mode.size.ToString()); 1330 EXPECT_EQ("400x200", active_mode.size.ToString());
1321 1331
1322 EXPECT_TRUE(test::SetDisplayResolution(unified_id, gfx::Size(800, 400))); 1332 EXPECT_TRUE(test::SetDisplayResolution(unified_id, gfx::Size(800, 400)));
1323 EXPECT_EQ("800x400", 1333 EXPECT_EQ(
1324 gfx::Screen::GetScreen()->GetPrimaryDisplay().size().ToString()); 1334 "800x400",
1335 display::Screen::GetScreen()->GetPrimaryDisplay().size().ToString());
1325 1336
1326 active_mode = display_manager->GetActiveModeForDisplayId(unified_id); 1337 active_mode = display_manager->GetActiveModeForDisplayId(unified_id);
1327 EXPECT_EQ(1.0f, active_mode.ui_scale); 1338 EXPECT_EQ(1.0f, active_mode.ui_scale);
1328 EXPECT_EQ("800x400", active_mode.size.ToString()); 1339 EXPECT_EQ("800x400", active_mode.size.ToString());
1329 1340
1330 // resolution change will not persist in unified desktop mode. 1341 // resolution change will not persist in unified desktop mode.
1331 UpdateDisplay("600x600, 200x200"); 1342 UpdateDisplay("600x600, 200x200");
1332 EXPECT_EQ("1200x600", 1343 EXPECT_EQ(
1333 gfx::Screen::GetScreen()->GetPrimaryDisplay().size().ToString()); 1344 "1200x600",
1345 display::Screen::GetScreen()->GetPrimaryDisplay().size().ToString());
1334 active_mode = display_manager->GetActiveModeForDisplayId(unified_id); 1346 active_mode = display_manager->GetActiveModeForDisplayId(unified_id);
1335 EXPECT_EQ(1.0f, active_mode.ui_scale); 1347 EXPECT_EQ(1.0f, active_mode.ui_scale);
1336 EXPECT_TRUE(active_mode.native); 1348 EXPECT_TRUE(active_mode.native);
1337 EXPECT_EQ("1200x600", active_mode.size.ToString()); 1349 EXPECT_EQ("1200x600", active_mode.size.ToString());
1338 } 1350 }
1339 1351
1340 #if defined(OS_WIN) 1352 #if defined(OS_WIN)
1341 // TODO(scottmg): RootWindow doesn't get resized on Windows 1353 // TODO(scottmg): RootWindow doesn't get resized on Windows
1342 // Ash. http://crbug.com/247916. 1354 // Ash. http://crbug.com/247916.
1343 #define MAYBE_UpdateMouseCursorAfterRotateZoom \ 1355 #define MAYBE_UpdateMouseCursorAfterRotateZoom \
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 EXPECT_EQ("700,125", env->last_mouse_location().ToString()); 1398 EXPECT_EQ("700,125", env->last_mouse_location().ToString());
1387 UpdateDisplay("600x400,400x300*2@1.5"); 1399 UpdateDisplay("600x400,400x300*2@1.5");
1388 EXPECT_EQ("750,187", env->last_mouse_location().ToString()); 1400 EXPECT_EQ("750,187", env->last_mouse_location().ToString());
1389 1401
1390 // The native location is now outside, so move to the 1402 // The native location is now outside, so move to the
1391 // center of closest display. 1403 // center of closest display.
1392 UpdateDisplay("600x400,400x200*2@1.5"); 1404 UpdateDisplay("600x400,400x200*2@1.5");
1393 EXPECT_EQ("750,75", env->last_mouse_location().ToString()); 1405 EXPECT_EQ("750,75", env->last_mouse_location().ToString());
1394 } 1406 }
1395 1407
1396 class TestDisplayObserver : public gfx::DisplayObserver { 1408 class TestDisplayObserver : public display::DisplayObserver {
1397 public: 1409 public:
1398 TestDisplayObserver() : changed_(false) {} 1410 TestDisplayObserver() : changed_(false) {}
1399 ~TestDisplayObserver() override {} 1411 ~TestDisplayObserver() override {}
1400 1412
1401 // gfx::DisplayObserver overrides: 1413 // display::DisplayObserver overrides:
1402 void OnDisplayMetricsChanged(const gfx::Display&, uint32_t) override {} 1414 void OnDisplayMetricsChanged(const display::Display&, uint32_t) override {}
1403 void OnDisplayAdded(const gfx::Display& new_display) override { 1415 void OnDisplayAdded(const display::Display& new_display) override {
1404 // Mirror window should already be delete before restoring 1416 // Mirror window should already be delete before restoring
1405 // the external display. 1417 // the external display.
1406 EXPECT_FALSE(test_api.GetHost()); 1418 EXPECT_FALSE(test_api.GetHost());
1407 changed_ = true; 1419 changed_ = true;
1408 } 1420 }
1409 void OnDisplayRemoved(const gfx::Display& old_display) override { 1421 void OnDisplayRemoved(const display::Display& old_display) override {
1410 // Mirror window should not be created until the external display 1422 // Mirror window should not be created until the external display
1411 // is removed. 1423 // is removed.
1412 EXPECT_FALSE(test_api.GetHost()); 1424 EXPECT_FALSE(test_api.GetHost());
1413 changed_ = true; 1425 changed_ = true;
1414 } 1426 }
1415 1427
1416 bool changed_and_reset() { 1428 bool changed_and_reset() {
1417 bool changed = changed_; 1429 bool changed = changed_;
1418 changed_ = false; 1430 changed_ = false;
1419 return changed; 1431 return changed;
1420 } 1432 }
1421 1433
1422 private: 1434 private:
1423 test::MirrorWindowTestApi test_api; 1435 test::MirrorWindowTestApi test_api;
1424 bool changed_; 1436 bool changed_;
1425 1437
1426 DISALLOW_COPY_AND_ASSIGN(TestDisplayObserver); 1438 DISALLOW_COPY_AND_ASSIGN(TestDisplayObserver);
1427 }; 1439 };
1428 1440
1429 TEST_F(DisplayManagerTest, SoftwareMirroring) { 1441 TEST_F(DisplayManagerTest, SoftwareMirroring) {
1430 if (!SupportsMultipleDisplays()) 1442 if (!SupportsMultipleDisplays())
1431 return; 1443 return;
1432 1444
1433 UpdateDisplay("300x400,400x500"); 1445 UpdateDisplay("300x400,400x500");
1434 1446
1435 test::MirrorWindowTestApi test_api; 1447 test::MirrorWindowTestApi test_api;
1436 EXPECT_EQ(nullptr, test_api.GetHost()); 1448 EXPECT_EQ(nullptr, test_api.GetHost());
1437 1449
1438 TestDisplayObserver display_observer; 1450 TestDisplayObserver display_observer;
1439 gfx::Screen::GetScreen()->AddObserver(&display_observer); 1451 display::Screen::GetScreen()->AddObserver(&display_observer);
1440 1452
1441 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 1453 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
1442 display_manager->SetMultiDisplayMode(DisplayManager::MIRRORING); 1454 display_manager->SetMultiDisplayMode(DisplayManager::MIRRORING);
1443 display_manager->UpdateDisplays(); 1455 display_manager->UpdateDisplays();
1444 RunAllPendingInMessageLoop(); 1456 RunAllPendingInMessageLoop();
1445 EXPECT_TRUE(display_observer.changed_and_reset()); 1457 EXPECT_TRUE(display_observer.changed_and_reset());
1446 EXPECT_EQ(1U, display_manager->GetNumDisplays()); 1458 EXPECT_EQ(1U, display_manager->GetNumDisplays());
1447 EXPECT_EQ("0,0 300x400", 1459 EXPECT_EQ(
1448 gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString()); 1460 "0,0 300x400",
1461 display::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString());
1449 EXPECT_EQ("400x500", test_api.GetHost()->GetBounds().size().ToString()); 1462 EXPECT_EQ("400x500", test_api.GetHost()->GetBounds().size().ToString());
1450 EXPECT_EQ("300x400", 1463 EXPECT_EQ("300x400",
1451 test_api.GetHost()->window()->bounds().size().ToString()); 1464 test_api.GetHost()->window()->bounds().size().ToString());
1452 EXPECT_TRUE(display_manager->IsInMirrorMode()); 1465 EXPECT_TRUE(display_manager->IsInMirrorMode());
1453 1466
1454 display_manager->SetMirrorMode(false); 1467 display_manager->SetMirrorMode(false);
1455 EXPECT_TRUE(display_observer.changed_and_reset()); 1468 EXPECT_TRUE(display_observer.changed_and_reset());
1456 EXPECT_EQ(nullptr, test_api.GetHost()); 1469 EXPECT_EQ(nullptr, test_api.GetHost());
1457 EXPECT_EQ(2U, display_manager->GetNumDisplays()); 1470 EXPECT_EQ(2U, display_manager->GetNumDisplays());
1458 EXPECT_FALSE(display_manager->IsInMirrorMode()); 1471 EXPECT_FALSE(display_manager->IsInMirrorMode());
(...skipping 22 matching lines...) Expand all
1481 EXPECT_FALSE(display_observer.changed_and_reset()); 1494 EXPECT_FALSE(display_observer.changed_and_reset());
1482 EXPECT_EQ("330x440", 1495 EXPECT_EQ("330x440",
1483 test_api.GetHost()->window()->bounds().size().ToString()); 1496 test_api.GetHost()->window()->bounds().size().ToString());
1484 1497
1485 // Overscan insets are ignored. 1498 // Overscan insets are ignored.
1486 UpdateDisplay("400x600/o,600x800/o"); 1499 UpdateDisplay("400x600/o,600x800/o");
1487 EXPECT_FALSE(display_observer.changed_and_reset()); 1500 EXPECT_FALSE(display_observer.changed_and_reset());
1488 EXPECT_EQ("400x600", 1501 EXPECT_EQ("400x600",
1489 test_api.GetHost()->window()->bounds().size().ToString()); 1502 test_api.GetHost()->window()->bounds().size().ToString());
1490 1503
1491 gfx::Screen::GetScreen()->RemoveObserver(&display_observer); 1504 display::Screen::GetScreen()->RemoveObserver(&display_observer);
1492 } 1505 }
1493 1506
1494 TEST_F(DisplayManagerTest, RotateInSoftwareMirroring) { 1507 TEST_F(DisplayManagerTest, RotateInSoftwareMirroring) {
1495 if (!SupportsMultipleDisplays()) 1508 if (!SupportsMultipleDisplays())
1496 return; 1509 return;
1497 1510
1498 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 1511 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
1499 UpdateDisplay("600x400,500x300"); 1512 UpdateDisplay("600x400,500x300");
1500 display_manager->SetMirrorMode(true); 1513 display_manager->SetMirrorMode(true);
1501 1514
1502 EXPECT_EQ(1U, display_manager->GetNumDisplays()); 1515 EXPECT_EQ(1U, display_manager->GetNumDisplays());
1503 int64_t primary_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id(); 1516 int64_t primary_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
1504 display_manager->SetDisplayRotation(primary_id, gfx::Display::ROTATE_180, 1517 display_manager->SetDisplayRotation(primary_id, display::Display::ROTATE_180,
1505 gfx::Display::ROTATION_SOURCE_ACTIVE); 1518 display::Display::ROTATION_SOURCE_ACTIVE);
1506 display_manager->SetMirrorMode(false); 1519 display_manager->SetMirrorMode(false);
1507 } 1520 }
1508 1521
1509 TEST_F(DisplayManagerTest, SingleDisplayToSoftwareMirroring) { 1522 TEST_F(DisplayManagerTest, SingleDisplayToSoftwareMirroring) {
1510 if (!SupportsMultipleDisplays()) 1523 if (!SupportsMultipleDisplays())
1511 return; 1524 return;
1512 UpdateDisplay("600x400"); 1525 UpdateDisplay("600x400");
1513 1526
1514 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 1527 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
1515 display_manager->SetMultiDisplayMode(DisplayManager::MIRRORING); 1528 display_manager->SetMultiDisplayMode(DisplayManager::MIRRORING);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 } 1582 }
1570 #endif // OS_CHROMEOS 1583 #endif // OS_CHROMEOS
1571 1584
1572 TEST_F(DisplayManagerTest, MirroredLayout) { 1585 TEST_F(DisplayManagerTest, MirroredLayout) {
1573 if (!SupportsMultipleDisplays()) 1586 if (!SupportsMultipleDisplays())
1574 return; 1587 return;
1575 1588
1576 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 1589 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
1577 UpdateDisplay("500x500,400x400"); 1590 UpdateDisplay("500x500,400x400");
1578 EXPECT_FALSE(display_manager->GetCurrentDisplayLayout().mirrored); 1591 EXPECT_FALSE(display_manager->GetCurrentDisplayLayout().mirrored);
1579 EXPECT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays()); 1592 EXPECT_EQ(2, display::Screen::GetScreen()->GetNumDisplays());
1580 EXPECT_EQ(2U, display_manager->num_connected_displays()); 1593 EXPECT_EQ(2U, display_manager->num_connected_displays());
1581 1594
1582 UpdateDisplay("1+0-500x500,1+0-500x500"); 1595 UpdateDisplay("1+0-500x500,1+0-500x500");
1583 EXPECT_TRUE(display_manager->GetCurrentDisplayLayout().mirrored); 1596 EXPECT_TRUE(display_manager->GetCurrentDisplayLayout().mirrored);
1584 EXPECT_EQ(1, gfx::Screen::GetScreen()->GetNumDisplays()); 1597 EXPECT_EQ(1, display::Screen::GetScreen()->GetNumDisplays());
1585 EXPECT_EQ(2U, display_manager->num_connected_displays()); 1598 EXPECT_EQ(2U, display_manager->num_connected_displays());
1586 1599
1587 UpdateDisplay("500x500,500x500"); 1600 UpdateDisplay("500x500,500x500");
1588 EXPECT_FALSE(display_manager->GetCurrentDisplayLayout().mirrored); 1601 EXPECT_FALSE(display_manager->GetCurrentDisplayLayout().mirrored);
1589 EXPECT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays()); 1602 EXPECT_EQ(2, display::Screen::GetScreen()->GetNumDisplays());
1590 EXPECT_EQ(2U, display_manager->num_connected_displays()); 1603 EXPECT_EQ(2U, display_manager->num_connected_displays());
1591 } 1604 }
1592 1605
1593 TEST_F(DisplayManagerTest, InvertLayout) { 1606 TEST_F(DisplayManagerTest, InvertLayout) {
1594 EXPECT_EQ("left, 0", 1607 EXPECT_EQ("left, 0",
1595 display::DisplayPlacement(display::DisplayPlacement::RIGHT, 0) 1608 display::DisplayPlacement(display::DisplayPlacement::RIGHT, 0)
1596 .Swap() 1609 .Swap()
1597 .ToString()); 1610 .ToString());
1598 EXPECT_EQ("left, -100", 1611 EXPECT_EQ("left, -100",
1599 display::DisplayPlacement(display::DisplayPlacement::RIGHT, 100) 1612 display::DisplayPlacement(display::DisplayPlacement::RIGHT, 100)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 .ToString()); 1657 .ToString());
1645 } 1658 }
1646 1659
1647 TEST_F(DisplayManagerTest, NotifyPrimaryChange) { 1660 TEST_F(DisplayManagerTest, NotifyPrimaryChange) {
1648 if (!SupportsMultipleDisplays()) 1661 if (!SupportsMultipleDisplays())
1649 return; 1662 return;
1650 UpdateDisplay("500x500,500x500"); 1663 UpdateDisplay("500x500,500x500");
1651 test::SwapPrimaryDisplay(); 1664 test::SwapPrimaryDisplay();
1652 reset(); 1665 reset();
1653 UpdateDisplay("500x500"); 1666 UpdateDisplay("500x500");
1654 EXPECT_FALSE(changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS);
1655 EXPECT_FALSE(changed_metrics() & 1667 EXPECT_FALSE(changed_metrics() &
1656 gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA); 1668 display::DisplayObserver::DISPLAY_METRIC_BOUNDS);
1669 EXPECT_FALSE(changed_metrics() &
1670 display::DisplayObserver::DISPLAY_METRIC_WORK_AREA);
1657 EXPECT_TRUE(changed_metrics() & 1671 EXPECT_TRUE(changed_metrics() &
1658 gfx::DisplayObserver::DISPLAY_METRIC_PRIMARY); 1672 display::DisplayObserver::DISPLAY_METRIC_PRIMARY);
1659 1673
1660 UpdateDisplay("500x500,500x500"); 1674 UpdateDisplay("500x500,500x500");
1661 test::SwapPrimaryDisplay(); 1675 test::SwapPrimaryDisplay();
1662 UpdateDisplay("500x400"); 1676 UpdateDisplay("500x400");
1663 EXPECT_TRUE(changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS);
1664 EXPECT_TRUE(changed_metrics() & 1677 EXPECT_TRUE(changed_metrics() &
1665 gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA); 1678 display::DisplayObserver::DISPLAY_METRIC_BOUNDS);
1666 EXPECT_TRUE(changed_metrics() & 1679 EXPECT_TRUE(changed_metrics() &
1667 gfx::DisplayObserver::DISPLAY_METRIC_PRIMARY); 1680 display::DisplayObserver::DISPLAY_METRIC_WORK_AREA);
1681 EXPECT_TRUE(changed_metrics() &
1682 display::DisplayObserver::DISPLAY_METRIC_PRIMARY);
1668 } 1683 }
1669 1684
1670 TEST_F(DisplayManagerTest, NotifyPrimaryChangeUndock) { 1685 TEST_F(DisplayManagerTest, NotifyPrimaryChangeUndock) {
1671 if (!SupportsMultipleDisplays()) 1686 if (!SupportsMultipleDisplays())
1672 return; 1687 return;
1673 // Assume the default display is an external display, and 1688 // Assume the default display is an external display, and
1674 // emulates undocking by switching to another display. 1689 // emulates undocking by switching to another display.
1675 DisplayInfo another_display_info = 1690 DisplayInfo another_display_info =
1676 CreateDisplayInfo(1, gfx::Rect(0, 0, 1280, 800)); 1691 CreateDisplayInfo(1, gfx::Rect(0, 0, 1280, 800));
1677 std::vector<DisplayInfo> info_list; 1692 std::vector<DisplayInfo> info_list;
1678 info_list.push_back(another_display_info); 1693 info_list.push_back(another_display_info);
1679 reset(); 1694 reset();
1680 display_manager()->OnNativeDisplaysChanged(info_list); 1695 display_manager()->OnNativeDisplaysChanged(info_list);
1681 EXPECT_TRUE(changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS);
1682 EXPECT_TRUE(changed_metrics() & 1696 EXPECT_TRUE(changed_metrics() &
1683 gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA); 1697 display::DisplayObserver::DISPLAY_METRIC_BOUNDS);
1684 EXPECT_TRUE(changed_metrics() & 1698 EXPECT_TRUE(changed_metrics() &
1685 gfx::DisplayObserver::DISPLAY_METRIC_PRIMARY); 1699 display::DisplayObserver::DISPLAY_METRIC_WORK_AREA);
1700 EXPECT_TRUE(changed_metrics() &
1701 display::DisplayObserver::DISPLAY_METRIC_PRIMARY);
1686 } 1702 }
1687 1703
1688 #if defined(OS_WIN) 1704 #if defined(OS_WIN)
1689 // TODO(scottmg): RootWindow doesn't get resized on Windows 1705 // TODO(scottmg): RootWindow doesn't get resized on Windows
1690 // Ash. http://crbug.com/247916. 1706 // Ash. http://crbug.com/247916.
1691 #define MAYBE_UpdateDisplayWithHostOrigin DISABLED_UpdateDisplayWithHostOrigin 1707 #define MAYBE_UpdateDisplayWithHostOrigin DISABLED_UpdateDisplayWithHostOrigin
1692 #else 1708 #else
1693 #define MAYBE_UpdateDisplayWithHostOrigin UpdateDisplayWithHostOrigin 1709 #define MAYBE_UpdateDisplayWithHostOrigin UpdateDisplayWithHostOrigin
1694 #endif 1710 #endif
1695 1711
1696 TEST_F(DisplayManagerTest, MAYBE_UpdateDisplayWithHostOrigin) { 1712 TEST_F(DisplayManagerTest, MAYBE_UpdateDisplayWithHostOrigin) {
1697 UpdateDisplay("100x200,300x400"); 1713 UpdateDisplay("100x200,300x400");
1698 ASSERT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays()); 1714 ASSERT_EQ(2, display::Screen::GetScreen()->GetNumDisplays());
1699 aura::Window::Windows root_windows = 1715 aura::Window::Windows root_windows =
1700 Shell::GetInstance()->GetAllRootWindows(); 1716 Shell::GetInstance()->GetAllRootWindows();
1701 ASSERT_EQ(2U, root_windows.size()); 1717 ASSERT_EQ(2U, root_windows.size());
1702 aura::WindowTreeHost* host0 = root_windows[0]->GetHost(); 1718 aura::WindowTreeHost* host0 = root_windows[0]->GetHost();
1703 aura::WindowTreeHost* host1 = root_windows[1]->GetHost(); 1719 aura::WindowTreeHost* host1 = root_windows[1]->GetHost();
1704 1720
1705 EXPECT_EQ("1,1", host0->GetBounds().origin().ToString()); 1721 EXPECT_EQ("1,1", host0->GetBounds().origin().ToString());
1706 EXPECT_EQ("100x200", host0->GetBounds().size().ToString()); 1722 EXPECT_EQ("100x200", host0->GetBounds().size().ToString());
1707 // UpdateDisplay set the origin if it's not set. 1723 // UpdateDisplay set the origin if it's not set.
1708 EXPECT_NE("1,1", host1->GetBounds().origin().ToString()); 1724 EXPECT_NE("1,1", host1->GetBounds().origin().ToString());
1709 EXPECT_EQ("300x400", host1->GetBounds().size().ToString()); 1725 EXPECT_EQ("300x400", host1->GetBounds().size().ToString());
1710 1726
1711 UpdateDisplay("100x200,200+300-300x400"); 1727 UpdateDisplay("100x200,200+300-300x400");
1712 ASSERT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays()); 1728 ASSERT_EQ(2, display::Screen::GetScreen()->GetNumDisplays());
1713 EXPECT_EQ("0,0", host0->GetBounds().origin().ToString()); 1729 EXPECT_EQ("0,0", host0->GetBounds().origin().ToString());
1714 EXPECT_EQ("100x200", host0->GetBounds().size().ToString()); 1730 EXPECT_EQ("100x200", host0->GetBounds().size().ToString());
1715 EXPECT_EQ("200,300", host1->GetBounds().origin().ToString()); 1731 EXPECT_EQ("200,300", host1->GetBounds().origin().ToString());
1716 EXPECT_EQ("300x400", host1->GetBounds().size().ToString()); 1732 EXPECT_EQ("300x400", host1->GetBounds().size().ToString());
1717 1733
1718 UpdateDisplay("400+500-200x300,300x400"); 1734 UpdateDisplay("400+500-200x300,300x400");
1719 ASSERT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays()); 1735 ASSERT_EQ(2, display::Screen::GetScreen()->GetNumDisplays());
1720 EXPECT_EQ("400,500", host0->GetBounds().origin().ToString()); 1736 EXPECT_EQ("400,500", host0->GetBounds().origin().ToString());
1721 EXPECT_EQ("200x300", host0->GetBounds().size().ToString()); 1737 EXPECT_EQ("200x300", host0->GetBounds().size().ToString());
1722 EXPECT_EQ("0,0", host1->GetBounds().origin().ToString()); 1738 EXPECT_EQ("0,0", host1->GetBounds().origin().ToString());
1723 EXPECT_EQ("300x400", host1->GetBounds().size().ToString()); 1739 EXPECT_EQ("300x400", host1->GetBounds().size().ToString());
1724 1740
1725 UpdateDisplay("100+200-100x200,300+500-200x300"); 1741 UpdateDisplay("100+200-100x200,300+500-200x300");
1726 ASSERT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays()); 1742 ASSERT_EQ(2, display::Screen::GetScreen()->GetNumDisplays());
1727 EXPECT_EQ("100,200", host0->GetBounds().origin().ToString()); 1743 EXPECT_EQ("100,200", host0->GetBounds().origin().ToString());
1728 EXPECT_EQ("100x200", host0->GetBounds().size().ToString()); 1744 EXPECT_EQ("100x200", host0->GetBounds().size().ToString());
1729 EXPECT_EQ("300,500", host1->GetBounds().origin().ToString()); 1745 EXPECT_EQ("300,500", host1->GetBounds().origin().ToString());
1730 EXPECT_EQ("200x300", host1->GetBounds().size().ToString()); 1746 EXPECT_EQ("200x300", host1->GetBounds().size().ToString());
1731 } 1747 }
1732 1748
1733 TEST_F(DisplayManagerTest, UnifiedDesktopBasic) { 1749 TEST_F(DisplayManagerTest, UnifiedDesktopBasic) {
1734 if (!SupportsMultipleDisplays()) 1750 if (!SupportsMultipleDisplays())
1735 return; 1751 return;
1736 1752
1737 // Don't check root window destruction in unified mode. 1753 // Don't check root window destruction in unified mode.
1738 Shell::GetPrimaryRootWindow()->RemoveObserver(this); 1754 Shell::GetPrimaryRootWindow()->RemoveObserver(this);
1739 1755
1740 UpdateDisplay("400x500,300x200"); 1756 UpdateDisplay("400x500,300x200");
1741 1757
1742 // Enable after extended mode. 1758 // Enable after extended mode.
1743 display_manager()->SetUnifiedDesktopEnabled(true); 1759 display_manager()->SetUnifiedDesktopEnabled(true);
1744 1760
1745 // Defaults to the unified desktop. 1761 // Defaults to the unified desktop.
1746 gfx::Screen* screen = gfx::Screen::GetScreen(); 1762 display::Screen* screen = display::Screen::GetScreen();
1747 // The 2nd display is scaled so that it has the same height as 1st display. 1763 // The 2nd display is scaled so that it has the same height as 1st display.
1748 // 300 * 500 / 200 + 400 = 1150. 1764 // 300 * 500 / 200 + 400 = 1150.
1749 EXPECT_EQ(gfx::Size(1150, 500), screen->GetPrimaryDisplay().size()); 1765 EXPECT_EQ(gfx::Size(1150, 500), screen->GetPrimaryDisplay().size());
1750 1766
1751 display_manager()->SetMirrorMode(true); 1767 display_manager()->SetMirrorMode(true);
1752 EXPECT_EQ(gfx::Size(400, 500), screen->GetPrimaryDisplay().size()); 1768 EXPECT_EQ(gfx::Size(400, 500), screen->GetPrimaryDisplay().size());
1753 1769
1754 display_manager()->SetMirrorMode(false); 1770 display_manager()->SetMirrorMode(false);
1755 EXPECT_EQ(gfx::Size(1150, 500), screen->GetPrimaryDisplay().size()); 1771 EXPECT_EQ(gfx::Size(1150, 500), screen->GetPrimaryDisplay().size());
1756 1772
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1846 EXPECT_FALSE(display_manager()->IsInUnifiedMode()); 1862 EXPECT_FALSE(display_manager()->IsInUnifiedMode());
1847 } 1863 }
1848 1864
1849 TEST_F(DisplayManagerTest, UnifiedDesktopWith2xDSF) { 1865 TEST_F(DisplayManagerTest, UnifiedDesktopWith2xDSF) {
1850 if (!SupportsMultipleDisplays()) 1866 if (!SupportsMultipleDisplays())
1851 return; 1867 return;
1852 // Don't check root window destruction in unified mode. 1868 // Don't check root window destruction in unified mode.
1853 Shell::GetPrimaryRootWindow()->RemoveObserver(this); 1869 Shell::GetPrimaryRootWindow()->RemoveObserver(this);
1854 1870
1855 display_manager()->SetUnifiedDesktopEnabled(true); 1871 display_manager()->SetUnifiedDesktopEnabled(true);
1856 gfx::Screen* screen = gfx::Screen::GetScreen(); 1872 display::Screen* screen = display::Screen::GetScreen();
1857 1873
1858 // 2nd display is 2x. 1874 // 2nd display is 2x.
1859 UpdateDisplay("400x500,1000x800*2"); 1875 UpdateDisplay("400x500,1000x800*2");
1860 DisplayInfo info = 1876 DisplayInfo info =
1861 display_manager()->GetDisplayInfo(screen->GetPrimaryDisplay().id()); 1877 display_manager()->GetDisplayInfo(screen->GetPrimaryDisplay().id());
1862 EXPECT_EQ(2u, info.display_modes().size()); 1878 EXPECT_EQ(2u, info.display_modes().size());
1863 EXPECT_EQ("1640x800", info.display_modes()[0].size.ToString()); 1879 EXPECT_EQ("1640x800", info.display_modes()[0].size.ToString());
1864 EXPECT_EQ(2.0f, info.display_modes()[0].device_scale_factor); 1880 EXPECT_EQ(2.0f, info.display_modes()[0].device_scale_factor);
1865 EXPECT_EQ("1025x500", info.display_modes()[1].size.ToString()); 1881 EXPECT_EQ("1025x500", info.display_modes()[1].size.ToString());
1866 EXPECT_EQ(1.0f, info.display_modes()[1].device_scale_factor); 1882 EXPECT_EQ(1.0f, info.display_modes()[1].device_scale_factor);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1967 TEST_F(DisplayManagerTest, NoRotateUnifiedDesktop) { 1983 TEST_F(DisplayManagerTest, NoRotateUnifiedDesktop) {
1968 if (!SupportsMultipleDisplays()) 1984 if (!SupportsMultipleDisplays())
1969 return; 1985 return;
1970 display_manager()->SetUnifiedDesktopEnabled(true); 1986 display_manager()->SetUnifiedDesktopEnabled(true);
1971 1987
1972 // Don't check root window destruction in unified mode. 1988 // Don't check root window destruction in unified mode.
1973 Shell::GetPrimaryRootWindow()->RemoveObserver(this); 1989 Shell::GetPrimaryRootWindow()->RemoveObserver(this);
1974 1990
1975 UpdateDisplay("400x500,300x200"); 1991 UpdateDisplay("400x500,300x200");
1976 1992
1977 gfx::Screen* screen = gfx::Screen::GetScreen(); 1993 display::Screen* screen = display::Screen::GetScreen();
1978 const gfx::Display& display = screen->GetPrimaryDisplay(); 1994 const display::Display& display = screen->GetPrimaryDisplay();
1979 EXPECT_EQ("1150x500", display.size().ToString()); 1995 EXPECT_EQ("1150x500", display.size().ToString());
1980 display_manager()->SetDisplayRotation(display.id(), gfx::Display::ROTATE_90, 1996 display_manager()->SetDisplayRotation(
1981 gfx::Display::ROTATION_SOURCE_ACTIVE); 1997 display.id(), display::Display::ROTATE_90,
1998 display::Display::ROTATION_SOURCE_ACTIVE);
1982 EXPECT_EQ("1150x500", screen->GetPrimaryDisplay().size().ToString()); 1999 EXPECT_EQ("1150x500", screen->GetPrimaryDisplay().size().ToString());
1983 display_manager()->SetDisplayRotation(display.id(), gfx::Display::ROTATE_0, 2000 display_manager()->SetDisplayRotation(
1984 gfx::Display::ROTATION_SOURCE_ACTIVE); 2001 display.id(), display::Display::ROTATE_0,
2002 display::Display::ROTATION_SOURCE_ACTIVE);
1985 EXPECT_EQ("1150x500", screen->GetPrimaryDisplay().size().ToString()); 2003 EXPECT_EQ("1150x500", screen->GetPrimaryDisplay().size().ToString());
1986 2004
1987 UpdateDisplay("400x500"); 2005 UpdateDisplay("400x500");
1988 EXPECT_EQ("400x500", screen->GetPrimaryDisplay().size().ToString()); 2006 EXPECT_EQ("400x500", screen->GetPrimaryDisplay().size().ToString());
1989 } 2007 }
1990 2008
1991 // Makes sure the transition from unified to single won't crash 2009 // Makes sure the transition from unified to single won't crash
1992 // with docked windows. 2010 // with docked windows.
1993 TEST_F(DisplayManagerTest, UnifiedWithDockWindows) { 2011 TEST_F(DisplayManagerTest, UnifiedWithDockWindows) {
1994 if (!SupportsMultipleDisplays()) 2012 if (!SupportsMultipleDisplays())
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2043 const DisplayInfo& info = display_manager()->GetDisplayInfo(internal_id); 2061 const DisplayInfo& info = display_manager()->GetDisplayInfo(internal_id);
2044 DisplayMode mode; 2062 DisplayMode mode;
2045 2063
2046 EXPECT_FALSE(GetDisplayModeForNextUIScale(info, true, &mode)); 2064 EXPECT_FALSE(GetDisplayModeForNextUIScale(info, true, &mode));
2047 EXPECT_FALSE(GetDisplayModeForNextUIScale(info, false, &mode)); 2065 EXPECT_FALSE(GetDisplayModeForNextUIScale(info, false, &mode));
2048 EXPECT_FALSE(SetDisplayUIScale(internal_id, 1.0f)); 2066 EXPECT_FALSE(SetDisplayUIScale(internal_id, 1.0f));
2049 2067
2050 DisplayInfo invalid_info; 2068 DisplayInfo invalid_info;
2051 EXPECT_FALSE(GetDisplayModeForNextUIScale(invalid_info, true, &mode)); 2069 EXPECT_FALSE(GetDisplayModeForNextUIScale(invalid_info, true, &mode));
2052 EXPECT_FALSE(GetDisplayModeForNextUIScale(invalid_info, false, &mode)); 2070 EXPECT_FALSE(GetDisplayModeForNextUIScale(invalid_info, false, &mode));
2053 EXPECT_FALSE(SetDisplayUIScale(gfx::Display::kInvalidDisplayID, 1.0f)); 2071 EXPECT_FALSE(SetDisplayUIScale(display::Display::kInvalidDisplayID, 1.0f));
2054 } 2072 }
2055 2073
2056 // Make sure that bad layout information is ignored and does not crash. 2074 // Make sure that bad layout information is ignored and does not crash.
2057 TEST_F(DisplayManagerTest, DontRegisterBadConfig) { 2075 TEST_F(DisplayManagerTest, DontRegisterBadConfig) {
2058 if (!SupportsMultipleDisplays()) 2076 if (!SupportsMultipleDisplays())
2059 return; 2077 return;
2060 display::DisplayIdList list = ash::test::CreateDisplayIdList2(1, 2); 2078 display::DisplayIdList list = ash::test::CreateDisplayIdList2(1, 2);
2061 display::DisplayLayoutBuilder builder(1); 2079 display::DisplayLayoutBuilder builder(1);
2062 builder.AddDisplayPlacement(2, 1, display::DisplayPlacement::LEFT, 0); 2080 builder.AddDisplayPlacement(2, 1, display::DisplayPlacement::LEFT, 0);
2063 builder.AddDisplayPlacement(3, 1, display::DisplayPlacement::BOTTOM, 0); 2081 builder.AddDisplayPlacement(3, 1, display::DisplayPlacement::BOTTOM, 0);
2064 2082
2065 display_manager()->layout_store()->RegisterLayoutForDisplayIdList( 2083 display_manager()->layout_store()->RegisterLayoutForDisplayIdList(
2066 list, builder.Build()); 2084 list, builder.Build());
2067 } 2085 }
2068 2086
2069 class ScreenShutdownTest : public test::AshTestBase { 2087 class ScreenShutdownTest : public test::AshTestBase {
2070 public: 2088 public:
2071 ScreenShutdownTest() { 2089 ScreenShutdownTest() {
2072 } 2090 }
2073 ~ScreenShutdownTest() override {} 2091 ~ScreenShutdownTest() override {}
2074 2092
2075 void TearDown() override { 2093 void TearDown() override {
2076 gfx::Screen* orig_screen = gfx::Screen::GetScreen(); 2094 display::Screen* orig_screen = display::Screen::GetScreen();
2077 AshTestBase::TearDown(); 2095 AshTestBase::TearDown();
2078 if (!SupportsMultipleDisplays()) 2096 if (!SupportsMultipleDisplays())
2079 return; 2097 return;
2080 gfx::Screen* screen = gfx::Screen::GetScreen(); 2098 display::Screen* screen = display::Screen::GetScreen();
2081 EXPECT_NE(orig_screen, screen); 2099 EXPECT_NE(orig_screen, screen);
2082 EXPECT_EQ(2, screen->GetNumDisplays()); 2100 EXPECT_EQ(2, screen->GetNumDisplays());
2083 EXPECT_EQ("500x300", screen->GetPrimaryDisplay().size().ToString()); 2101 EXPECT_EQ("500x300", screen->GetPrimaryDisplay().size().ToString());
2084 std::vector<gfx::Display> all = screen->GetAllDisplays(); 2102 std::vector<display::Display> all = screen->GetAllDisplays();
2085 EXPECT_EQ("500x300", all[0].size().ToString()); 2103 EXPECT_EQ("500x300", all[0].size().ToString());
2086 EXPECT_EQ("800x400", all[1].size().ToString()); 2104 EXPECT_EQ("800x400", all[1].size().ToString());
2087 } 2105 }
2088 2106
2089 private: 2107 private:
2090 DISALLOW_COPY_AND_ASSIGN(ScreenShutdownTest); 2108 DISALLOW_COPY_AND_ASSIGN(ScreenShutdownTest);
2091 }; 2109 };
2092 2110
2093 TEST_F(ScreenShutdownTest, ScreenAfterShutdown) { 2111 TEST_F(ScreenShutdownTest, ScreenAfterShutdown) {
2094 if (!SupportsMultipleDisplays()) 2112 if (!SupportsMultipleDisplays())
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2142 } 2160 }
2143 2161
2144 } // namespace 2162 } // namespace
2145 2163
2146 typedef testing::Test DisplayManagerFontTest; 2164 typedef testing::Test DisplayManagerFontTest;
2147 2165
2148 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf100Internal) { 2166 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf100Internal) {
2149 FontTestHelper helper(1.0f, FontTestHelper::INTERNAL); 2167 FontTestHelper helper(1.0f, FontTestHelper::INTERNAL);
2150 ASSERT_DOUBLE_EQ( 2168 ASSERT_DOUBLE_EQ(
2151 1.0f, 2169 1.0f,
2152 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); 2170 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
2153 EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); 2171 EXPECT_FALSE(IsTextSubpixelPositioningEnabled());
2154 EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); 2172 EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
2155 } 2173 }
2156 2174
2157 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf125Internal) { 2175 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf125Internal) {
2158 test::ScopedDisable125DSFForUIScaling disable; 2176 test::ScopedDisable125DSFForUIScaling disable;
2159 FontTestHelper helper(1.25f, FontTestHelper::INTERNAL); 2177 FontTestHelper helper(1.25f, FontTestHelper::INTERNAL);
2160 ASSERT_DOUBLE_EQ( 2178 ASSERT_DOUBLE_EQ(
2161 1.25f, 2179 1.25f,
2162 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); 2180 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
2163 EXPECT_TRUE(IsTextSubpixelPositioningEnabled()); 2181 EXPECT_TRUE(IsTextSubpixelPositioningEnabled());
2164 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); 2182 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
2165 } 2183 }
2166 2184
2167 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf200Internal) { 2185 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf200Internal) {
2168 FontTestHelper helper(2.0f, FontTestHelper::INTERNAL); 2186 FontTestHelper helper(2.0f, FontTestHelper::INTERNAL);
2169 ASSERT_DOUBLE_EQ( 2187 ASSERT_DOUBLE_EQ(
2170 2.0f, 2188 2.0f,
2171 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); 2189 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
2172 EXPECT_TRUE(IsTextSubpixelPositioningEnabled()); 2190 EXPECT_TRUE(IsTextSubpixelPositioningEnabled());
2173 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); 2191 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
2174 2192
2175 SetDisplayUIScale(gfx::Screen::GetScreen()->GetPrimaryDisplay().id(), 2.0f); 2193 SetDisplayUIScale(display::Screen::GetScreen()->GetPrimaryDisplay().id(),
2194 2.0f);
2176 2195
2177 ASSERT_DOUBLE_EQ( 2196 ASSERT_DOUBLE_EQ(
2178 1.0f, 2197 1.0f,
2179 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); 2198 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
2180 EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); 2199 EXPECT_FALSE(IsTextSubpixelPositioningEnabled());
2181 EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); 2200 EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
2182 } 2201 }
2183 2202
2184 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf100External) { 2203 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf100External) {
2185 FontTestHelper helper(1.0f, FontTestHelper::EXTERNAL); 2204 FontTestHelper helper(1.0f, FontTestHelper::EXTERNAL);
2186 ASSERT_DOUBLE_EQ( 2205 ASSERT_DOUBLE_EQ(
2187 1.0f, 2206 1.0f,
2188 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); 2207 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
2189 EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); 2208 EXPECT_FALSE(IsTextSubpixelPositioningEnabled());
2190 EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); 2209 EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
2191 } 2210 }
2192 2211
2193 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf125External) { 2212 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf125External) {
2194 FontTestHelper helper(1.25f, FontTestHelper::EXTERNAL); 2213 FontTestHelper helper(1.25f, FontTestHelper::EXTERNAL);
2195 ASSERT_DOUBLE_EQ( 2214 ASSERT_DOUBLE_EQ(
2196 1.25f, 2215 1.25f,
2197 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); 2216 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
2198 EXPECT_TRUE(IsTextSubpixelPositioningEnabled()); 2217 EXPECT_TRUE(IsTextSubpixelPositioningEnabled());
2199 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); 2218 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
2200 } 2219 }
2201 2220
2202 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf200External) { 2221 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf200External) {
2203 FontTestHelper helper(2.0f, FontTestHelper::EXTERNAL); 2222 FontTestHelper helper(2.0f, FontTestHelper::EXTERNAL);
2204 ASSERT_DOUBLE_EQ( 2223 ASSERT_DOUBLE_EQ(
2205 2.0f, 2224 2.0f,
2206 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); 2225 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
2207 EXPECT_TRUE(IsTextSubpixelPositioningEnabled()); 2226 EXPECT_TRUE(IsTextSubpixelPositioningEnabled());
2208 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); 2227 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
2209 } 2228 }
2210 2229
2211 TEST_F(DisplayManagerFontTest, 2230 TEST_F(DisplayManagerFontTest,
2212 TextSubpixelPositioningWithDsf125InternalWithScaling) { 2231 TextSubpixelPositioningWithDsf125InternalWithScaling) {
2213 FontTestHelper helper(1.25f, FontTestHelper::INTERNAL); 2232 FontTestHelper helper(1.25f, FontTestHelper::INTERNAL);
2214 ASSERT_DOUBLE_EQ( 2233 ASSERT_DOUBLE_EQ(
2215 1.0f, 2234 1.0f,
2216 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); 2235 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
2217 EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); 2236 EXPECT_FALSE(IsTextSubpixelPositioningEnabled());
2218 EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); 2237 EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
2219 2238
2220 SetDisplayUIScale(gfx::Screen::GetScreen()->GetPrimaryDisplay().id(), 0.8f); 2239 SetDisplayUIScale(display::Screen::GetScreen()->GetPrimaryDisplay().id(),
2240 0.8f);
2221 2241
2222 ASSERT_DOUBLE_EQ( 2242 ASSERT_DOUBLE_EQ(
2223 1.25f, 2243 1.25f,
2224 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); 2244 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
2225 EXPECT_TRUE(IsTextSubpixelPositioningEnabled()); 2245 EXPECT_TRUE(IsTextSubpixelPositioningEnabled());
2226 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); 2246 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
2227 } 2247 }
2228 2248
2229 TEST_F(DisplayManagerTest, CheckInitializationOfRotationProperty) { 2249 TEST_F(DisplayManagerTest, CheckInitializationOfRotationProperty) {
2230 int64_t id = display_manager()->GetDisplayAt(0).id(); 2250 int64_t id = display_manager()->GetDisplayAt(0).id();
2231 display_manager()->RegisterDisplayProperty(id, gfx::Display::ROTATE_90, 1.0f, 2251 display_manager()->RegisterDisplayProperty(id, display::Display::ROTATE_90,
2232 nullptr, gfx::Size(), 1.0f, 2252 1.0f, nullptr, gfx::Size(), 1.0f,
2233 ui::COLOR_PROFILE_STANDARD); 2253 ui::COLOR_PROFILE_STANDARD);
2234 2254
2235 const DisplayInfo& info = display_manager()->GetDisplayInfo(id); 2255 const DisplayInfo& info = display_manager()->GetDisplayInfo(id);
2236 2256
2237 EXPECT_EQ(gfx::Display::ROTATE_90, 2257 EXPECT_EQ(display::Display::ROTATE_90,
2238 info.GetRotation(gfx::Display::ROTATION_SOURCE_USER)); 2258 info.GetRotation(display::Display::ROTATION_SOURCE_USER));
2239 EXPECT_EQ(gfx::Display::ROTATE_90, 2259 EXPECT_EQ(display::Display::ROTATE_90,
2240 info.GetRotation(gfx::Display::ROTATION_SOURCE_ACTIVE)); 2260 info.GetRotation(display::Display::ROTATION_SOURCE_ACTIVE));
2241 } 2261 }
2242 2262
2243 TEST_F(DisplayManagerTest, RejectInvalidLayoutData) { 2263 TEST_F(DisplayManagerTest, RejectInvalidLayoutData) {
2244 DisplayLayoutStore* layout_store = display_manager()->layout_store(); 2264 DisplayLayoutStore* layout_store = display_manager()->layout_store();
2245 int64_t id1 = 10001; 2265 int64_t id1 = 10001;
2246 int64_t id2 = 10002; 2266 int64_t id2 = 10002;
2247 ASSERT_TRUE(CompareDisplayIds(id1, id2)); 2267 ASSERT_TRUE(CompareDisplayIds(id1, id2));
2248 display::DisplayLayoutBuilder good_builder(id1); 2268 display::DisplayLayoutBuilder good_builder(id1);
2249 good_builder.SetSecondaryPlacement(id2, display::DisplayPlacement::LEFT, 0); 2269 good_builder.SetSecondaryPlacement(id2, display::DisplayPlacement::LEFT, 0);
2250 std::unique_ptr<display::DisplayLayout> good(good_builder.Build()); 2270 std::unique_ptr<display::DisplayLayout> good(good_builder.Build());
(...skipping 28 matching lines...) Expand all
2279 const display::DisplayLayout& stored = 2299 const display::DisplayLayout& stored =
2280 layout_store->GetRegisteredDisplayLayout(list); 2300 layout_store->GetRegisteredDisplayLayout(list);
2281 2301
2282 EXPECT_EQ(id1, stored.placement_list[0].parent_display_id); 2302 EXPECT_EQ(id1, stored.placement_list[0].parent_display_id);
2283 EXPECT_EQ(id2, stored.placement_list[0].display_id); 2303 EXPECT_EQ(id2, stored.placement_list[0].display_id);
2284 } 2304 }
2285 2305
2286 #endif // OS_CHROMEOS 2306 #endif // OS_CHROMEOS
2287 2307
2288 } // namespace ash 2308 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_manager.cc ('k') | ash/display/display_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698