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

Unified Diff: ash/display/display_manager_unittest.cc

Issue 1261693004: Allow dynamic enabling/disabling of unified desktop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « ash/display/display_manager.cc ('k') | ash/display/display_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_manager_unittest.cc
diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc
index e3c05e48fe06a31f98464122f912bf91888023d9..822452edf1c95f90968c12a5af11ac762866e149 100644
--- a/ash/display/display_manager_unittest.cc
+++ b/ash/display/display_manager_unittest.cc
@@ -658,7 +658,7 @@ TEST_F(DisplayManagerTest, DisplayAddRemoveAtTheSameTime) {
DisplayInfo secondary_info = display_manager()->GetDisplayInfo(secondary_id);
// An id which is different from primary and secondary.
- const int64 third_id = primary_id + secondary_id;
+ const int64 third_id = secondary_id + 1;
DisplayInfo third_info =
CreateDisplayInfo(third_id, gfx::Rect(0, 0, 600, 600));
@@ -1120,13 +1120,11 @@ TEST_F(DisplayManagerTest, Use125DSFForUIScaling) {
TEST_F(DisplayManagerTest, ResolutionChangeInUnifiedMode) {
if (!SupportsMultipleDisplays())
return;
-
- test::DisplayManagerTestApi::EnableUnifiedDesktopForTest();
-
// Don't check root window destruction in unified mode.
Shell::GetPrimaryRootWindow()->RemoveObserver(this);
DisplayManager* display_manager = Shell::GetInstance()->display_manager();
+ display_manager->SetUnifiedDesktopEnabled(true);
UpdateDisplay("200x200, 400x400");
@@ -1520,13 +1518,15 @@ TEST_F(DisplayManagerTest, MAYBE_UpdateDisplayWithHostOrigin) {
TEST_F(DisplayManagerTest, UnifiedDesktopBasic) {
if (!SupportsMultipleDisplays())
return;
- test::DisplayManagerTestApi::EnableUnifiedDesktopForTest();
// Don't check root window destruction in unified mode.
Shell::GetPrimaryRootWindow()->RemoveObserver(this);
UpdateDisplay("400x500,300x200");
+ // Enable after extended mode.
+ display_manager()->SetUnifiedDesktopEnabled(true);
+
// Defaults to the unified desktop.
gfx::Screen* screen =
gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE);
@@ -1562,19 +1562,35 @@ TEST_F(DisplayManagerTest, UnifiedDesktopBasic) {
}
// Switch back to extended desktop.
- display_manager()->SetDefaultMultiDisplayMode(DisplayManager::EXTENDED);
- display_manager()->ReconfigureDisplays();
+ display_manager()->SetUnifiedDesktopEnabled(false);
EXPECT_EQ("500x300", screen->GetPrimaryDisplay().size().ToString());
EXPECT_EQ("400x500", ScreenUtil::GetSecondaryDisplay().size().ToString());
}
+TEST_F(DisplayManagerTest, UnifiedDesktopEnabledWithExtended) {
+ if (!SupportsMultipleDisplays())
+ return;
+ // Don't check root window destruction in unified mode.
+ Shell::GetPrimaryRootWindow()->RemoveObserver(this);
+
+ UpdateDisplay("400x500,300x200");
+ DisplayIdPair pair = display_manager()->GetCurrentDisplayIdPair();
+ DisplayLayout layout =
+ display_manager()->layout_store()->GetRegisteredDisplayLayout(pair);
+ layout.default_unified = false;
+ display_manager()->layout_store()->RegisterLayoutForDisplayIdPair(
+ pair.first, pair.second, layout);
+ display_manager()->SetUnifiedDesktopEnabled(true);
+ EXPECT_FALSE(display_manager()->IsInUnifiedMode());
+}
+
TEST_F(DisplayManagerTest, UnifiedDesktopWith2xDSF) {
if (!SupportsMultipleDisplays())
return;
// Don't check root window destruction in unified mode.
Shell::GetPrimaryRootWindow()->RemoveObserver(this);
- test::DisplayManagerTestApi::EnableUnifiedDesktopForTest();
+ display_manager()->SetUnifiedDesktopEnabled(true);
gfx::Screen* screen =
gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE);
@@ -1690,7 +1706,7 @@ TEST_F(DisplayManagerTest, ConfigureUnifiedTwice) {
TEST_F(DisplayManagerTest, NoRotateUnifiedDesktop) {
if (!SupportsMultipleDisplays())
return;
- test::DisplayManagerTestApi::EnableUnifiedDesktopForTest();
+ display_manager()->SetUnifiedDesktopEnabled(true);
// Don't check root window destruction in unified mode.
Shell::GetPrimaryRootWindow()->RemoveObserver(this);
@@ -1717,7 +1733,7 @@ TEST_F(DisplayManagerTest, NoRotateUnifiedDesktop) {
TEST_F(DisplayManagerTest, UnifiedWithDockWindows) {
if (!SupportsMultipleDisplays())
return;
- test::DisplayManagerTestApi::EnableUnifiedDesktopForTest();
+ display_manager()->SetUnifiedDesktopEnabled(true);
// Don't check root window destruction in unified mode.
Shell::GetPrimaryRootWindow()->RemoveObserver(this);
« 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