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

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

Issue 1608733002: Remove ui/gfx/screen_type_delegate.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-4
Patch Set: and another rebase Created 4 years, 11 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/unified_mouse_warp_controller_unittest.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 12 matching lines...) Expand all
23 #include "base/strings/stringprintf.h" 23 #include "base/strings/stringprintf.h"
24 #include "ui/aura/client/aura_constants.h" 24 #include "ui/aura/client/aura_constants.h"
25 #include "ui/aura/env.h" 25 #include "ui/aura/env.h"
26 #include "ui/aura/window_observer.h" 26 #include "ui/aura/window_observer.h"
27 #include "ui/aura/window_tree_host.h" 27 #include "ui/aura/window_tree_host.h"
28 #include "ui/events/test/event_generator.h" 28 #include "ui/events/test/event_generator.h"
29 #include "ui/gfx/display.h" 29 #include "ui/gfx/display.h"
30 #include "ui/gfx/display_observer.h" 30 #include "ui/gfx/display_observer.h"
31 #include "ui/gfx/font_render_params.h" 31 #include "ui/gfx/font_render_params.h"
32 #include "ui/gfx/screen.h" 32 #include "ui/gfx/screen.h"
33 #include "ui/gfx/screen_type_delegate.h"
34 33
35 namespace ash { 34 namespace ash {
36 35
37 using std::vector; 36 using std::vector;
38 using std::string; 37 using std::string;
39 38
40 using base::StringPrintf; 39 using base::StringPrintf;
41 40
42 namespace { 41 namespace {
43 42
(...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1533 1532
1534 // Don't check root window destruction in unified mode. 1533 // Don't check root window destruction in unified mode.
1535 Shell::GetPrimaryRootWindow()->RemoveObserver(this); 1534 Shell::GetPrimaryRootWindow()->RemoveObserver(this);
1536 1535
1537 UpdateDisplay("400x500,300x200"); 1536 UpdateDisplay("400x500,300x200");
1538 1537
1539 // Enable after extended mode. 1538 // Enable after extended mode.
1540 display_manager()->SetUnifiedDesktopEnabled(true); 1539 display_manager()->SetUnifiedDesktopEnabled(true);
1541 1540
1542 // Defaults to the unified desktop. 1541 // Defaults to the unified desktop.
1543 gfx::Screen* screen = 1542 gfx::Screen* screen = gfx::Screen::GetScreen();
1544 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE);
1545 // The 2nd display is scaled so that it has the same height as 1st display. 1543 // The 2nd display is scaled so that it has the same height as 1st display.
1546 // 300 * 500 / 200 + 400 = 1150. 1544 // 300 * 500 / 200 + 400 = 1150.
1547 EXPECT_EQ("1150x500", screen->GetPrimaryDisplay().size().ToString()); 1545 EXPECT_EQ("1150x500", screen->GetPrimaryDisplay().size().ToString());
1548 1546
1549 display_manager()->SetMirrorMode(true); 1547 display_manager()->SetMirrorMode(true);
1550 EXPECT_EQ("400x500", screen->GetPrimaryDisplay().size().ToString()); 1548 EXPECT_EQ("400x500", screen->GetPrimaryDisplay().size().ToString());
1551 1549
1552 display_manager()->SetMirrorMode(false); 1550 display_manager()->SetMirrorMode(false);
1553 EXPECT_EQ("1150x500", screen->GetPrimaryDisplay().size().ToString()); 1551 EXPECT_EQ("1150x500", screen->GetPrimaryDisplay().size().ToString());
1554 1552
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 EXPECT_FALSE(display_manager()->IsInUnifiedMode()); 1634 EXPECT_FALSE(display_manager()->IsInUnifiedMode());
1637 } 1635 }
1638 1636
1639 TEST_F(DisplayManagerTest, UnifiedDesktopWith2xDSF) { 1637 TEST_F(DisplayManagerTest, UnifiedDesktopWith2xDSF) {
1640 if (!SupportsMultipleDisplays()) 1638 if (!SupportsMultipleDisplays())
1641 return; 1639 return;
1642 // Don't check root window destruction in unified mode. 1640 // Don't check root window destruction in unified mode.
1643 Shell::GetPrimaryRootWindow()->RemoveObserver(this); 1641 Shell::GetPrimaryRootWindow()->RemoveObserver(this);
1644 1642
1645 display_manager()->SetUnifiedDesktopEnabled(true); 1643 display_manager()->SetUnifiedDesktopEnabled(true);
1646 gfx::Screen* screen = 1644 gfx::Screen* screen = gfx::Screen::GetScreen();
1647 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE);
1648 1645
1649 // 2nd display is 2x. 1646 // 2nd display is 2x.
1650 UpdateDisplay("400x500,1000x800*2"); 1647 UpdateDisplay("400x500,1000x800*2");
1651 DisplayInfo info = 1648 DisplayInfo info =
1652 display_manager()->GetDisplayInfo(screen->GetPrimaryDisplay().id()); 1649 display_manager()->GetDisplayInfo(screen->GetPrimaryDisplay().id());
1653 EXPECT_EQ(2u, info.display_modes().size()); 1650 EXPECT_EQ(2u, info.display_modes().size());
1654 EXPECT_EQ("1640x800", info.display_modes()[0].size.ToString()); 1651 EXPECT_EQ("1640x800", info.display_modes()[0].size.ToString());
1655 EXPECT_EQ(2.0f, info.display_modes()[0].device_scale_factor); 1652 EXPECT_EQ(2.0f, info.display_modes()[0].device_scale_factor);
1656 EXPECT_EQ("1025x500", info.display_modes()[1].size.ToString()); 1653 EXPECT_EQ("1025x500", info.display_modes()[1].size.ToString());
1657 EXPECT_EQ(1.0f, info.display_modes()[1].device_scale_factor); 1654 EXPECT_EQ(1.0f, info.display_modes()[1].device_scale_factor);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1758 TEST_F(DisplayManagerTest, NoRotateUnifiedDesktop) { 1755 TEST_F(DisplayManagerTest, NoRotateUnifiedDesktop) {
1759 if (!SupportsMultipleDisplays()) 1756 if (!SupportsMultipleDisplays())
1760 return; 1757 return;
1761 display_manager()->SetUnifiedDesktopEnabled(true); 1758 display_manager()->SetUnifiedDesktopEnabled(true);
1762 1759
1763 // Don't check root window destruction in unified mode. 1760 // Don't check root window destruction in unified mode.
1764 Shell::GetPrimaryRootWindow()->RemoveObserver(this); 1761 Shell::GetPrimaryRootWindow()->RemoveObserver(this);
1765 1762
1766 UpdateDisplay("400x500,300x200"); 1763 UpdateDisplay("400x500,300x200");
1767 1764
1768 gfx::Screen* screen = 1765 gfx::Screen* screen = gfx::Screen::GetScreen();
1769 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE);
1770 const gfx::Display& display = screen->GetPrimaryDisplay(); 1766 const gfx::Display& display = screen->GetPrimaryDisplay();
1771 EXPECT_EQ("1150x500", display.size().ToString()); 1767 EXPECT_EQ("1150x500", display.size().ToString());
1772 display_manager()->SetDisplayRotation(display.id(), gfx::Display::ROTATE_90, 1768 display_manager()->SetDisplayRotation(display.id(), gfx::Display::ROTATE_90,
1773 gfx::Display::ROTATION_SOURCE_ACTIVE); 1769 gfx::Display::ROTATION_SOURCE_ACTIVE);
1774 EXPECT_EQ("1150x500", screen->GetPrimaryDisplay().size().ToString()); 1770 EXPECT_EQ("1150x500", screen->GetPrimaryDisplay().size().ToString());
1775 display_manager()->SetDisplayRotation(display.id(), gfx::Display::ROTATE_0, 1771 display_manager()->SetDisplayRotation(display.id(), gfx::Display::ROTATE_0,
1776 gfx::Display::ROTATION_SOURCE_ACTIVE); 1772 gfx::Display::ROTATION_SOURCE_ACTIVE);
1777 EXPECT_EQ("1150x500", screen->GetPrimaryDisplay().size().ToString()); 1773 EXPECT_EQ("1150x500", screen->GetPrimaryDisplay().size().ToString());
1778 1774
1779 UpdateDisplay("400x500"); 1775 UpdateDisplay("400x500");
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1845 EXPECT_FALSE(SetDisplayUIScale(gfx::Display::kInvalidDisplayID, 1.0f)); 1841 EXPECT_FALSE(SetDisplayUIScale(gfx::Display::kInvalidDisplayID, 1.0f));
1846 } 1842 }
1847 1843
1848 class ScreenShutdownTest : public test::AshTestBase { 1844 class ScreenShutdownTest : public test::AshTestBase {
1849 public: 1845 public:
1850 ScreenShutdownTest() { 1846 ScreenShutdownTest() {
1851 } 1847 }
1852 ~ScreenShutdownTest() override {} 1848 ~ScreenShutdownTest() override {}
1853 1849
1854 void TearDown() override { 1850 void TearDown() override {
1855 gfx::Screen* orig_screen = 1851 gfx::Screen* orig_screen = gfx::Screen::GetScreen();
1856 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE);
1857 AshTestBase::TearDown(); 1852 AshTestBase::TearDown();
1858 if (!SupportsMultipleDisplays()) 1853 if (!SupportsMultipleDisplays())
1859 return; 1854 return;
1860 gfx::Screen* screen = 1855 gfx::Screen* screen = gfx::Screen::GetScreen();
1861 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE);
1862 EXPECT_NE(orig_screen, screen); 1856 EXPECT_NE(orig_screen, screen);
1863 EXPECT_EQ(2, screen->GetNumDisplays()); 1857 EXPECT_EQ(2, screen->GetNumDisplays());
1864 EXPECT_EQ("500x300", screen->GetPrimaryDisplay().size().ToString()); 1858 EXPECT_EQ("500x300", screen->GetPrimaryDisplay().size().ToString());
1865 std::vector<gfx::Display> all = screen->GetAllDisplays(); 1859 std::vector<gfx::Display> all = screen->GetAllDisplays();
1866 EXPECT_EQ("500x300", all[0].size().ToString()); 1860 EXPECT_EQ("500x300", all[0].size().ToString());
1867 EXPECT_EQ("800x400", all[1].size().ToString()); 1861 EXPECT_EQ("800x400", all[1].size().ToString());
1868 } 1862 }
1869 1863
1870 private: 1864 private:
1871 DISALLOW_COPY_AND_ASSIGN(ScreenShutdownTest); 1865 DISALLOW_COPY_AND_ASSIGN(ScreenShutdownTest);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
2029 layout_store->RegisterLayoutForDisplayIdPair(id2, id1, bad); 2023 layout_store->RegisterLayoutForDisplayIdPair(id2, id1, bad);
2030 2024
2031 EXPECT_EQ(good.ToString(), layout_store->GetRegisteredDisplayLayout( 2025 EXPECT_EQ(good.ToString(), layout_store->GetRegisteredDisplayLayout(
2032 CreateDisplayIdPair(id1, id2)) 2026 CreateDisplayIdPair(id1, id2))
2033 .ToString()); 2027 .ToString());
2034 } 2028 }
2035 2029
2036 #endif // OS_CHROMEOS 2030 #endif // OS_CHROMEOS
2037 2031
2038 } // namespace ash 2032 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_manager.cc ('k') | ash/display/unified_mouse_warp_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698