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

Unified Diff: chrome/browser/extensions/display_info_provider_chromeos_unittest.cc

Issue 2355063002: Separate ash::test::DisplayManagerTestApi from ash (Closed)
Patch Set: review comments Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/display_info_provider_chromeos_unittest.cc
diff --git a/chrome/browser/extensions/display_info_provider_chromeos_unittest.cc b/chrome/browser/extensions/display_info_provider_chromeos_unittest.cc
index 51fa22380970e02a4ed9047edc81cf20ac362c66..d3c3934fc2e3c896ddd4b3c457f1f10a8ff947f6 100644
--- a/chrome/browser/extensions/display_info_provider_chromeos_unittest.cc
+++ b/chrome/browser/extensions/display_info_provider_chromeos_unittest.cc
@@ -10,7 +10,6 @@
#include "ash/common/wm_shell.h"
#include "ash/display/display_manager.h"
#include "ash/display/screen_orientation_controller_chromeos.h"
-#include "ash/screen_util.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "ash/test/display_manager_test_api.h"
@@ -300,7 +299,7 @@ TEST_F(DisplayInfoProviderChromeosTest, GetDPI) {
EXPECT_EQ(96 / 2, result[1].dpi_x);
EXPECT_EQ(96 / 2, result[1].dpi_y);
- ash::test::SwapPrimaryDisplay();
+ SwapPrimaryDisplay();
result = DisplayInfoProvider::Get()->GetAllDisplaysInfo();
@@ -409,7 +408,8 @@ TEST_F(DisplayInfoProviderChromeosTest, GetMirroring) {
TEST_F(DisplayInfoProviderChromeosTest, GetBounds) {
UpdateDisplay("600x600, 400x520");
GetDisplayManager()->SetLayoutForCurrentDisplays(
- ash::test::CreateDisplayLayout(display::DisplayPlacement::LEFT, -40));
+ ash::test::CreateDisplayLayout(display_manager(),
+ display::DisplayPlacement::LEFT, -40));
DisplayUnitInfoList result = DisplayInfoProvider::Get()->GetAllDisplaysInfo();
@@ -419,7 +419,8 @@ TEST_F(DisplayInfoProviderChromeosTest, GetBounds) {
SystemInfoDisplayBoundsToString(result[1].bounds));
GetDisplayManager()->SetLayoutForCurrentDisplays(
- ash::test::CreateDisplayLayout(display::DisplayPlacement::TOP, 40));
+ ash::test::CreateDisplayLayout(display_manager(),
+ display::DisplayPlacement::TOP, 40));
result = DisplayInfoProvider::Get()->GetAllDisplaysInfo();
@@ -429,7 +430,8 @@ TEST_F(DisplayInfoProviderChromeosTest, GetBounds) {
SystemInfoDisplayBoundsToString(result[1].bounds));
GetDisplayManager()->SetLayoutForCurrentDisplays(
- ash::test::CreateDisplayLayout(display::DisplayPlacement::BOTTOM, 80));
+ ash::test::CreateDisplayLayout(display_manager(),
+ display::DisplayPlacement::BOTTOM, 80));
result = DisplayInfoProvider::Get()->GetAllDisplaysInfo();
ASSERT_EQ(2u, result.size());
@@ -495,7 +497,7 @@ TEST_F(DisplayInfoProviderChromeosTest, Layout) {
TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginLeftExact) {
UpdateDisplay("1200x600,520x400");
- const display::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
+ const display::Display& secondary = display_manager()->GetSecondaryDisplay();
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(-520));
info.bounds_origin_y.reset(new int(50));
@@ -514,7 +516,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginLeftExact) {
TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginRightExact) {
UpdateDisplay("1200x600,520x400");
- const display::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
+ const display::Display& secondary = display_manager()->GetSecondaryDisplay();
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(1200));
info.bounds_origin_y.reset(new int(100));
@@ -533,7 +535,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginRightExact) {
TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginTopExact) {
UpdateDisplay("1200x600,520x400");
- const display::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
+ const display::Display& secondary = display_manager()->GetSecondaryDisplay();
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(1100));
info.bounds_origin_y.reset(new int(-400));
@@ -552,7 +554,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginTopExact) {
TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginBottomExact) {
UpdateDisplay("1200x600,520x400");
- const display::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
+ const display::Display& secondary = display_manager()->GetSecondaryDisplay();
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(-350));
info.bounds_origin_y.reset(new int(600));
@@ -571,7 +573,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginBottomExact) {
TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginSameCenter) {
UpdateDisplay("1200x600,520x400");
- const display::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
+ const display::Display& secondary = display_manager()->GetSecondaryDisplay();
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(340));
info.bounds_origin_y.reset(new int(100));
@@ -590,7 +592,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginSameCenter) {
TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginLeftOutside) {
UpdateDisplay("1200x600,520x400");
- const display::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
+ const display::Display& secondary = display_manager()->GetSecondaryDisplay();
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(-1040));
info.bounds_origin_y.reset(new int(100));
@@ -609,7 +611,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginLeftOutside) {
TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginTopOutside) {
UpdateDisplay("1200x600,520x400");
- const display::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
+ const display::Display& secondary = display_manager()->GetSecondaryDisplay();
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(-360));
info.bounds_origin_y.reset(new int(-301));
@@ -629,7 +631,7 @@ TEST_F(DisplayInfoProviderChromeosTest,
SetBoundsOriginLeftButSharesBottomSide) {
UpdateDisplay("1200x600,1000x100");
- const display::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
+ const display::Display& secondary = display_manager()->GetSecondaryDisplay();
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(-650));
info.bounds_origin_y.reset(new int(700));
@@ -648,7 +650,7 @@ TEST_F(DisplayInfoProviderChromeosTest,
TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginRightButSharesTopSide) {
UpdateDisplay("1200x600,1000x100");
- const display::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
+ const display::Display& secondary = display_manager()->GetSecondaryDisplay();
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(850));
info.bounds_origin_y.reset(new int(-150));
@@ -667,7 +669,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginRightButSharesTopSide) {
TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginTopButSharesLeftSide) {
UpdateDisplay("1200x600,1000x100/l");
- const display::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
+ const display::Display& secondary = display_manager()->GetSecondaryDisplay();
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(-150));
info.bounds_origin_y.reset(new int(-650));
@@ -687,7 +689,7 @@ TEST_F(DisplayInfoProviderChromeosTest,
SetBoundsOriginBottomButSharesRightSide) {
UpdateDisplay("1200x600,1000x100/l");
- const display::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
+ const display::Display& secondary = display_manager()->GetSecondaryDisplay();
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(1350));
info.bounds_origin_y.reset(new int(450));
@@ -706,7 +708,7 @@ TEST_F(DisplayInfoProviderChromeosTest,
TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginPrimaryHiDPI) {
UpdateDisplay("1200x600*2,500x500");
- const display::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
+ const display::Display& secondary = display_manager()->GetSecondaryDisplay();
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(250));
info.bounds_origin_y.reset(new int(-100));
@@ -725,7 +727,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginPrimaryHiDPI) {
TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginSecondaryHiDPI) {
UpdateDisplay("1200x600,600x1000*2");
- const display::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
+ const display::Display& secondary = display_manager()->GetSecondaryDisplay();
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(450));
info.bounds_origin_y.reset(new int(-100));
@@ -744,7 +746,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginSecondaryHiDPI) {
TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginOutOfBounds) {
UpdateDisplay("1200x600,600x1000*2");
- const display::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
+ const display::Display& secondary = display_manager()->GetSecondaryDisplay();
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(0x200001));
info.bounds_origin_y.reset(new int(-100));
@@ -763,7 +765,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginOutOfBounds) {
TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginOutOfBoundsNegative) {
UpdateDisplay("1200x600,600x1000*2");
- const display::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
+ const display::Display& secondary = display_manager()->GetSecondaryDisplay();
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(300));
info.bounds_origin_y.reset(new int(-0x200001));
@@ -782,7 +784,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginOutOfBoundsNegative) {
TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginMaxValues) {
UpdateDisplay("1200x4600,600x1000*2");
- const display::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
+ const display::Display& secondary = display_manager()->GetSecondaryDisplay();
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(200000));
info.bounds_origin_y.reset(new int(10));
@@ -801,7 +803,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginMaxValues) {
TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginOnPrimary) {
UpdateDisplay("1200x600,600x1000*2");
- const display::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
+ const display::Display& secondary = display_manager()->GetSecondaryDisplay();
api::system_display::DisplayProperties info;
info.bounds_origin_x.reset(new int(300));
info.is_primary.reset(new bool(true));
@@ -824,7 +826,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginOnPrimary) {
TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginWithMirroring) {
UpdateDisplay("1200x600,600x1000*2");
- const display::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
+ const display::Display& secondary = display_manager()->GetSecondaryDisplay();
const display::Display& primary =
display::Screen::GetScreen()->GetPrimaryDisplay();
@@ -846,7 +848,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginWithMirroring) {
TEST_F(DisplayInfoProviderChromeosTest, SetRotation) {
UpdateDisplay("1200x600,600x1000*2");
- const display::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
+ const display::Display& secondary = display_manager()->GetSecondaryDisplay();
api::system_display::DisplayProperties info;
info.rotation.reset(new int(90));
@@ -967,7 +969,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetRotationDuringMaximizeMode) {
TEST_F(DisplayInfoProviderChromeosTest, SetInvalidRotation) {
UpdateDisplay("1200x600,600x1000*2");
- const display::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
+ const display::Display& secondary = display_manager()->GetSecondaryDisplay();
api::system_display::DisplayProperties info;
info.rotation.reset(new int(91));
@@ -983,7 +985,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetInvalidRotation) {
TEST_F(DisplayInfoProviderChromeosTest, SetNegativeOverscan) {
UpdateDisplay("1200x600,600x1000*2");
- const display::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
+ const display::Display& secondary = display_manager()->GetSecondaryDisplay();
api::system_display::DisplayProperties info;
info.overscan.reset(new api::system_display::Insets);
info.overscan->left = -10;
@@ -1046,7 +1048,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetNegativeOverscan) {
TEST_F(DisplayInfoProviderChromeosTest, SetOverscanLargerThanHorizontalBounds) {
UpdateDisplay("1200x600,600x1000*2");
- const display::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
+ const display::Display& secondary = display_manager()->GetSecondaryDisplay();
api::system_display::DisplayProperties info;
info.overscan.reset(new api::system_display::Insets);
// Horizontal overscan is 151, which would make the bounds width 149.
@@ -1068,7 +1070,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetOverscanLargerThanHorizontalBounds) {
TEST_F(DisplayInfoProviderChromeosTest, SetOverscanLargerThanVerticalBounds) {
UpdateDisplay("1200x600,600x1000");
- const display::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
+ const display::Display& secondary = display_manager()->GetSecondaryDisplay();
api::system_display::DisplayProperties info;
info.overscan.reset(new api::system_display::Insets);
// Vertical overscan is 501, which would make the bounds height 499.
@@ -1089,7 +1091,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetOverscanLargerThanVerticalBounds) {
TEST_F(DisplayInfoProviderChromeosTest, SetOverscan) {
UpdateDisplay("1200x600,600x1000*2");
- const display::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay();
+ const display::Display& secondary = display_manager()->GetSecondaryDisplay();
api::system_display::DisplayProperties info;
info.overscan.reset(new api::system_display::Insets);
info.overscan->left = 20;
@@ -1118,7 +1120,9 @@ TEST_F(DisplayInfoProviderChromeosTest, SetOverscan) {
TEST_F(DisplayInfoProviderChromeosTest, SetOverscanForInternal) {
UpdateDisplay("1200x600,600x1000*2");
const int64_t internal_display_id =
- ash::test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay();
+ ash::test::DisplayManagerTestApi(
+ ash::Shell::GetInstance()->display_manager())
+ .SetFirstDisplayAsInternalDisplay();
api::system_display::DisplayProperties info;
info.overscan.reset(new api::system_display::Insets);

Powered by Google App Engine
This is Rietveld 408576698