| OLD | NEW |
| 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_builder.h" | 10 #include "ash/display/display_layout_builder.h" |
| (...skipping 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1992 EXPECT_FALSE(GetDisplayModeForNextUIScale(info, true, &mode)); | 1992 EXPECT_FALSE(GetDisplayModeForNextUIScale(info, true, &mode)); |
| 1993 EXPECT_FALSE(GetDisplayModeForNextUIScale(info, false, &mode)); | 1993 EXPECT_FALSE(GetDisplayModeForNextUIScale(info, false, &mode)); |
| 1994 EXPECT_FALSE(SetDisplayUIScale(internal_id, 1.0f)); | 1994 EXPECT_FALSE(SetDisplayUIScale(internal_id, 1.0f)); |
| 1995 | 1995 |
| 1996 DisplayInfo invalid_info; | 1996 DisplayInfo invalid_info; |
| 1997 EXPECT_FALSE(GetDisplayModeForNextUIScale(invalid_info, true, &mode)); | 1997 EXPECT_FALSE(GetDisplayModeForNextUIScale(invalid_info, true, &mode)); |
| 1998 EXPECT_FALSE(GetDisplayModeForNextUIScale(invalid_info, false, &mode)); | 1998 EXPECT_FALSE(GetDisplayModeForNextUIScale(invalid_info, false, &mode)); |
| 1999 EXPECT_FALSE(SetDisplayUIScale(gfx::Display::kInvalidDisplayID, 1.0f)); | 1999 EXPECT_FALSE(SetDisplayUIScale(gfx::Display::kInvalidDisplayID, 1.0f)); |
| 2000 } | 2000 } |
| 2001 | 2001 |
| 2002 // Make sure that bad layout information is ignored and does not crash. |
| 2003 TEST_F(DisplayManagerTest, DontRegisterBadConfig) { |
| 2004 if (!SupportsMultipleDisplays()) |
| 2005 return; |
| 2006 DisplayIdList list = ash::test::CreateDisplayIdList2(1, 2); |
| 2007 DisplayLayoutBuilder builder(1); |
| 2008 builder.AddDisplayPlacement(2, 1, ash::DisplayPlacement::LEFT, 0); |
| 2009 builder.AddDisplayPlacement(3, 1, ash::DisplayPlacement::BOTTOM, 0); |
| 2010 |
| 2011 display_manager()->layout_store()->RegisterLayoutForDisplayIdList( |
| 2012 list, builder.Build()); |
| 2013 } |
| 2014 |
| 2002 class ScreenShutdownTest : public test::AshTestBase { | 2015 class ScreenShutdownTest : public test::AshTestBase { |
| 2003 public: | 2016 public: |
| 2004 ScreenShutdownTest() { | 2017 ScreenShutdownTest() { |
| 2005 } | 2018 } |
| 2006 ~ScreenShutdownTest() override {} | 2019 ~ScreenShutdownTest() override {} |
| 2007 | 2020 |
| 2008 void TearDown() override { | 2021 void TearDown() override { |
| 2009 gfx::Screen* orig_screen = gfx::Screen::GetScreen(); | 2022 gfx::Screen* orig_screen = gfx::Screen::GetScreen(); |
| 2010 AshTestBase::TearDown(); | 2023 AshTestBase::TearDown(); |
| 2011 if (!SupportsMultipleDisplays()) | 2024 if (!SupportsMultipleDisplays()) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2022 private: | 2035 private: |
| 2023 DISALLOW_COPY_AND_ASSIGN(ScreenShutdownTest); | 2036 DISALLOW_COPY_AND_ASSIGN(ScreenShutdownTest); |
| 2024 }; | 2037 }; |
| 2025 | 2038 |
| 2026 TEST_F(ScreenShutdownTest, ScreenAfterShutdown) { | 2039 TEST_F(ScreenShutdownTest, ScreenAfterShutdown) { |
| 2027 if (!SupportsMultipleDisplays()) | 2040 if (!SupportsMultipleDisplays()) |
| 2028 return; | 2041 return; |
| 2029 UpdateDisplay("500x300,800x400"); | 2042 UpdateDisplay("500x300,800x400"); |
| 2030 } | 2043 } |
| 2031 | 2044 |
| 2032 | |
| 2033 #if defined(OS_CHROMEOS) | 2045 #if defined(OS_CHROMEOS) |
| 2034 namespace { | 2046 namespace { |
| 2035 | 2047 |
| 2036 // A helper class that sets the display configuration and starts ash. | 2048 // A helper class that sets the display configuration and starts ash. |
| 2037 // This is to make sure the font configuration happens during ash | 2049 // This is to make sure the font configuration happens during ash |
| 2038 // initialization process. | 2050 // initialization process. |
| 2039 class FontTestHelper : public test::AshTestBase { | 2051 class FontTestHelper : public test::AshTestBase { |
| 2040 public: | 2052 public: |
| 2041 enum DisplayType { | 2053 enum DisplayType { |
| 2042 INTERNAL, | 2054 INTERNAL, |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2211 layout_store->RegisterLayoutForDisplayIdList(list, std::move(old_layout)); | 2223 layout_store->RegisterLayoutForDisplayIdList(list, std::move(old_layout)); |
| 2212 const DisplayLayout& stored = layout_store->GetRegisteredDisplayLayout(list); | 2224 const DisplayLayout& stored = layout_store->GetRegisteredDisplayLayout(list); |
| 2213 | 2225 |
| 2214 EXPECT_EQ(id1, stored.placement_list[0].parent_display_id); | 2226 EXPECT_EQ(id1, stored.placement_list[0].parent_display_id); |
| 2215 EXPECT_EQ(id2, stored.placement_list[0].display_id); | 2227 EXPECT_EQ(id2, stored.placement_list[0].display_id); |
| 2216 } | 2228 } |
| 2217 | 2229 |
| 2218 #endif // OS_CHROMEOS | 2230 #endif // OS_CHROMEOS |
| 2219 | 2231 |
| 2220 } // namespace ash | 2232 } // namespace ash |
| OLD | NEW |