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

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

Issue 1361763003: Ignore UI scaling when internal display isn't active (in docked mode, for example) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « ash/display/display_manager.cc ('k') | ash/display/display_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/display/display_manager.h" 5 #include "ash/display/display_manager.h"
6 6
7 #include "ash/accelerators/accelerator_commands.h" 7 #include "ash/accelerators/accelerator_commands.h"
8 #include "ash/ash_switches.h" 8 #include "ash/ash_switches.h"
9 #include "ash/display/display_info.h" 9 #include "ash/display/display_info.h"
10 #include "ash/display/display_layout_store.h" 10 #include "ash/display/display_layout_store.h"
(...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after
1785 docked->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_DOCKED); 1785 docked->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_DOCKED);
1786 ASSERT_TRUE(wm::GetWindowState(docked.get())->IsDocked()); 1786 ASSERT_TRUE(wm::GetWindowState(docked.get())->IsDocked());
1787 // 47 pixels reserved for launcher shelf height. 1787 // 47 pixels reserved for launcher shelf height.
1788 EXPECT_EQ("0,0 250x453", docked->bounds().ToString()); 1788 EXPECT_EQ("0,0 250x453", docked->bounds().ToString());
1789 UpdateDisplay("300x300"); 1789 UpdateDisplay("300x300");
1790 // Make sure the window is still docked. 1790 // Make sure the window is still docked.
1791 EXPECT_TRUE(wm::GetWindowState(docked.get())->IsDocked()); 1791 EXPECT_TRUE(wm::GetWindowState(docked.get())->IsDocked());
1792 EXPECT_EQ("0,0 250x253", docked->bounds().ToString()); 1792 EXPECT_EQ("0,0 250x253", docked->bounds().ToString());
1793 } 1793 }
1794 1794
1795 TEST_F(DisplayManagerTest, DockMode) {
1796 if (!SupportsMultipleDisplays())
1797 return;
1798 const int64 internal_id = 1;
1799 const int64 external_id = 2;
1800
1801 const DisplayInfo internal_display_info =
1802 CreateDisplayInfo(internal_id, gfx::Rect(0, 0, 500, 500));
1803 const DisplayInfo external_display_info =
1804 CreateDisplayInfo(external_id, gfx::Rect(1, 1, 100, 100));
1805 std::vector<DisplayInfo> display_info_list;
1806
1807 // software mirroring.
1808 display_info_list.push_back(internal_display_info);
1809 display_info_list.push_back(external_display_info);
1810 display_manager()->OnNativeDisplaysChanged(display_info_list);
1811 const int64 internal_display_id =
1812 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay();
1813 EXPECT_EQ(internal_id, internal_display_id);
1814
1815 display_info_list.clear();
1816 display_info_list.push_back(external_display_info);
1817 display_manager()->OnNativeDisplaysChanged(display_info_list);
1818 EXPECT_EQ(1U, display_manager()->active_display_list().size());
1819
1820 EXPECT_TRUE(display_manager()->IsActiveDisplayId(external_id));
1821 EXPECT_FALSE(display_manager()->IsActiveDisplayId(internal_id));
1822
1823 const DisplayInfo& info = display_manager()->GetDisplayInfo(internal_id);
1824 DisplayMode mode;
1825
1826 EXPECT_FALSE(GetDisplayModeForNextUIScale(info, true, &mode));
1827 EXPECT_FALSE(GetDisplayModeForNextUIScale(info, false, &mode));
1828 EXPECT_FALSE(SetDisplayUIScale(internal_id, 1.0f));
1829
1830 DisplayInfo invalid_info;
1831 EXPECT_FALSE(GetDisplayModeForNextUIScale(invalid_info, true, &mode));
1832 EXPECT_FALSE(GetDisplayModeForNextUIScale(invalid_info, false, &mode));
1833 EXPECT_FALSE(SetDisplayUIScale(gfx::Display::kInvalidDisplayID, 1.0f));
1834 }
1835
1795 class ScreenShutdownTest : public test::AshTestBase { 1836 class ScreenShutdownTest : public test::AshTestBase {
1796 public: 1837 public:
1797 ScreenShutdownTest() { 1838 ScreenShutdownTest() {
1798 } 1839 }
1799 ~ScreenShutdownTest() override {} 1840 ~ScreenShutdownTest() override {}
1800 1841
1801 void TearDown() override { 1842 void TearDown() override {
1802 gfx::Screen* orig_screen = 1843 gfx::Screen* orig_screen =
1803 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE); 1844 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE);
1804 AshTestBase::TearDown(); 1845 AshTestBase::TearDown();
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1956 1997
1957 EXPECT_EQ(gfx::Display::ROTATE_90, 1998 EXPECT_EQ(gfx::Display::ROTATE_90,
1958 info.GetRotation(gfx::Display::ROTATION_SOURCE_USER)); 1999 info.GetRotation(gfx::Display::ROTATION_SOURCE_USER));
1959 EXPECT_EQ(gfx::Display::ROTATE_90, 2000 EXPECT_EQ(gfx::Display::ROTATE_90,
1960 info.GetRotation(gfx::Display::ROTATION_SOURCE_ACTIVE)); 2001 info.GetRotation(gfx::Display::ROTATION_SOURCE_ACTIVE));
1961 } 2002 }
1962 2003
1963 #endif // OS_CHROMEOS 2004 #endif // OS_CHROMEOS
1964 2005
1965 } // namespace ash 2006 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_manager.cc ('k') | ash/display/display_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698