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_store.h" | 10 #include "ash/display/display_layout_store.h" |
(...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1595 display_info_list.push_back(d2); | 1595 display_info_list.push_back(d2); |
1596 display_manager()->OnNativeDisplaysChanged(display_info_list); | 1596 display_manager()->OnNativeDisplaysChanged(display_info_list); |
1597 ASSERT_TRUE(display_manager()->IsInMirrorMode()); | 1597 ASSERT_TRUE(display_manager()->IsInMirrorMode()); |
1598 display_manager()->SetUnifiedDesktopEnabled(true); | 1598 display_manager()->SetUnifiedDesktopEnabled(true); |
1599 EXPECT_TRUE(display_manager()->IsInMirrorMode()); | 1599 EXPECT_TRUE(display_manager()->IsInMirrorMode()); |
1600 | 1600 |
1601 // The display manager automaticaclly switches to software mirroring | 1601 // The display manager automaticaclly switches to software mirroring |
1602 // if the displays are configured to use mirroring when running on desktop. | 1602 // if the displays are configured to use mirroring when running on desktop. |
1603 // This is a workdaround to force the display manager to forget | 1603 // This is a workdaround to force the display manager to forget |
1604 // the mirroing layout. | 1604 // the mirroing layout. |
1605 DisplayIdPair pair = CreateDisplayIdPair(1, 2); | 1605 DisplayIdList list = CreateDisplayIdList(1, 2); |
1606 DisplayLayout layout = | 1606 DisplayLayout layout = |
1607 display_manager()->layout_store()->GetRegisteredDisplayLayout(pair); | 1607 display_manager()->layout_store()->GetRegisteredDisplayLayout(list); |
1608 layout.mirrored = false; | 1608 layout.mirrored = false; |
1609 display_manager()->layout_store()->RegisterLayoutForDisplayIdPair(1, 2, | 1609 display_manager()->layout_store()->RegisterLayoutForDisplayIdList(1, 2, |
1610 layout); | 1610 layout); |
1611 | 1611 |
1612 // Exit from hardware mirroring. | 1612 // Exit from hardware mirroring. |
1613 d2.SetBounds(gfx::Rect(0, 500, 500, 500)); | 1613 d2.SetBounds(gfx::Rect(0, 500, 500, 500)); |
1614 display_info_list.clear(); | 1614 display_info_list.clear(); |
1615 display_info_list.push_back(d1); | 1615 display_info_list.push_back(d1); |
1616 display_info_list.push_back(d2); | 1616 display_info_list.push_back(d2); |
1617 display_manager()->OnNativeDisplaysChanged(display_info_list); | 1617 display_manager()->OnNativeDisplaysChanged(display_info_list); |
1618 EXPECT_FALSE(display_manager()->IsInMirrorMode()); | 1618 EXPECT_FALSE(display_manager()->IsInMirrorMode()); |
1619 EXPECT_TRUE(display_manager()->IsInUnifiedMode()); | 1619 EXPECT_TRUE(display_manager()->IsInUnifiedMode()); |
1620 } | 1620 } |
1621 | 1621 |
1622 TEST_F(DisplayManagerTest, UnifiedDesktopEnabledWithExtended) { | 1622 TEST_F(DisplayManagerTest, UnifiedDesktopEnabledWithExtended) { |
1623 if (!SupportsMultipleDisplays()) | 1623 if (!SupportsMultipleDisplays()) |
1624 return; | 1624 return; |
1625 // Don't check root window destruction in unified mode. | 1625 // Don't check root window destruction in unified mode. |
1626 Shell::GetPrimaryRootWindow()->RemoveObserver(this); | 1626 Shell::GetPrimaryRootWindow()->RemoveObserver(this); |
1627 | 1627 |
1628 UpdateDisplay("400x500,300x200"); | 1628 UpdateDisplay("400x500,300x200"); |
1629 DisplayIdPair pair = display_manager()->GetCurrentDisplayIdPair(); | 1629 DisplayIdList list = display_manager()->GetCurrentDisplayIdList(); |
1630 DisplayLayout layout = | 1630 DisplayLayout layout = |
1631 display_manager()->layout_store()->GetRegisteredDisplayLayout(pair); | 1631 display_manager()->layout_store()->GetRegisteredDisplayLayout(list); |
1632 layout.default_unified = false; | 1632 layout.default_unified = false; |
1633 display_manager()->layout_store()->RegisterLayoutForDisplayIdPair( | 1633 display_manager()->layout_store()->RegisterLayoutForDisplayIdList( |
1634 pair.first, pair.second, layout); | 1634 list[0], list[1], layout); |
1635 display_manager()->SetUnifiedDesktopEnabled(true); | 1635 display_manager()->SetUnifiedDesktopEnabled(true); |
1636 EXPECT_FALSE(display_manager()->IsInUnifiedMode()); | 1636 EXPECT_FALSE(display_manager()->IsInUnifiedMode()); |
1637 } | 1637 } |
1638 | 1638 |
1639 TEST_F(DisplayManagerTest, UnifiedDesktopWith2xDSF) { | 1639 TEST_F(DisplayManagerTest, UnifiedDesktopWith2xDSF) { |
1640 if (!SupportsMultipleDisplays()) | 1640 if (!SupportsMultipleDisplays()) |
1641 return; | 1641 return; |
1642 // Don't check root window destruction in unified mode. | 1642 // Don't check root window destruction in unified mode. |
1643 Shell::GetPrimaryRootWindow()->RemoveObserver(this); | 1643 Shell::GetPrimaryRootWindow()->RemoveObserver(this); |
1644 | 1644 |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2019 } | 2019 } |
2020 | 2020 |
2021 TEST_F(DisplayManagerTest, RejectInvalidLayoutData) { | 2021 TEST_F(DisplayManagerTest, RejectInvalidLayoutData) { |
2022 DisplayLayoutStore* layout_store = display_manager()->layout_store(); | 2022 DisplayLayoutStore* layout_store = display_manager()->layout_store(); |
2023 int64_t id1 = 10001; | 2023 int64_t id1 = 10001; |
2024 int64_t id2 = 10002; | 2024 int64_t id2 = 10002; |
2025 ASSERT_TRUE(CompareDisplayIds(id1, id2)); | 2025 ASSERT_TRUE(CompareDisplayIds(id1, id2)); |
2026 DisplayLayout good(DisplayLayout(DisplayLayout::LEFT, 0)); | 2026 DisplayLayout good(DisplayLayout(DisplayLayout::LEFT, 0)); |
2027 good.primary_id = id1; | 2027 good.primary_id = id1; |
2028 | 2028 |
2029 layout_store->RegisterLayoutForDisplayIdPair(id1, id2, good); | 2029 layout_store->RegisterLayoutForDisplayIdList(id1, id2, good); |
2030 | 2030 |
2031 DisplayLayout bad(DisplayLayout(DisplayLayout::BOTTOM, 0)); | 2031 DisplayLayout bad(DisplayLayout(DisplayLayout::BOTTOM, 0)); |
2032 good.primary_id = id2; | 2032 good.primary_id = id2; |
2033 | 2033 |
2034 layout_store->RegisterLayoutForDisplayIdPair(id2, id1, bad); | 2034 layout_store->RegisterLayoutForDisplayIdList(id2, id1, bad); |
2035 | 2035 |
2036 EXPECT_EQ(good.ToString(), layout_store->GetRegisteredDisplayLayout( | 2036 EXPECT_EQ( |
2037 CreateDisplayIdPair(id1, id2)) | 2037 good.ToString(), |
2038 .ToString()); | 2038 layout_store->GetRegisteredDisplayLayout(CreateDisplayIdList(id1, id2)) |
| 2039 .ToString()); |
2039 } | 2040 } |
2040 | 2041 |
2041 #endif // OS_CHROMEOS | 2042 #endif // OS_CHROMEOS |
2042 | 2043 |
2043 } // namespace ash | 2044 } // namespace ash |
OLD | NEW |