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

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

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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_pref_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/common/ash_switches.h" 8 #include "ash/common/ash_switches.h"
9 #include "ash/common/display/display_info.h" 9 #include "ash/common/display/display_info.h"
10 #include "ash/common/material_design/material_design_controller.h" 10 #include "ash/common/material_design/material_design_controller.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 } // namespace 54 } // namespace
55 55
56 class DisplayManagerTest : public test::AshMDTestBase, 56 class DisplayManagerTest : public test::AshMDTestBase,
57 public display::DisplayObserver, 57 public display::DisplayObserver,
58 public aura::WindowObserver { 58 public aura::WindowObserver {
59 public: 59 public:
60 DisplayManagerTest() 60 DisplayManagerTest()
61 : removed_count_(0U), 61 : removed_count_(0U),
62 root_window_destroyed_(false), 62 root_window_destroyed_(false),
63 changed_metrics_(0U) { 63 changed_metrics_(0U) {}
64 }
65 ~DisplayManagerTest() override {} 64 ~DisplayManagerTest() override {}
66 65
67 void SetUp() override { 66 void SetUp() override {
68 AshMDTestBase::SetUp(); 67 AshMDTestBase::SetUp();
69 display::Screen::GetScreen()->AddObserver(this); 68 display::Screen::GetScreen()->AddObserver(this);
70 Shell::GetPrimaryRootWindow()->AddObserver(this); 69 Shell::GetPrimaryRootWindow()->AddObserver(this);
71 } 70 }
72 void TearDown() override { 71 void TearDown() override {
73 Shell::GetPrimaryRootWindow()->RemoveObserver(this); 72 Shell::GetPrimaryRootWindow()->RemoveObserver(this);
74 display::Screen::GetScreen()->RemoveObserver(this); 73 display::Screen::GetScreen()->RemoveObserver(this);
75 AshMDTestBase::TearDown(); 74 AshMDTestBase::TearDown();
76 } 75 }
77 76
78 DisplayManager* display_manager() { 77 DisplayManager* display_manager() {
79 return Shell::GetInstance()->display_manager(); 78 return Shell::GetInstance()->display_manager();
80 } 79 }
81 const vector<display::Display>& changed() const { return changed_; } 80 const vector<display::Display>& changed() const { return changed_; }
82 const vector<display::Display>& added() const { return added_; } 81 const vector<display::Display>& added() const { return added_; }
83 uint32_t changed_metrics() const { return changed_metrics_; } 82 uint32_t changed_metrics() const { return changed_metrics_; }
84 83
85 string GetCountSummary() const { 84 string GetCountSummary() const {
86 return StringPrintf("%" PRIuS " %" PRIuS " %" PRIuS, 85 return StringPrintf("%" PRIuS " %" PRIuS " %" PRIuS, changed_.size(),
87 changed_.size(), added_.size(), removed_count_); 86 added_.size(), removed_count_);
88 } 87 }
89 88
90 void reset() { 89 void reset() {
91 changed_.clear(); 90 changed_.clear();
92 added_.clear(); 91 added_.clear();
93 removed_count_ = 0U; 92 removed_count_ = 0U;
94 changed_metrics_ = 0U; 93 changed_metrics_ = 0U;
95 root_window_destroyed_ = false; 94 root_window_destroyed_ = false;
96 } 95 }
97 96
98 bool root_window_destroyed() const { 97 bool root_window_destroyed() const { return root_window_destroyed_; }
99 return root_window_destroyed_;
100 }
101 98
102 const DisplayInfo& GetDisplayInfo(const display::Display& display) { 99 const DisplayInfo& GetDisplayInfo(const display::Display& display) {
103 return display_manager()->GetDisplayInfo(display.id()); 100 return display_manager()->GetDisplayInfo(display.id());
104 } 101 }
105 102
106 const DisplayInfo& GetDisplayInfoAt(int index) { 103 const DisplayInfo& GetDisplayInfoAt(int index) {
107 return GetDisplayInfo(display_manager()->GetDisplayAt(index)); 104 return GetDisplayInfo(display_manager()->GetDisplayAt(index));
108 } 105 }
109 106
110 const display::Display& GetDisplayForId(int64_t id) { 107 const display::Display& GetDisplayForId(int64_t id) {
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 474
478 TEST_P(DisplayManagerTest, OverscanInsetsTest) { 475 TEST_P(DisplayManagerTest, OverscanInsetsTest) {
479 if (!SupportsMultipleDisplays()) 476 if (!SupportsMultipleDisplays())
480 return; 477 return;
481 478
482 UpdateDisplay("0+0-500x500,0+501-400x400"); 479 UpdateDisplay("0+0-500x500,0+501-400x400");
483 reset(); 480 reset();
484 ASSERT_EQ(2u, display_manager()->GetNumDisplays()); 481 ASSERT_EQ(2u, display_manager()->GetNumDisplays());
485 const DisplayInfo& display_info1 = GetDisplayInfoAt(0); 482 const DisplayInfo& display_info1 = GetDisplayInfoAt(0);
486 const DisplayInfo& display_info2 = GetDisplayInfoAt(1); 483 const DisplayInfo& display_info2 = GetDisplayInfoAt(1);
487 display_manager()->SetOverscanInsets( 484 display_manager()->SetOverscanInsets(display_info2.id(),
488 display_info2.id(), gfx::Insets(13, 12, 11, 10)); 485 gfx::Insets(13, 12, 11, 10));
489 486
490 std::vector<display::Display> changed_displays = changed(); 487 std::vector<display::Display> changed_displays = changed();
491 EXPECT_EQ(1u, changed_displays.size()); 488 EXPECT_EQ(1u, changed_displays.size());
492 EXPECT_EQ(display_info2.id(), changed_displays[0].id()); 489 EXPECT_EQ(display_info2.id(), changed_displays[0].id());
493 EXPECT_EQ("0,0 500x500", 490 EXPECT_EQ("0,0 500x500", GetDisplayInfoAt(0).bounds_in_native().ToString());
494 GetDisplayInfoAt(0).bounds_in_native().ToString());
495 DisplayInfo updated_display_info2 = GetDisplayInfoAt(1); 491 DisplayInfo updated_display_info2 = GetDisplayInfoAt(1);
496 EXPECT_EQ("0,501 400x400", 492 EXPECT_EQ("0,501 400x400",
497 updated_display_info2.bounds_in_native().ToString()); 493 updated_display_info2.bounds_in_native().ToString());
498 EXPECT_EQ("378x376", 494 EXPECT_EQ("378x376", updated_display_info2.size_in_pixel().ToString());
499 updated_display_info2.size_in_pixel().ToString());
500 EXPECT_EQ("13,12,11,10", 495 EXPECT_EQ("13,12,11,10",
501 updated_display_info2.overscan_insets_in_dip().ToString()); 496 updated_display_info2.overscan_insets_in_dip().ToString());
502 EXPECT_EQ("500,0 378x376", 497 EXPECT_EQ("500,0 378x376",
503 ScreenUtil::GetSecondaryDisplay().bounds().ToString()); 498 ScreenUtil::GetSecondaryDisplay().bounds().ToString());
504 499
505 // Make sure that SetOverscanInsets() is idempotent. 500 // Make sure that SetOverscanInsets() is idempotent.
506 display_manager()->SetOverscanInsets(display_info1.id(), gfx::Insets()); 501 display_manager()->SetOverscanInsets(display_info1.id(), gfx::Insets());
507 display_manager()->SetOverscanInsets( 502 display_manager()->SetOverscanInsets(display_info2.id(),
508 display_info2.id(), gfx::Insets(13, 12, 11, 10)); 503 gfx::Insets(13, 12, 11, 10));
509 EXPECT_EQ("0,0 500x500", 504 EXPECT_EQ("0,0 500x500", GetDisplayInfoAt(0).bounds_in_native().ToString());
510 GetDisplayInfoAt(0).bounds_in_native().ToString());
511 updated_display_info2 = GetDisplayInfoAt(1); 505 updated_display_info2 = GetDisplayInfoAt(1);
512 EXPECT_EQ("0,501 400x400", 506 EXPECT_EQ("0,501 400x400",
513 updated_display_info2.bounds_in_native().ToString()); 507 updated_display_info2.bounds_in_native().ToString());
514 EXPECT_EQ("378x376", 508 EXPECT_EQ("378x376", updated_display_info2.size_in_pixel().ToString());
515 updated_display_info2.size_in_pixel().ToString());
516 EXPECT_EQ("13,12,11,10", 509 EXPECT_EQ("13,12,11,10",
517 updated_display_info2.overscan_insets_in_dip().ToString()); 510 updated_display_info2.overscan_insets_in_dip().ToString());
518 511
519 display_manager()->SetOverscanInsets( 512 display_manager()->SetOverscanInsets(display_info2.id(),
520 display_info2.id(), gfx::Insets(10, 11, 12, 13)); 513 gfx::Insets(10, 11, 12, 13));
521 EXPECT_EQ("0,0 500x500", 514 EXPECT_EQ("0,0 500x500", GetDisplayInfoAt(0).bounds_in_native().ToString());
522 GetDisplayInfoAt(0).bounds_in_native().ToString()); 515 EXPECT_EQ("376x378", GetDisplayInfoAt(1).size_in_pixel().ToString());
523 EXPECT_EQ("376x378",
524 GetDisplayInfoAt(1).size_in_pixel().ToString());
525 EXPECT_EQ("10,11,12,13", 516 EXPECT_EQ("10,11,12,13",
526 GetDisplayInfoAt(1).overscan_insets_in_dip().ToString()); 517 GetDisplayInfoAt(1).overscan_insets_in_dip().ToString());
527 518
528 // Recreate a new 2nd display. It won't apply the overscan inset because the 519 // Recreate a new 2nd display. It won't apply the overscan inset because the
529 // new display has a different ID. 520 // new display has a different ID.
530 UpdateDisplay("0+0-500x500"); 521 UpdateDisplay("0+0-500x500");
531 UpdateDisplay("0+0-500x500,0+501-400x400"); 522 UpdateDisplay("0+0-500x500,0+501-400x400");
532 EXPECT_EQ("0,0 500x500", 523 EXPECT_EQ("0,0 500x500", GetDisplayInfoAt(0).bounds_in_native().ToString());
533 GetDisplayInfoAt(0).bounds_in_native().ToString()); 524 EXPECT_EQ("0,501 400x400", GetDisplayInfoAt(1).bounds_in_native().ToString());
534 EXPECT_EQ("0,501 400x400",
535 GetDisplayInfoAt(1).bounds_in_native().ToString());
536 525
537 // Recreate the displays with the same ID. It should apply the overscan 526 // Recreate the displays with the same ID. It should apply the overscan
538 // inset. 527 // inset.
539 UpdateDisplay("0+0-500x500"); 528 UpdateDisplay("0+0-500x500");
540 std::vector<DisplayInfo> display_info_list; 529 std::vector<DisplayInfo> display_info_list;
541 display_info_list.push_back(display_info1); 530 display_info_list.push_back(display_info1);
542 display_info_list.push_back(display_info2); 531 display_info_list.push_back(display_info2);
543 display_manager()->OnNativeDisplaysChanged(display_info_list); 532 display_manager()->OnNativeDisplaysChanged(display_info_list);
544 EXPECT_EQ("1,1 500x500", 533 EXPECT_EQ("1,1 500x500", GetDisplayInfoAt(0).bounds_in_native().ToString());
545 GetDisplayInfoAt(0).bounds_in_native().ToString());
546 updated_display_info2 = GetDisplayInfoAt(1); 534 updated_display_info2 = GetDisplayInfoAt(1);
547 EXPECT_EQ("376x378", 535 EXPECT_EQ("376x378", updated_display_info2.size_in_pixel().ToString());
548 updated_display_info2.size_in_pixel().ToString());
549 EXPECT_EQ("10,11,12,13", 536 EXPECT_EQ("10,11,12,13",
550 updated_display_info2.overscan_insets_in_dip().ToString()); 537 updated_display_info2.overscan_insets_in_dip().ToString());
551 538
552 // HiDPI but overscan display. The specified insets size should be doubled. 539 // HiDPI but overscan display. The specified insets size should be doubled.
553 UpdateDisplay("0+0-500x500,0+501-400x400*2"); 540 UpdateDisplay("0+0-500x500,0+501-400x400*2");
554 display_manager()->SetOverscanInsets( 541 display_manager()->SetOverscanInsets(display_manager()->GetDisplayAt(1).id(),
555 display_manager()->GetDisplayAt(1).id(), gfx::Insets(4, 5, 6, 7)); 542 gfx::Insets(4, 5, 6, 7));
556 EXPECT_EQ("0,0 500x500", 543 EXPECT_EQ("0,0 500x500", GetDisplayInfoAt(0).bounds_in_native().ToString());
557 GetDisplayInfoAt(0).bounds_in_native().ToString());
558 updated_display_info2 = GetDisplayInfoAt(1); 544 updated_display_info2 = GetDisplayInfoAt(1);
559 EXPECT_EQ("0,501 400x400", 545 EXPECT_EQ("0,501 400x400",
560 updated_display_info2.bounds_in_native().ToString()); 546 updated_display_info2.bounds_in_native().ToString());
561 EXPECT_EQ("376x380", 547 EXPECT_EQ("376x380", updated_display_info2.size_in_pixel().ToString());
562 updated_display_info2.size_in_pixel().ToString());
563 EXPECT_EQ("4,5,6,7", 548 EXPECT_EQ("4,5,6,7",
564 updated_display_info2.overscan_insets_in_dip().ToString()); 549 updated_display_info2.overscan_insets_in_dip().ToString());
565 EXPECT_EQ("8,10,12,14", 550 EXPECT_EQ("8,10,12,14",
566 updated_display_info2.GetOverscanInsetsInPixel().ToString()); 551 updated_display_info2.GetOverscanInsetsInPixel().ToString());
567 552
568 // Make sure switching primary display applies the overscan offset only once. 553 // Make sure switching primary display applies the overscan offset only once.
569 ash::Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplayId( 554 ash::Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplayId(
570 ScreenUtil::GetSecondaryDisplay().id()); 555 ScreenUtil::GetSecondaryDisplay().id());
571 EXPECT_EQ("-500,0 500x500", 556 EXPECT_EQ("-500,0 500x500",
572 ScreenUtil::GetSecondaryDisplay().bounds().ToString()); 557 ScreenUtil::GetSecondaryDisplay().bounds().ToString());
573 EXPECT_EQ("0,0 500x500", 558 EXPECT_EQ("0,0 500x500", GetDisplayInfo(ScreenUtil::GetSecondaryDisplay())
574 GetDisplayInfo(ScreenUtil::GetSecondaryDisplay()). 559 .bounds_in_native()
575 bounds_in_native().ToString()); 560 .ToString());
576 EXPECT_EQ("0,501 400x400", 561 EXPECT_EQ("0,501 400x400",
577 GetDisplayInfo(display::Screen::GetScreen()->GetPrimaryDisplay()) 562 GetDisplayInfo(display::Screen::GetScreen()->GetPrimaryDisplay())
578 .bounds_in_native() 563 .bounds_in_native()
579 .ToString()); 564 .ToString());
580 EXPECT_EQ( 565 EXPECT_EQ(
581 "0,0 188x190", 566 "0,0 188x190",
582 display::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString()); 567 display::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString());
583 568
584 // Make sure just moving the overscan area should property notify observers. 569 // Make sure just moving the overscan area should property notify observers.
585 UpdateDisplay("0+0-500x500"); 570 UpdateDisplay("0+0-500x500");
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 // and exit mirroring. 774 // and exit mirroring.
790 display_info_list.clear(); 775 display_info_list.clear();
791 display_info_list.push_back(internal_display_info); 776 display_info_list.push_back(internal_display_info);
792 display_info_list.push_back(external_display_info); 777 display_info_list.push_back(external_display_info);
793 display_manager()->OnNativeDisplaysChanged(display_info_list); 778 display_manager()->OnNativeDisplaysChanged(display_info_list);
794 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); 779 EXPECT_EQ(2U, display_manager()->GetNumDisplays());
795 EXPECT_EQ(2U, display_manager()->num_connected_displays()); 780 EXPECT_EQ(2U, display_manager()->num_connected_displays());
796 EXPECT_FALSE(display_manager()->IsInMirrorMode()); 781 EXPECT_FALSE(display_manager()->IsInMirrorMode());
797 EXPECT_EQ("0,0 500x500", 782 EXPECT_EQ("0,0 500x500",
798 GetDisplayForId(internal_display_id).bounds().ToString()); 783 GetDisplayForId(internal_display_id).bounds().ToString());
799 EXPECT_EQ("500,0 100x100", 784 EXPECT_EQ("500,0 100x100", GetDisplayForId(10).bounds().ToString());
800 GetDisplayForId(10).bounds().ToString());
801 785
802 // Turn off internal 786 // Turn off internal
803 display_info_list.clear(); 787 display_info_list.clear();
804 display_info_list.push_back(external_display_info); 788 display_info_list.push_back(external_display_info);
805 display_manager()->OnNativeDisplaysChanged(display_info_list); 789 display_manager()->OnNativeDisplaysChanged(display_info_list);
806 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 790 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
807 EXPECT_EQ(invalid_id, GetDisplayForId(internal_display_id).id()); 791 EXPECT_EQ(invalid_id, GetDisplayForId(internal_display_id).id());
808 EXPECT_EQ("1,1 100x100", 792 EXPECT_EQ("1,1 100x100",
809 GetDisplayInfoForId(external_id).bounds_in_native().ToString()); 793 GetDisplayInfoForId(external_id).bounds_in_native().ToString());
810 EXPECT_EQ(1U, display_manager()->num_connected_displays()); 794 EXPECT_EQ(1U, display_manager()->num_connected_displays());
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 849 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
866 850
867 // Connect another display which will become primary. 851 // Connect another display which will become primary.
868 const DisplayInfo external_display_info = 852 const DisplayInfo external_display_info =
869 CreateDisplayInfo(10, gfx::Rect(1, 1, 100, 100)); 853 CreateDisplayInfo(10, gfx::Rect(1, 1, 100, 100));
870 display_info_list.push_back(external_display_info); 854 display_info_list.push_back(external_display_info);
871 display_manager()->OnNativeDisplaysChanged(display_info_list); 855 display_manager()->OnNativeDisplaysChanged(display_info_list);
872 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 856 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
873 EXPECT_EQ("1,1 100x100", 857 EXPECT_EQ("1,1 100x100",
874 GetDisplayInfoForId(10).bounds_in_native().ToString()); 858 GetDisplayInfoForId(10).bounds_in_native().ToString());
875 EXPECT_EQ("100x100", ash::Shell::GetPrimaryRootWindow()->GetHost()-> 859 EXPECT_EQ("100x100", ash::Shell::GetPrimaryRootWindow()
876 GetBounds().size().ToString()); 860 ->GetHost()
861 ->GetBounds()
862 .size()
863 .ToString());
877 } 864 }
878 #endif // defined(OS_CHROMEOS) 865 #endif // defined(OS_CHROMEOS)
879 866
880 TEST_P(DisplayManagerTest, NativeDisplaysChangedAfterPrimaryChange) { 867 TEST_P(DisplayManagerTest, NativeDisplaysChangedAfterPrimaryChange) {
881 if (!SupportsMultipleDisplays()) 868 if (!SupportsMultipleDisplays())
882 return; 869 return;
883 870
884 const int64_t internal_display_id = 871 const int64_t internal_display_id =
885 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay(); 872 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay();
886 const DisplayInfo native_display_info = 873 const DisplayInfo native_display_info =
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 EXPECT_TRUE(mode.native); 1013 EXPECT_TRUE(mode.native);
1027 } 1014 }
1028 } 1015 }
1029 #endif // defined(OS_CHROMEOS) 1016 #endif // defined(OS_CHROMEOS)
1030 1017
1031 TEST_P(DisplayManagerTest, Rotate) { 1018 TEST_P(DisplayManagerTest, Rotate) {
1032 if (!SupportsMultipleDisplays()) 1019 if (!SupportsMultipleDisplays())
1033 return; 1020 return;
1034 1021
1035 UpdateDisplay("100x200/r,300x400/l"); 1022 UpdateDisplay("100x200/r,300x400/l");
1036 EXPECT_EQ("1,1 100x200", 1023 EXPECT_EQ("1,1 100x200", GetDisplayInfoAt(0).bounds_in_native().ToString());
1037 GetDisplayInfoAt(0).bounds_in_native().ToString()); 1024 EXPECT_EQ("200x100", GetDisplayInfoAt(0).size_in_pixel().ToString());
1038 EXPECT_EQ("200x100",
1039 GetDisplayInfoAt(0).size_in_pixel().ToString());
1040 1025
1041 EXPECT_EQ("1,201 300x400", 1026 EXPECT_EQ("1,201 300x400", GetDisplayInfoAt(1).bounds_in_native().ToString());
1042 GetDisplayInfoAt(1).bounds_in_native().ToString()); 1027 EXPECT_EQ("400x300", GetDisplayInfoAt(1).size_in_pixel().ToString());
1043 EXPECT_EQ("400x300",
1044 GetDisplayInfoAt(1).size_in_pixel().ToString());
1045 reset(); 1028 reset();
1046 UpdateDisplay("100x200/b,300x400"); 1029 UpdateDisplay("100x200/b,300x400");
1047 EXPECT_EQ("2 0 0", GetCountSummary()); 1030 EXPECT_EQ("2 0 0", GetCountSummary());
1048 reset(); 1031 reset();
1049 1032
1050 EXPECT_EQ("1,1 100x200", 1033 EXPECT_EQ("1,1 100x200", GetDisplayInfoAt(0).bounds_in_native().ToString());
1051 GetDisplayInfoAt(0).bounds_in_native().ToString()); 1034 EXPECT_EQ("100x200", GetDisplayInfoAt(0).size_in_pixel().ToString());
1052 EXPECT_EQ("100x200",
1053 GetDisplayInfoAt(0).size_in_pixel().ToString());
1054 1035
1055 EXPECT_EQ("1,201 300x400", 1036 EXPECT_EQ("1,201 300x400", GetDisplayInfoAt(1).bounds_in_native().ToString());
1056 GetDisplayInfoAt(1).bounds_in_native().ToString()); 1037 EXPECT_EQ("300x400", GetDisplayInfoAt(1).size_in_pixel().ToString());
1057 EXPECT_EQ("300x400",
1058 GetDisplayInfoAt(1).size_in_pixel().ToString());
1059 1038
1060 // Just Rotating display will change the bounds on both display. 1039 // Just Rotating display will change the bounds on both display.
1061 UpdateDisplay("100x200/l,300x400"); 1040 UpdateDisplay("100x200/l,300x400");
1062 EXPECT_EQ("2 0 0", GetCountSummary()); 1041 EXPECT_EQ("2 0 0", GetCountSummary());
1063 reset(); 1042 reset();
1064 1043
1065 // Updating to the same configuration should report no changes. 1044 // Updating to the same configuration should report no changes.
1066 UpdateDisplay("100x200/l,300x400"); 1045 UpdateDisplay("100x200/l,300x400");
1067 EXPECT_EQ("0 0 0", GetCountSummary()); 1046 EXPECT_EQ("0 0 0", GetCountSummary());
1068 reset(); 1047 reset();
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1603 TEST_P(DisplayManagerTest, SoftwareMirroringWithCompositingCursor) { 1582 TEST_P(DisplayManagerTest, SoftwareMirroringWithCompositingCursor) {
1604 if (!SupportsMultipleDisplays()) 1583 if (!SupportsMultipleDisplays())
1605 return; 1584 return;
1606 1585
1607 UpdateDisplay("300x400,400x500"); 1586 UpdateDisplay("300x400,400x500");
1608 1587
1609 test::MirrorWindowTestApi test_api; 1588 test::MirrorWindowTestApi test_api;
1610 EXPECT_EQ(nullptr, test_api.GetHost()); 1589 EXPECT_EQ(nullptr, test_api.GetHost());
1611 1590
1612 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 1591 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
1613 DisplayInfo secondary_info = display_manager->GetDisplayInfo( 1592 DisplayInfo secondary_info =
1614 ScreenUtil::GetSecondaryDisplay().id()); 1593 display_manager->GetDisplayInfo(ScreenUtil::GetSecondaryDisplay().id());
1615 1594
1616 display_manager->SetSoftwareMirroring(true); 1595 display_manager->SetSoftwareMirroring(true);
1617 display_manager->UpdateDisplays(); 1596 display_manager->UpdateDisplays();
1618 1597
1619 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 1598 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
1620 EXPECT_FALSE(root_windows[0]->Contains(test_api.GetCursorWindow())); 1599 EXPECT_FALSE(root_windows[0]->Contains(test_api.GetCursorWindow()));
1621 1600
1622 Shell::GetInstance()->SetCursorCompositingEnabled(true); 1601 Shell::GetInstance()->SetCursorCompositingEnabled(true);
1623 1602
1624 EXPECT_TRUE(root_windows[0]->Contains(test_api.GetCursorWindow())); 1603 EXPECT_TRUE(root_windows[0]->Contains(test_api.GetCursorWindow()));
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
2133 display::DisplayLayoutBuilder builder(1); 2112 display::DisplayLayoutBuilder builder(1);
2134 builder.AddDisplayPlacement(2, 1, display::DisplayPlacement::LEFT, 0); 2113 builder.AddDisplayPlacement(2, 1, display::DisplayPlacement::LEFT, 0);
2135 builder.AddDisplayPlacement(3, 1, display::DisplayPlacement::BOTTOM, 0); 2114 builder.AddDisplayPlacement(3, 1, display::DisplayPlacement::BOTTOM, 0);
2136 2115
2137 display_manager()->layout_store()->RegisterLayoutForDisplayIdList( 2116 display_manager()->layout_store()->RegisterLayoutForDisplayIdList(
2138 list, builder.Build()); 2117 list, builder.Build());
2139 } 2118 }
2140 2119
2141 class ScreenShutdownTest : public test::AshTestBase { 2120 class ScreenShutdownTest : public test::AshTestBase {
2142 public: 2121 public:
2143 ScreenShutdownTest() { 2122 ScreenShutdownTest() {}
2144 }
2145 ~ScreenShutdownTest() override {} 2123 ~ScreenShutdownTest() override {}
2146 2124
2147 void TearDown() override { 2125 void TearDown() override {
2148 display::Screen* orig_screen = display::Screen::GetScreen(); 2126 display::Screen* orig_screen = display::Screen::GetScreen();
2149 AshTestBase::TearDown(); 2127 AshTestBase::TearDown();
2150 if (!SupportsMultipleDisplays()) 2128 if (!SupportsMultipleDisplays())
2151 return; 2129 return;
2152 display::Screen* screen = display::Screen::GetScreen(); 2130 display::Screen* screen = display::Screen::GetScreen();
2153 EXPECT_NE(orig_screen, screen); 2131 EXPECT_NE(orig_screen, screen);
2154 EXPECT_EQ(2, screen->GetNumDisplays()); 2132 EXPECT_EQ(2, screen->GetNumDisplays());
(...skipping 14 matching lines...) Expand all
2169 } 2147 }
2170 2148
2171 #if defined(OS_CHROMEOS) 2149 #if defined(OS_CHROMEOS)
2172 namespace { 2150 namespace {
2173 2151
2174 // A helper class that sets the display configuration and starts ash. 2152 // A helper class that sets the display configuration and starts ash.
2175 // This is to make sure the font configuration happens during ash 2153 // This is to make sure the font configuration happens during ash
2176 // initialization process. 2154 // initialization process.
2177 class FontTestHelper : public test::AshTestBase { 2155 class FontTestHelper : public test::AshTestBase {
2178 public: 2156 public:
2179 enum DisplayType { 2157 enum DisplayType { INTERNAL, EXTERNAL };
2180 INTERNAL,
2181 EXTERNAL
2182 };
2183 2158
2184 FontTestHelper(float scale, DisplayType display_type) { 2159 FontTestHelper(float scale, DisplayType display_type) {
2185 gfx::ClearFontRenderParamsCacheForTest(); 2160 gfx::ClearFontRenderParamsCacheForTest();
2186 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 2161 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
2187 if (display_type == INTERNAL) 2162 if (display_type == INTERNAL)
2188 command_line->AppendSwitch(switches::kAshUseFirstDisplayAsInternal); 2163 command_line->AppendSwitch(switches::kAshUseFirstDisplayAsInternal);
2189 command_line->AppendSwitchASCII(switches::kAshHostWindowBounds, 2164 command_line->AppendSwitchASCII(switches::kAshHostWindowBounds,
2190 StringPrintf("1000x800*%f", scale)); 2165 StringPrintf("1000x800*%f", scale));
2191 SetUp(); 2166 SetUp();
2192 } 2167 }
2193 2168
2194 ~FontTestHelper() override { TearDown(); } 2169 ~FontTestHelper() override { TearDown(); }
2195 2170
2196 // test::AshTestBase: 2171 // test::AshTestBase:
2197 void TestBody() override { NOTREACHED(); } 2172 void TestBody() override { NOTREACHED(); }
2198 2173
2199 private: 2174 private:
2200 DISALLOW_COPY_AND_ASSIGN(FontTestHelper); 2175 DISALLOW_COPY_AND_ASSIGN(FontTestHelper);
2201 }; 2176 };
2202 2177
2203
2204 bool IsTextSubpixelPositioningEnabled() { 2178 bool IsTextSubpixelPositioningEnabled() {
2205 gfx::FontRenderParams params = 2179 gfx::FontRenderParams params =
2206 gfx::GetFontRenderParams(gfx::FontRenderParamsQuery(), nullptr); 2180 gfx::GetFontRenderParams(gfx::FontRenderParamsQuery(), nullptr);
2207 return params.subpixel_positioning; 2181 return params.subpixel_positioning;
2208 } 2182 }
2209 2183
2210 gfx::FontRenderParams::Hinting GetFontHintingParams() { 2184 gfx::FontRenderParams::Hinting GetFontHintingParams() {
2211 gfx::FontRenderParams params = 2185 gfx::FontRenderParams params =
2212 gfx::GetFontRenderParams(gfx::FontRenderParamsQuery(), nullptr); 2186 gfx::GetFontRenderParams(gfx::FontRenderParamsQuery(), nullptr);
2213 return params.hinting; 2187 return params.hinting;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
2353 const display::DisplayLayout& stored = 2327 const display::DisplayLayout& stored =
2354 layout_store->GetRegisteredDisplayLayout(list); 2328 layout_store->GetRegisteredDisplayLayout(list);
2355 2329
2356 EXPECT_EQ(id1, stored.placement_list[0].parent_display_id); 2330 EXPECT_EQ(id1, stored.placement_list[0].parent_display_id);
2357 EXPECT_EQ(id2, stored.placement_list[0].display_id); 2331 EXPECT_EQ(id2, stored.placement_list[0].display_id);
2358 } 2332 }
2359 2333
2360 #endif // OS_CHROMEOS 2334 #endif // OS_CHROMEOS
2361 2335
2362 } // namespace ash 2336 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_manager.cc ('k') | ash/display/display_pref_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698