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

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

Issue 1608053002: Remove now-unnecessary wrappers around gfx::Screen::GetScreen() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-5
Patch Set: cros Created 4 years, 11 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
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"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 public: 52 public:
53 DisplayManagerTest() 53 DisplayManagerTest()
54 : removed_count_(0U), 54 : removed_count_(0U),
55 root_window_destroyed_(false), 55 root_window_destroyed_(false),
56 changed_metrics_(0U) { 56 changed_metrics_(0U) {
57 } 57 }
58 ~DisplayManagerTest() override {} 58 ~DisplayManagerTest() override {}
59 59
60 void SetUp() override { 60 void SetUp() override {
61 AshTestBase::SetUp(); 61 AshTestBase::SetUp();
62 Shell::GetScreen()->AddObserver(this); 62 gfx::Screen::GetScreen()->AddObserver(this);
63 Shell::GetPrimaryRootWindow()->AddObserver(this); 63 Shell::GetPrimaryRootWindow()->AddObserver(this);
64 } 64 }
65 void TearDown() override { 65 void TearDown() override {
66 Shell::GetPrimaryRootWindow()->RemoveObserver(this); 66 Shell::GetPrimaryRootWindow()->RemoveObserver(this);
67 Shell::GetScreen()->RemoveObserver(this); 67 gfx::Screen::GetScreen()->RemoveObserver(this);
68 AshTestBase::TearDown(); 68 AshTestBase::TearDown();
69 } 69 }
70 70
71 DisplayManager* display_manager() { 71 DisplayManager* display_manager() {
72 return Shell::GetInstance()->display_manager(); 72 return Shell::GetInstance()->display_manager();
73 } 73 }
74 const vector<gfx::Display>& changed() const { return changed_; } 74 const vector<gfx::Display>& changed() const { return changed_; }
75 const vector<gfx::Display>& added() const { return added_; } 75 const vector<gfx::Display>& added() const { return added_; }
76 uint32_t changed_metrics() const { return changed_metrics_; } 76 uint32_t changed_metrics() const { return changed_metrics_; }
77 77
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 408
409 // Make sure switching primary display applies the overscan offset only once. 409 // Make sure switching primary display applies the overscan offset only once.
410 ash::Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplay( 410 ash::Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplay(
411 ScreenUtil::GetSecondaryDisplay()); 411 ScreenUtil::GetSecondaryDisplay());
412 EXPECT_EQ("-500,0 500x500", 412 EXPECT_EQ("-500,0 500x500",
413 ScreenUtil::GetSecondaryDisplay().bounds().ToString()); 413 ScreenUtil::GetSecondaryDisplay().bounds().ToString());
414 EXPECT_EQ("0,0 500x500", 414 EXPECT_EQ("0,0 500x500",
415 GetDisplayInfo(ScreenUtil::GetSecondaryDisplay()). 415 GetDisplayInfo(ScreenUtil::GetSecondaryDisplay()).
416 bounds_in_native().ToString()); 416 bounds_in_native().ToString());
417 EXPECT_EQ("0,501 400x400", 417 EXPECT_EQ("0,501 400x400",
418 GetDisplayInfo(Shell::GetScreen()->GetPrimaryDisplay()). 418 GetDisplayInfo(gfx::Screen::GetScreen()->GetPrimaryDisplay())
419 bounds_in_native().ToString()); 419 .bounds_in_native()
420 .ToString());
420 EXPECT_EQ("0,0 188x190", 421 EXPECT_EQ("0,0 188x190",
421 Shell::GetScreen()->GetPrimaryDisplay().bounds().ToString()); 422 gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString());
422 423
423 // Make sure just moving the overscan area should property notify observers. 424 // Make sure just moving the overscan area should property notify observers.
424 UpdateDisplay("0+0-500x500"); 425 UpdateDisplay("0+0-500x500");
425 int64_t primary_id = Shell::GetScreen()->GetPrimaryDisplay().id(); 426 int64_t primary_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id();
426 display_manager()->SetOverscanInsets(primary_id, gfx::Insets(0, 0, 20, 20)); 427 display_manager()->SetOverscanInsets(primary_id, gfx::Insets(0, 0, 20, 20));
427 EXPECT_EQ("0,0 480x480", 428 EXPECT_EQ("0,0 480x480",
428 Shell::GetScreen()->GetPrimaryDisplay().bounds().ToString()); 429 gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString());
429 reset(); 430 reset();
430 display_manager()->SetOverscanInsets(primary_id, gfx::Insets(10, 10, 10, 10)); 431 display_manager()->SetOverscanInsets(primary_id, gfx::Insets(10, 10, 10, 10));
431 EXPECT_TRUE(changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS); 432 EXPECT_TRUE(changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS);
432 EXPECT_TRUE( 433 EXPECT_TRUE(
433 changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA); 434 changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA);
434 EXPECT_EQ("0,0 480x480", 435 EXPECT_EQ("0,0 480x480",
435 Shell::GetScreen()->GetPrimaryDisplay().bounds().ToString()); 436 gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString());
436 reset(); 437 reset();
437 display_manager()->SetOverscanInsets(primary_id, gfx::Insets(0, 0, 0, 0)); 438 display_manager()->SetOverscanInsets(primary_id, gfx::Insets(0, 0, 0, 0));
438 EXPECT_TRUE(changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS); 439 EXPECT_TRUE(changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS);
439 EXPECT_TRUE( 440 EXPECT_TRUE(
440 changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA); 441 changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA);
441 EXPECT_EQ("0,0 500x500", 442 EXPECT_EQ("0,0 500x500",
442 Shell::GetScreen()->GetPrimaryDisplay().bounds().ToString()); 443 gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString());
443 } 444 }
444 445
445 TEST_F(DisplayManagerTest, ZeroOverscanInsets) { 446 TEST_F(DisplayManagerTest, ZeroOverscanInsets) {
446 if (!SupportsMultipleDisplays()) 447 if (!SupportsMultipleDisplays())
447 return; 448 return;
448 449
449 // Make sure the display change events is emitted for overscan inset changes. 450 // Make sure the display change events is emitted for overscan inset changes.
450 UpdateDisplay("0+0-500x500,0+501-400x400"); 451 UpdateDisplay("0+0-500x500,0+501-400x400");
451 ASSERT_EQ(2u, display_manager()->GetNumDisplays()); 452 ASSERT_EQ(2u, display_manager()->GetNumDisplays());
452 int64_t display2_id = display_manager()->GetDisplayAt(1).id(); 453 int64_t display2_id = display_manager()->GetDisplayAt(1).id();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 // External connected while primary was disconnected. 524 // External connected while primary was disconnected.
524 display_info_list.push_back(external_display_info); 525 display_info_list.push_back(external_display_info);
525 display_manager()->OnNativeDisplaysChanged(display_info_list); 526 display_manager()->OnNativeDisplaysChanged(display_info_list);
526 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 527 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
527 528
528 EXPECT_EQ(invalid_id, GetDisplayForId(internal_display_id).id()); 529 EXPECT_EQ(invalid_id, GetDisplayForId(internal_display_id).id());
529 EXPECT_EQ("1,1 100x100", 530 EXPECT_EQ("1,1 100x100",
530 GetDisplayInfoForId(external_id).bounds_in_native().ToString()); 531 GetDisplayInfoForId(external_id).bounds_in_native().ToString());
531 EXPECT_EQ(1U, display_manager()->num_connected_displays()); 532 EXPECT_EQ(1U, display_manager()->num_connected_displays());
532 EXPECT_FALSE(display_manager()->IsInMirrorMode()); 533 EXPECT_FALSE(display_manager()->IsInMirrorMode());
533 EXPECT_EQ(external_id, Shell::GetScreen()->GetPrimaryDisplay().id()); 534 EXPECT_EQ(external_id, gfx::Screen::GetScreen()->GetPrimaryDisplay().id());
534 535
535 EXPECT_EQ(internal_display_id, gfx::Display::InternalDisplayId()); 536 EXPECT_EQ(internal_display_id, gfx::Display::InternalDisplayId());
536 537
537 // Primary connected, with different bounds. 538 // Primary connected, with different bounds.
538 display_info_list.clear(); 539 display_info_list.clear();
539 display_info_list.push_back(internal_display_info); 540 display_info_list.push_back(internal_display_info);
540 display_info_list.push_back(external_display_info); 541 display_info_list.push_back(external_display_info);
541 display_manager()->OnNativeDisplaysChanged(display_info_list); 542 display_manager()->OnNativeDisplaysChanged(display_info_list);
542 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); 543 EXPECT_EQ(2U, display_manager()->GetNumDisplays());
543 EXPECT_EQ(internal_display_id, Shell::GetScreen()->GetPrimaryDisplay().id()); 544 EXPECT_EQ(internal_display_id,
545 gfx::Screen::GetScreen()->GetPrimaryDisplay().id());
544 546
545 // This combinatino is new, so internal display becomes primary. 547 // This combinatino is new, so internal display becomes primary.
546 EXPECT_EQ("0,0 500x500", 548 EXPECT_EQ("0,0 500x500",
547 GetDisplayForId(internal_display_id).bounds().ToString()); 549 GetDisplayForId(internal_display_id).bounds().ToString());
548 EXPECT_EQ("1,1 100x100", 550 EXPECT_EQ("1,1 100x100",
549 GetDisplayInfoForId(10).bounds_in_native().ToString()); 551 GetDisplayInfoForId(10).bounds_in_native().ToString());
550 EXPECT_EQ(2U, display_manager()->num_connected_displays()); 552 EXPECT_EQ(2U, display_manager()->num_connected_displays());
551 EXPECT_FALSE(display_manager()->IsInMirrorMode()); 553 EXPECT_FALSE(display_manager()->IsInMirrorMode());
552 EXPECT_EQ(ToDisplayName(internal_display_id), 554 EXPECT_EQ(ToDisplayName(internal_display_id),
553 display_manager()->GetDisplayNameForId(internal_display_id)); 555 display_manager()->GetDisplayNameForId(internal_display_id));
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 const DisplayInfo post_rotation_info = 950 const DisplayInfo post_rotation_info =
949 display_manager()->display_info_[internal_display_id]; 951 display_manager()->display_info_[internal_display_id];
950 EXPECT_NE(info.GetActiveRotation(), post_rotation_info.GetActiveRotation()); 952 EXPECT_NE(info.GetActiveRotation(), post_rotation_info.GetActiveRotation());
951 EXPECT_EQ(gfx::Display::ROTATE_180, post_rotation_info.GetActiveRotation()); 953 EXPECT_EQ(gfx::Display::ROTATE_180, post_rotation_info.GetActiveRotation());
952 } 954 }
953 955
954 TEST_F(DisplayManagerTest, UIScale) { 956 TEST_F(DisplayManagerTest, UIScale) {
955 test::ScopedDisable125DSFForUIScaling disable; 957 test::ScopedDisable125DSFForUIScaling disable;
956 958
957 UpdateDisplay("1280x800"); 959 UpdateDisplay("1280x800");
958 int64_t display_id = Shell::GetScreen()->GetPrimaryDisplay().id(); 960 int64_t display_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id();
959 SetDisplayUIScale(display_id, 1.125f); 961 SetDisplayUIScale(display_id, 1.125f);
960 EXPECT_EQ(1.0, GetDisplayInfoAt(0).configured_ui_scale()); 962 EXPECT_EQ(1.0, GetDisplayInfoAt(0).configured_ui_scale());
961 SetDisplayUIScale(display_id, 0.8f); 963 SetDisplayUIScale(display_id, 0.8f);
962 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale()); 964 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale());
963 SetDisplayUIScale(display_id, 0.75f); 965 SetDisplayUIScale(display_id, 0.75f);
964 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale()); 966 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale());
965 SetDisplayUIScale(display_id, 0.625f); 967 SetDisplayUIScale(display_id, 0.625f);
966 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale()); 968 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale());
967 969
968 test::ScopedSetInternalDisplayId set_internal(display_id); 970 test::ScopedSetInternalDisplayId set_internal(display_id);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 UpdateDisplay("1280x850*2"); 1007 UpdateDisplay("1280x850*2");
1006 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale()); 1008 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale());
1007 SetDisplayUIScale(display_id, 1.5f); 1009 SetDisplayUIScale(display_id, 1.5f);
1008 EXPECT_EQ(1.5f, GetDisplayInfoAt(0).configured_ui_scale()); 1010 EXPECT_EQ(1.5f, GetDisplayInfoAt(0).configured_ui_scale());
1009 SetDisplayUIScale(display_id, 1.25f); 1011 SetDisplayUIScale(display_id, 1.25f);
1010 EXPECT_EQ(1.25f, GetDisplayInfoAt(0).configured_ui_scale()); 1012 EXPECT_EQ(1.25f, GetDisplayInfoAt(0).configured_ui_scale());
1011 SetDisplayUIScale(display_id, 1.125f); 1013 SetDisplayUIScale(display_id, 1.125f);
1012 EXPECT_EQ(1.125f, GetDisplayInfoAt(0).configured_ui_scale()); 1014 EXPECT_EQ(1.125f, GetDisplayInfoAt(0).configured_ui_scale());
1013 SetDisplayUIScale(display_id, 1.0f); 1015 SetDisplayUIScale(display_id, 1.0f);
1014 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale()); 1016 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale());
1015 gfx::Display display = Shell::GetScreen()->GetPrimaryDisplay(); 1017 gfx::Display display = gfx::Screen::GetScreen()->GetPrimaryDisplay();
1016 EXPECT_EQ(2.0f, display.device_scale_factor()); 1018 EXPECT_EQ(2.0f, display.device_scale_factor());
1017 EXPECT_EQ("640x425", display.bounds().size().ToString()); 1019 EXPECT_EQ("640x425", display.bounds().size().ToString());
1018 1020
1019 SetDisplayUIScale(display_id, 0.8f); 1021 SetDisplayUIScale(display_id, 0.8f);
1020 EXPECT_EQ(0.8f, GetDisplayInfoAt(0).configured_ui_scale()); 1022 EXPECT_EQ(0.8f, GetDisplayInfoAt(0).configured_ui_scale());
1021 SetDisplayUIScale(display_id, 0.75f); 1023 SetDisplayUIScale(display_id, 0.75f);
1022 EXPECT_EQ(0.8f, GetDisplayInfoAt(0).configured_ui_scale()); 1024 EXPECT_EQ(0.8f, GetDisplayInfoAt(0).configured_ui_scale());
1023 SetDisplayUIScale(display_id, 0.625f); 1025 SetDisplayUIScale(display_id, 0.625f);
1024 EXPECT_EQ(0.625f, GetDisplayInfoAt(0).configured_ui_scale()); 1026 EXPECT_EQ(0.625f, GetDisplayInfoAt(0).configured_ui_scale());
1025 SetDisplayUIScale(display_id, 0.6f); 1027 SetDisplayUIScale(display_id, 0.6f);
1026 EXPECT_EQ(0.625f, GetDisplayInfoAt(0).configured_ui_scale()); 1028 EXPECT_EQ(0.625f, GetDisplayInfoAt(0).configured_ui_scale());
1027 SetDisplayUIScale(display_id, 0.5f); 1029 SetDisplayUIScale(display_id, 0.5f);
1028 EXPECT_EQ(0.5f, GetDisplayInfoAt(0).configured_ui_scale()); 1030 EXPECT_EQ(0.5f, GetDisplayInfoAt(0).configured_ui_scale());
1029 1031
1030 SetDisplayUIScale(display_id, 2.0f); 1032 SetDisplayUIScale(display_id, 2.0f);
1031 EXPECT_EQ(2.0f, GetDisplayInfoAt(0).configured_ui_scale()); 1033 EXPECT_EQ(2.0f, GetDisplayInfoAt(0).configured_ui_scale());
1032 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale()); 1034 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale());
1033 display = Shell::GetScreen()->GetPrimaryDisplay(); 1035 display = gfx::Screen::GetScreen()->GetPrimaryDisplay();
1034 EXPECT_EQ(1.0f, display.device_scale_factor()); 1036 EXPECT_EQ(1.0f, display.device_scale_factor());
1035 EXPECT_EQ("1280x850", display.bounds().size().ToString()); 1037 EXPECT_EQ("1280x850", display.bounds().size().ToString());
1036 1038
1037 // 1.25 ui scaling on 1.25 DSF device should use 1.0 DSF 1039 // 1.25 ui scaling on 1.25 DSF device should use 1.0 DSF
1038 // on screen. 1040 // on screen.
1039 UpdateDisplay("1280x850*1.25"); 1041 UpdateDisplay("1280x850*1.25");
1040 SetDisplayUIScale(display_id, 1.25f); 1042 SetDisplayUIScale(display_id, 1.25f);
1041 EXPECT_EQ(1.25f, GetDisplayInfoAt(0).configured_ui_scale()); 1043 EXPECT_EQ(1.25f, GetDisplayInfoAt(0).configured_ui_scale());
1042 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale()); 1044 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale());
1043 display = Shell::GetScreen()->GetPrimaryDisplay(); 1045 display = gfx::Screen::GetScreen()->GetPrimaryDisplay();
1044 EXPECT_EQ(1.0f, display.device_scale_factor()); 1046 EXPECT_EQ(1.0f, display.device_scale_factor());
1045 EXPECT_EQ("1280x850", display.bounds().size().ToString()); 1047 EXPECT_EQ("1280x850", display.bounds().size().ToString());
1046 } 1048 }
1047 1049
1048 TEST_F(DisplayManagerTest, UIScaleWithDisplayMode) { 1050 TEST_F(DisplayManagerTest, UIScaleWithDisplayMode) {
1049 int display_id = 1000; 1051 int display_id = 1000;
1050 1052
1051 // Setup the display modes with UI-scale. 1053 // Setup the display modes with UI-scale.
1052 DisplayInfo native_display_info = 1054 DisplayInfo native_display_info =
1053 CreateDisplayInfo(display_id, gfx::Rect(0, 0, 1280, 800)); 1055 CreateDisplayInfo(display_id, gfx::Rect(0, 0, 1280, 800));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 EXPECT_TRUE(expected_mode.IsEquivalent( 1100 EXPECT_TRUE(expected_mode.IsEquivalent(
1099 display_manager()->GetActiveModeForDisplayId(display_id))); 1101 display_manager()->GetActiveModeForDisplayId(display_id)));
1100 SetDisplayUIScale(display_id, 0.5f); 1102 SetDisplayUIScale(display_id, 0.5f);
1101 EXPECT_EQ(0.5f, GetDisplayInfoAt(0).configured_ui_scale()); 1103 EXPECT_EQ(0.5f, GetDisplayInfoAt(0).configured_ui_scale());
1102 expected_mode.ui_scale = 0.5f; 1104 expected_mode.ui_scale = 0.5f;
1103 EXPECT_TRUE(expected_mode.IsEquivalent( 1105 EXPECT_TRUE(expected_mode.IsEquivalent(
1104 display_manager()->GetActiveModeForDisplayId(display_id))); 1106 display_manager()->GetActiveModeForDisplayId(display_id)));
1105 } 1107 }
1106 1108
1107 TEST_F(DisplayManagerTest, Use125DSFForUIScaling) { 1109 TEST_F(DisplayManagerTest, Use125DSFForUIScaling) {
1108 int64_t display_id = Shell::GetScreen()->GetPrimaryDisplay().id(); 1110 int64_t display_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id();
1109 test::ScopedSetInternalDisplayId set_internal(display_id); 1111 test::ScopedSetInternalDisplayId set_internal(display_id);
1110 1112
1111 UpdateDisplay("1920x1080*1.25"); 1113 UpdateDisplay("1920x1080*1.25");
1112 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); 1114 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor());
1113 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale()); 1115 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale());
1114 1116
1115 SetDisplayUIScale(display_id, 0.8f); 1117 SetDisplayUIScale(display_id, 0.8f);
1116 EXPECT_EQ(1.25f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); 1118 EXPECT_EQ(1.25f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor());
1117 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale()); 1119 EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale());
1118 EXPECT_EQ("1536x864", GetDisplayForId(display_id).size().ToString()); 1120 EXPECT_EQ("1536x864", GetDisplayForId(display_id).size().ToString());
(...skipping 13 matching lines...) Expand all
1132 if (!SupportsMultipleDisplays()) 1134 if (!SupportsMultipleDisplays())
1133 return; 1135 return;
1134 // Don't check root window destruction in unified mode. 1136 // Don't check root window destruction in unified mode.
1135 Shell::GetPrimaryRootWindow()->RemoveObserver(this); 1137 Shell::GetPrimaryRootWindow()->RemoveObserver(this);
1136 1138
1137 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 1139 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
1138 display_manager->SetUnifiedDesktopEnabled(true); 1140 display_manager->SetUnifiedDesktopEnabled(true);
1139 1141
1140 UpdateDisplay("200x200, 400x400"); 1142 UpdateDisplay("200x200, 400x400");
1141 1143
1142 int64_t unified_id = Shell::GetScreen()->GetPrimaryDisplay().id(); 1144 int64_t unified_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id();
1143 DisplayInfo info = display_manager->GetDisplayInfo(unified_id); 1145 DisplayInfo info = display_manager->GetDisplayInfo(unified_id);
1144 ASSERT_EQ(2u, info.display_modes().size()); 1146 ASSERT_EQ(2u, info.display_modes().size());
1145 EXPECT_EQ("400x200", info.display_modes()[0].size.ToString()); 1147 EXPECT_EQ("400x200", info.display_modes()[0].size.ToString());
1146 EXPECT_TRUE(info.display_modes()[0].native); 1148 EXPECT_TRUE(info.display_modes()[0].native);
1147 EXPECT_EQ("800x400", info.display_modes()[1].size.ToString()); 1149 EXPECT_EQ("800x400", info.display_modes()[1].size.ToString());
1148 EXPECT_FALSE(info.display_modes()[1].native); 1150 EXPECT_FALSE(info.display_modes()[1].native);
1149 EXPECT_EQ("400x200", 1151 EXPECT_EQ("400x200",
1150 Shell::GetScreen()->GetPrimaryDisplay().size().ToString()); 1152 gfx::Screen::GetScreen()->GetPrimaryDisplay().size().ToString());
1151 DisplayMode active_mode = 1153 DisplayMode active_mode =
1152 display_manager->GetActiveModeForDisplayId(unified_id); 1154 display_manager->GetActiveModeForDisplayId(unified_id);
1153 EXPECT_EQ(1.0f, active_mode.ui_scale); 1155 EXPECT_EQ(1.0f, active_mode.ui_scale);
1154 EXPECT_EQ("400x200", active_mode.size.ToString()); 1156 EXPECT_EQ("400x200", active_mode.size.ToString());
1155 1157
1156 EXPECT_TRUE(test::SetDisplayResolution(unified_id, gfx::Size(800, 400))); 1158 EXPECT_TRUE(test::SetDisplayResolution(unified_id, gfx::Size(800, 400)));
1157 EXPECT_EQ("800x400", 1159 EXPECT_EQ("800x400",
1158 Shell::GetScreen()->GetPrimaryDisplay().size().ToString()); 1160 gfx::Screen::GetScreen()->GetPrimaryDisplay().size().ToString());
1159 1161
1160 active_mode = display_manager->GetActiveModeForDisplayId(unified_id); 1162 active_mode = display_manager->GetActiveModeForDisplayId(unified_id);
1161 EXPECT_EQ(1.0f, active_mode.ui_scale); 1163 EXPECT_EQ(1.0f, active_mode.ui_scale);
1162 EXPECT_EQ("800x400", active_mode.size.ToString()); 1164 EXPECT_EQ("800x400", active_mode.size.ToString());
1163 1165
1164 // resolution change will not persist in unified desktop mode. 1166 // resolution change will not persist in unified desktop mode.
1165 UpdateDisplay("600x600, 200x200"); 1167 UpdateDisplay("600x600, 200x200");
1166 EXPECT_EQ("1200x600", 1168 EXPECT_EQ("1200x600",
1167 Shell::GetScreen()->GetPrimaryDisplay().size().ToString()); 1169 gfx::Screen::GetScreen()->GetPrimaryDisplay().size().ToString());
1168 active_mode = display_manager->GetActiveModeForDisplayId(unified_id); 1170 active_mode = display_manager->GetActiveModeForDisplayId(unified_id);
1169 EXPECT_EQ(1.0f, active_mode.ui_scale); 1171 EXPECT_EQ(1.0f, active_mode.ui_scale);
1170 EXPECT_TRUE(active_mode.native); 1172 EXPECT_TRUE(active_mode.native);
1171 EXPECT_EQ("1200x600", active_mode.size.ToString()); 1173 EXPECT_EQ("1200x600", active_mode.size.ToString());
1172 } 1174 }
1173 1175
1174 #if defined(OS_WIN) 1176 #if defined(OS_WIN)
1175 // TODO(scottmg): RootWindow doesn't get resized on Windows 1177 // TODO(scottmg): RootWindow doesn't get resized on Windows
1176 // Ash. http://crbug.com/247916. 1178 // Ash. http://crbug.com/247916.
1177 #define MAYBE_UpdateMouseCursorAfterRotateZoom DISABLED_UpdateMouseCursorAfterRo tateZoom 1179 #define MAYBE_UpdateMouseCursorAfterRotateZoom DISABLED_UpdateMouseCursorAfterRo tateZoom
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 TEST_F(DisplayManagerTest, SoftwareMirroring) { 1265 TEST_F(DisplayManagerTest, SoftwareMirroring) {
1264 if (!SupportsMultipleDisplays()) 1266 if (!SupportsMultipleDisplays())
1265 return; 1267 return;
1266 1268
1267 UpdateDisplay("300x400,400x500"); 1269 UpdateDisplay("300x400,400x500");
1268 1270
1269 test::MirrorWindowTestApi test_api; 1271 test::MirrorWindowTestApi test_api;
1270 EXPECT_EQ(NULL, test_api.GetHost()); 1272 EXPECT_EQ(NULL, test_api.GetHost());
1271 1273
1272 TestDisplayObserver display_observer; 1274 TestDisplayObserver display_observer;
1273 Shell::GetScreen()->AddObserver(&display_observer); 1275 gfx::Screen::GetScreen()->AddObserver(&display_observer);
1274 1276
1275 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 1277 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
1276 display_manager->SetMultiDisplayMode(DisplayManager::MIRRORING); 1278 display_manager->SetMultiDisplayMode(DisplayManager::MIRRORING);
1277 display_manager->UpdateDisplays(); 1279 display_manager->UpdateDisplays();
1278 RunAllPendingInMessageLoop(); 1280 RunAllPendingInMessageLoop();
1279 EXPECT_TRUE(display_observer.changed_and_reset()); 1281 EXPECT_TRUE(display_observer.changed_and_reset());
1280 EXPECT_EQ(1U, display_manager->GetNumDisplays()); 1282 EXPECT_EQ(1U, display_manager->GetNumDisplays());
1281 EXPECT_EQ("0,0 300x400", 1283 EXPECT_EQ("0,0 300x400",
1282 Shell::GetScreen()->GetPrimaryDisplay().bounds().ToString()); 1284 gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString());
1283 EXPECT_EQ("400x500", test_api.GetHost()->GetBounds().size().ToString()); 1285 EXPECT_EQ("400x500", test_api.GetHost()->GetBounds().size().ToString());
1284 EXPECT_EQ("300x400", 1286 EXPECT_EQ("300x400",
1285 test_api.GetHost()->window()->bounds().size().ToString()); 1287 test_api.GetHost()->window()->bounds().size().ToString());
1286 EXPECT_TRUE(display_manager->IsInMirrorMode()); 1288 EXPECT_TRUE(display_manager->IsInMirrorMode());
1287 1289
1288 display_manager->SetMirrorMode(false); 1290 display_manager->SetMirrorMode(false);
1289 EXPECT_TRUE(display_observer.changed_and_reset()); 1291 EXPECT_TRUE(display_observer.changed_and_reset());
1290 EXPECT_EQ(NULL, test_api.GetHost()); 1292 EXPECT_EQ(NULL, test_api.GetHost());
1291 EXPECT_EQ(2U, display_manager->GetNumDisplays()); 1293 EXPECT_EQ(2U, display_manager->GetNumDisplays());
1292 EXPECT_FALSE(display_manager->IsInMirrorMode()); 1294 EXPECT_FALSE(display_manager->IsInMirrorMode());
(...skipping 22 matching lines...) Expand all
1315 EXPECT_FALSE(display_observer.changed_and_reset()); 1317 EXPECT_FALSE(display_observer.changed_and_reset());
1316 EXPECT_EQ("330x440", 1318 EXPECT_EQ("330x440",
1317 test_api.GetHost()->window()->bounds().size().ToString()); 1319 test_api.GetHost()->window()->bounds().size().ToString());
1318 1320
1319 // Overscan insets are ignored. 1321 // Overscan insets are ignored.
1320 UpdateDisplay("400x600/o,600x800/o"); 1322 UpdateDisplay("400x600/o,600x800/o");
1321 EXPECT_FALSE(display_observer.changed_and_reset()); 1323 EXPECT_FALSE(display_observer.changed_and_reset());
1322 EXPECT_EQ("400x600", 1324 EXPECT_EQ("400x600",
1323 test_api.GetHost()->window()->bounds().size().ToString()); 1325 test_api.GetHost()->window()->bounds().size().ToString());
1324 1326
1325 Shell::GetScreen()->RemoveObserver(&display_observer); 1327 gfx::Screen::GetScreen()->RemoveObserver(&display_observer);
1326 } 1328 }
1327 1329
1328 TEST_F(DisplayManagerTest, SingleDisplayToSoftwareMirroring) { 1330 TEST_F(DisplayManagerTest, SingleDisplayToSoftwareMirroring) {
1329 if (!SupportsMultipleDisplays()) 1331 if (!SupportsMultipleDisplays())
1330 return; 1332 return;
1331 UpdateDisplay("600x400"); 1333 UpdateDisplay("600x400");
1332 1334
1333 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 1335 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
1334 display_manager->SetMultiDisplayMode(DisplayManager::MIRRORING); 1336 display_manager->SetMultiDisplayMode(DisplayManager::MIRRORING);
1335 UpdateDisplay("600x400,600x400"); 1337 UpdateDisplay("600x400,600x400");
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 } 1390 }
1389 #endif // OS_CHROMEOS 1391 #endif // OS_CHROMEOS
1390 1392
1391 TEST_F(DisplayManagerTest, MirroredLayout) { 1393 TEST_F(DisplayManagerTest, MirroredLayout) {
1392 if (!SupportsMultipleDisplays()) 1394 if (!SupportsMultipleDisplays())
1393 return; 1395 return;
1394 1396
1395 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 1397 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
1396 UpdateDisplay("500x500,400x400"); 1398 UpdateDisplay("500x500,400x400");
1397 EXPECT_FALSE(display_manager->GetCurrentDisplayLayout().mirrored); 1399 EXPECT_FALSE(display_manager->GetCurrentDisplayLayout().mirrored);
1398 EXPECT_EQ(2, Shell::GetScreen()->GetNumDisplays()); 1400 EXPECT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays());
1399 EXPECT_EQ(2U, display_manager->num_connected_displays()); 1401 EXPECT_EQ(2U, display_manager->num_connected_displays());
1400 1402
1401 UpdateDisplay("1+0-500x500,1+0-500x500"); 1403 UpdateDisplay("1+0-500x500,1+0-500x500");
1402 EXPECT_TRUE(display_manager->GetCurrentDisplayLayout().mirrored); 1404 EXPECT_TRUE(display_manager->GetCurrentDisplayLayout().mirrored);
1403 EXPECT_EQ(1, Shell::GetScreen()->GetNumDisplays()); 1405 EXPECT_EQ(1, gfx::Screen::GetScreen()->GetNumDisplays());
1404 EXPECT_EQ(2U, display_manager->num_connected_displays()); 1406 EXPECT_EQ(2U, display_manager->num_connected_displays());
1405 1407
1406 UpdateDisplay("500x500,500x500"); 1408 UpdateDisplay("500x500,500x500");
1407 EXPECT_FALSE(display_manager->GetCurrentDisplayLayout().mirrored); 1409 EXPECT_FALSE(display_manager->GetCurrentDisplayLayout().mirrored);
1408 EXPECT_EQ(2, Shell::GetScreen()->GetNumDisplays()); 1410 EXPECT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays());
1409 EXPECT_EQ(2U, display_manager->num_connected_displays()); 1411 EXPECT_EQ(2U, display_manager->num_connected_displays());
1410 } 1412 }
1411 1413
1412 TEST_F(DisplayManagerTest, InvertLayout) { 1414 TEST_F(DisplayManagerTest, InvertLayout) {
1413 EXPECT_EQ("left, 0", 1415 EXPECT_EQ("left, 0",
1414 DisplayLayout(DisplayLayout::RIGHT, 0).Invert().ToString()); 1416 DisplayLayout(DisplayLayout::RIGHT, 0).Invert().ToString());
1415 EXPECT_EQ("left, -100", 1417 EXPECT_EQ("left, -100",
1416 DisplayLayout(DisplayLayout::RIGHT, 100).Invert().ToString()); 1418 DisplayLayout(DisplayLayout::RIGHT, 100).Invert().ToString());
1417 EXPECT_EQ("left, 50", 1419 EXPECT_EQ("left, 50",
1418 DisplayLayout(DisplayLayout::RIGHT, -50).Invert().ToString()); 1420 DisplayLayout(DisplayLayout::RIGHT, -50).Invert().ToString());
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1484 #if defined(OS_WIN) 1486 #if defined(OS_WIN)
1485 // TODO(scottmg): RootWindow doesn't get resized on Windows 1487 // TODO(scottmg): RootWindow doesn't get resized on Windows
1486 // Ash. http://crbug.com/247916. 1488 // Ash. http://crbug.com/247916.
1487 #define MAYBE_UpdateDisplayWithHostOrigin DISABLED_UpdateDisplayWithHostOrigin 1489 #define MAYBE_UpdateDisplayWithHostOrigin DISABLED_UpdateDisplayWithHostOrigin
1488 #else 1490 #else
1489 #define MAYBE_UpdateDisplayWithHostOrigin UpdateDisplayWithHostOrigin 1491 #define MAYBE_UpdateDisplayWithHostOrigin UpdateDisplayWithHostOrigin
1490 #endif 1492 #endif
1491 1493
1492 TEST_F(DisplayManagerTest, MAYBE_UpdateDisplayWithHostOrigin) { 1494 TEST_F(DisplayManagerTest, MAYBE_UpdateDisplayWithHostOrigin) {
1493 UpdateDisplay("100x200,300x400"); 1495 UpdateDisplay("100x200,300x400");
1494 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); 1496 ASSERT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays());
1495 aura::Window::Windows root_windows = 1497 aura::Window::Windows root_windows =
1496 Shell::GetInstance()->GetAllRootWindows(); 1498 Shell::GetInstance()->GetAllRootWindows();
1497 ASSERT_EQ(2U, root_windows.size()); 1499 ASSERT_EQ(2U, root_windows.size());
1498 aura::WindowTreeHost* host0 = root_windows[0]->GetHost(); 1500 aura::WindowTreeHost* host0 = root_windows[0]->GetHost();
1499 aura::WindowTreeHost* host1 = root_windows[1]->GetHost(); 1501 aura::WindowTreeHost* host1 = root_windows[1]->GetHost();
1500 1502
1501 EXPECT_EQ("1,1", host0->GetBounds().origin().ToString()); 1503 EXPECT_EQ("1,1", host0->GetBounds().origin().ToString());
1502 EXPECT_EQ("100x200", host0->GetBounds().size().ToString()); 1504 EXPECT_EQ("100x200", host0->GetBounds().size().ToString());
1503 // UpdateDisplay set the origin if it's not set. 1505 // UpdateDisplay set the origin if it's not set.
1504 EXPECT_NE("1,1", host1->GetBounds().origin().ToString()); 1506 EXPECT_NE("1,1", host1->GetBounds().origin().ToString());
1505 EXPECT_EQ("300x400", host1->GetBounds().size().ToString()); 1507 EXPECT_EQ("300x400", host1->GetBounds().size().ToString());
1506 1508
1507 UpdateDisplay("100x200,200+300-300x400"); 1509 UpdateDisplay("100x200,200+300-300x400");
1508 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); 1510 ASSERT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays());
1509 EXPECT_EQ("0,0", host0->GetBounds().origin().ToString()); 1511 EXPECT_EQ("0,0", host0->GetBounds().origin().ToString());
1510 EXPECT_EQ("100x200", host0->GetBounds().size().ToString()); 1512 EXPECT_EQ("100x200", host0->GetBounds().size().ToString());
1511 EXPECT_EQ("200,300", host1->GetBounds().origin().ToString()); 1513 EXPECT_EQ("200,300", host1->GetBounds().origin().ToString());
1512 EXPECT_EQ("300x400", host1->GetBounds().size().ToString()); 1514 EXPECT_EQ("300x400", host1->GetBounds().size().ToString());
1513 1515
1514 UpdateDisplay("400+500-200x300,300x400"); 1516 UpdateDisplay("400+500-200x300,300x400");
1515 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); 1517 ASSERT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays());
1516 EXPECT_EQ("400,500", host0->GetBounds().origin().ToString()); 1518 EXPECT_EQ("400,500", host0->GetBounds().origin().ToString());
1517 EXPECT_EQ("200x300", host0->GetBounds().size().ToString()); 1519 EXPECT_EQ("200x300", host0->GetBounds().size().ToString());
1518 EXPECT_EQ("0,0", host1->GetBounds().origin().ToString()); 1520 EXPECT_EQ("0,0", host1->GetBounds().origin().ToString());
1519 EXPECT_EQ("300x400", host1->GetBounds().size().ToString()); 1521 EXPECT_EQ("300x400", host1->GetBounds().size().ToString());
1520 1522
1521 UpdateDisplay("100+200-100x200,300+500-200x300"); 1523 UpdateDisplay("100+200-100x200,300+500-200x300");
1522 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); 1524 ASSERT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays());
1523 EXPECT_EQ("100,200", host0->GetBounds().origin().ToString()); 1525 EXPECT_EQ("100,200", host0->GetBounds().origin().ToString());
1524 EXPECT_EQ("100x200", host0->GetBounds().size().ToString()); 1526 EXPECT_EQ("100x200", host0->GetBounds().size().ToString());
1525 EXPECT_EQ("300,500", host1->GetBounds().origin().ToString()); 1527 EXPECT_EQ("300,500", host1->GetBounds().origin().ToString());
1526 EXPECT_EQ("200x300", host1->GetBounds().size().ToString()); 1528 EXPECT_EQ("200x300", host1->GetBounds().size().ToString());
1527 } 1529 }
1528 1530
1529 TEST_F(DisplayManagerTest, UnifiedDesktopBasic) { 1531 TEST_F(DisplayManagerTest, UnifiedDesktopBasic) {
1530 if (!SupportsMultipleDisplays()) 1532 if (!SupportsMultipleDisplays())
1531 return; 1533 return;
1532 1534
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
1917 return params.hinting; 1919 return params.hinting;
1918 } 1920 }
1919 1921
1920 } // namespace 1922 } // namespace
1921 1923
1922 typedef testing::Test DisplayManagerFontTest; 1924 typedef testing::Test DisplayManagerFontTest;
1923 1925
1924 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf100Internal) { 1926 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf100Internal) {
1925 FontTestHelper helper(1.0f, FontTestHelper::INTERNAL); 1927 FontTestHelper helper(1.0f, FontTestHelper::INTERNAL);
1926 ASSERT_DOUBLE_EQ( 1928 ASSERT_DOUBLE_EQ(
1927 1.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); 1929 1.0f,
1930 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
1928 EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); 1931 EXPECT_FALSE(IsTextSubpixelPositioningEnabled());
1929 EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); 1932 EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
1930 } 1933 }
1931 1934
1932 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf125Internal) { 1935 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf125Internal) {
1933 test::ScopedDisable125DSFForUIScaling disable; 1936 test::ScopedDisable125DSFForUIScaling disable;
1934 FontTestHelper helper(1.25f, FontTestHelper::INTERNAL); 1937 FontTestHelper helper(1.25f, FontTestHelper::INTERNAL);
1935 ASSERT_DOUBLE_EQ( 1938 ASSERT_DOUBLE_EQ(
1936 1.25f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); 1939 1.25f,
1940 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
1937 EXPECT_TRUE(IsTextSubpixelPositioningEnabled()); 1941 EXPECT_TRUE(IsTextSubpixelPositioningEnabled());
1938 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); 1942 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
1939 } 1943 }
1940 1944
1941 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf200Internal) { 1945 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf200Internal) {
1942 FontTestHelper helper(2.0f, FontTestHelper::INTERNAL); 1946 FontTestHelper helper(2.0f, FontTestHelper::INTERNAL);
1943 ASSERT_DOUBLE_EQ( 1947 ASSERT_DOUBLE_EQ(
1944 2.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); 1948 2.0f,
1949 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
1945 EXPECT_TRUE(IsTextSubpixelPositioningEnabled()); 1950 EXPECT_TRUE(IsTextSubpixelPositioningEnabled());
1946 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); 1951 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
1947 1952
1948 SetDisplayUIScale(Shell::GetScreen()->GetPrimaryDisplay().id(), 2.0f); 1953 SetDisplayUIScale(gfx::Screen::GetScreen()->GetPrimaryDisplay().id(), 2.0f);
1949 1954
1950 ASSERT_DOUBLE_EQ( 1955 ASSERT_DOUBLE_EQ(
1951 1.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); 1956 1.0f,
1957 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
1952 EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); 1958 EXPECT_FALSE(IsTextSubpixelPositioningEnabled());
1953 EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); 1959 EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
1954 } 1960 }
1955 1961
1956 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf100External) { 1962 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf100External) {
1957 FontTestHelper helper(1.0f, FontTestHelper::EXTERNAL); 1963 FontTestHelper helper(1.0f, FontTestHelper::EXTERNAL);
1958 ASSERT_DOUBLE_EQ( 1964 ASSERT_DOUBLE_EQ(
1959 1.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); 1965 1.0f,
1966 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
1960 EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); 1967 EXPECT_FALSE(IsTextSubpixelPositioningEnabled());
1961 EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); 1968 EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
1962 } 1969 }
1963 1970
1964 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf125External) { 1971 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf125External) {
1965 FontTestHelper helper(1.25f, FontTestHelper::EXTERNAL); 1972 FontTestHelper helper(1.25f, FontTestHelper::EXTERNAL);
1966 ASSERT_DOUBLE_EQ( 1973 ASSERT_DOUBLE_EQ(
1967 1.25f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); 1974 1.25f,
1975 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
1968 EXPECT_TRUE(IsTextSubpixelPositioningEnabled()); 1976 EXPECT_TRUE(IsTextSubpixelPositioningEnabled());
1969 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); 1977 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
1970 } 1978 }
1971 1979
1972 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf200External) { 1980 TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf200External) {
1973 FontTestHelper helper(2.0f, FontTestHelper::EXTERNAL); 1981 FontTestHelper helper(2.0f, FontTestHelper::EXTERNAL);
1974 ASSERT_DOUBLE_EQ( 1982 ASSERT_DOUBLE_EQ(
1975 2.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); 1983 2.0f,
1984 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
1976 EXPECT_TRUE(IsTextSubpixelPositioningEnabled()); 1985 EXPECT_TRUE(IsTextSubpixelPositioningEnabled());
1977 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); 1986 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
1978 } 1987 }
1979 1988
1980 TEST_F(DisplayManagerFontTest, 1989 TEST_F(DisplayManagerFontTest,
1981 TextSubpixelPositioningWithDsf125InternalWithScaling) { 1990 TextSubpixelPositioningWithDsf125InternalWithScaling) {
1982 FontTestHelper helper(1.25f, FontTestHelper::INTERNAL); 1991 FontTestHelper helper(1.25f, FontTestHelper::INTERNAL);
1983 ASSERT_DOUBLE_EQ( 1992 ASSERT_DOUBLE_EQ(
1984 1.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); 1993 1.0f,
1994 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
1985 EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); 1995 EXPECT_FALSE(IsTextSubpixelPositioningEnabled());
1986 EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); 1996 EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
1987 1997
1988 SetDisplayUIScale(Shell::GetScreen()->GetPrimaryDisplay().id(), 0.8f); 1998 SetDisplayUIScale(gfx::Screen::GetScreen()->GetPrimaryDisplay().id(), 0.8f);
1989 1999
1990 ASSERT_DOUBLE_EQ( 2000 ASSERT_DOUBLE_EQ(
1991 1.25f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); 2001 1.25f,
2002 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
1992 EXPECT_TRUE(IsTextSubpixelPositioningEnabled()); 2003 EXPECT_TRUE(IsTextSubpixelPositioningEnabled());
1993 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); 2004 EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams());
1994 } 2005 }
1995 2006
1996 TEST_F(DisplayManagerTest, CheckInitializationOfRotationProperty) { 2007 TEST_F(DisplayManagerTest, CheckInitializationOfRotationProperty) {
1997 int64_t id = display_manager()->GetDisplayAt(0).id(); 2008 int64_t id = display_manager()->GetDisplayAt(0).id();
1998 display_manager()->RegisterDisplayProperty(id, gfx::Display::ROTATE_90, 1.0f, 2009 display_manager()->RegisterDisplayProperty(id, gfx::Display::ROTATE_90, 1.0f,
1999 nullptr, gfx::Size(), 1.0f, 2010 nullptr, gfx::Size(), 1.0f,
2000 ui::COLOR_PROFILE_STANDARD); 2011 ui::COLOR_PROFILE_STANDARD);
2001 2012
(...skipping 21 matching lines...) Expand all
2023 layout_store->RegisterLayoutForDisplayIdPair(id2, id1, bad); 2034 layout_store->RegisterLayoutForDisplayIdPair(id2, id1, bad);
2024 2035
2025 EXPECT_EQ(good.ToString(), layout_store->GetRegisteredDisplayLayout( 2036 EXPECT_EQ(good.ToString(), layout_store->GetRegisteredDisplayLayout(
2026 CreateDisplayIdPair(id1, id2)) 2037 CreateDisplayIdPair(id1, id2))
2027 .ToString()); 2038 .ToString());
2028 } 2039 }
2029 2040
2030 #endif // OS_CHROMEOS 2041 #endif // OS_CHROMEOS
2031 2042
2032 } // namespace ash 2043 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/cursor_window_controller_unittest.cc ('k') | ash/display/event_transformation_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698