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/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/display/display_controller.h" | 8 #include "ash/display/display_controller.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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 class DisplayManagerTest : public test::AshTestBase, | 45 class DisplayManagerTest : public test::AshTestBase, |
46 public gfx::DisplayObserver, | 46 public gfx::DisplayObserver, |
47 public aura::WindowObserver { | 47 public aura::WindowObserver { |
48 public: | 48 public: |
49 DisplayManagerTest() | 49 DisplayManagerTest() |
50 : removed_count_(0U), | 50 : removed_count_(0U), |
51 root_window_destroyed_(false) { | 51 root_window_destroyed_(false) { |
52 } | 52 } |
53 virtual ~DisplayManagerTest() {} | 53 virtual ~DisplayManagerTest() {} |
54 | 54 |
55 virtual void SetUp() OVERRIDE { | 55 virtual void SetUp() override { |
56 AshTestBase::SetUp(); | 56 AshTestBase::SetUp(); |
57 Shell::GetScreen()->AddObserver(this); | 57 Shell::GetScreen()->AddObserver(this); |
58 Shell::GetPrimaryRootWindow()->AddObserver(this); | 58 Shell::GetPrimaryRootWindow()->AddObserver(this); |
59 } | 59 } |
60 virtual void TearDown() OVERRIDE { | 60 virtual void TearDown() override { |
61 Shell::GetPrimaryRootWindow()->RemoveObserver(this); | 61 Shell::GetPrimaryRootWindow()->RemoveObserver(this); |
62 Shell::GetScreen()->RemoveObserver(this); | 62 Shell::GetScreen()->RemoveObserver(this); |
63 AshTestBase::TearDown(); | 63 AshTestBase::TearDown(); |
64 } | 64 } |
65 | 65 |
66 DisplayManager* display_manager() { | 66 DisplayManager* display_manager() { |
67 return Shell::GetInstance()->display_manager(); | 67 return Shell::GetInstance()->display_manager(); |
68 } | 68 } |
69 const vector<gfx::Display>& changed() const { return changed_; } | 69 const vector<gfx::Display>& changed() const { return changed_; } |
70 const vector<gfx::Display>& added() const { return added_; } | 70 const vector<gfx::Display>& added() const { return added_; } |
(...skipping 25 matching lines...) Expand all Loading... |
96 const gfx::Display& GetDisplayForId(int64 id) { | 96 const gfx::Display& GetDisplayForId(int64 id) { |
97 return display_manager()->GetDisplayForId(id); | 97 return display_manager()->GetDisplayForId(id); |
98 } | 98 } |
99 | 99 |
100 const DisplayInfo& GetDisplayInfoForId(int64 id) { | 100 const DisplayInfo& GetDisplayInfoForId(int64 id) { |
101 return GetDisplayInfo(display_manager()->GetDisplayForId(id)); | 101 return GetDisplayInfo(display_manager()->GetDisplayForId(id)); |
102 } | 102 } |
103 | 103 |
104 // aura::DisplayObserver overrides: | 104 // aura::DisplayObserver overrides: |
105 virtual void OnDisplayMetricsChanged(const gfx::Display& display, | 105 virtual void OnDisplayMetricsChanged(const gfx::Display& display, |
106 uint32_t) OVERRIDE { | 106 uint32_t) override { |
107 changed_.push_back(display); | 107 changed_.push_back(display); |
108 } | 108 } |
109 virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE { | 109 virtual void OnDisplayAdded(const gfx::Display& new_display) override { |
110 added_.push_back(new_display); | 110 added_.push_back(new_display); |
111 } | 111 } |
112 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE { | 112 virtual void OnDisplayRemoved(const gfx::Display& old_display) override { |
113 ++removed_count_; | 113 ++removed_count_; |
114 } | 114 } |
115 | 115 |
116 // aura::WindowObserver overrides: | 116 // aura::WindowObserver overrides: |
117 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE { | 117 virtual void OnWindowDestroying(aura::Window* window) override { |
118 ASSERT_EQ(Shell::GetPrimaryRootWindow(), window); | 118 ASSERT_EQ(Shell::GetPrimaryRootWindow(), window); |
119 root_window_destroyed_ = true; | 119 root_window_destroyed_ = true; |
120 } | 120 } |
121 | 121 |
122 private: | 122 private: |
123 vector<gfx::Display> changed_; | 123 vector<gfx::Display> changed_; |
124 vector<gfx::Display> added_; | 124 vector<gfx::Display> added_; |
125 size_t removed_count_; | 125 size_t removed_count_; |
126 bool root_window_destroyed_; | 126 bool root_window_destroyed_; |
127 | 127 |
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 UpdateDisplay("600x400,400x200*2@1.5"); | 1148 UpdateDisplay("600x400,400x200*2@1.5"); |
1149 EXPECT_EQ("750,75", env->last_mouse_location().ToString()); | 1149 EXPECT_EQ("750,75", env->last_mouse_location().ToString()); |
1150 } | 1150 } |
1151 | 1151 |
1152 class TestDisplayObserver : public gfx::DisplayObserver { | 1152 class TestDisplayObserver : public gfx::DisplayObserver { |
1153 public: | 1153 public: |
1154 TestDisplayObserver() : changed_(false) {} | 1154 TestDisplayObserver() : changed_(false) {} |
1155 virtual ~TestDisplayObserver() {} | 1155 virtual ~TestDisplayObserver() {} |
1156 | 1156 |
1157 // gfx::DisplayObserver overrides: | 1157 // gfx::DisplayObserver overrides: |
1158 virtual void OnDisplayMetricsChanged(const gfx::Display&,uint32_t) OVERRIDE {} | 1158 virtual void OnDisplayMetricsChanged(const gfx::Display&,uint32_t) override {} |
1159 virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE { | 1159 virtual void OnDisplayAdded(const gfx::Display& new_display) override { |
1160 // Mirror window should already be delete before restoring | 1160 // Mirror window should already be delete before restoring |
1161 // the external display. | 1161 // the external display. |
1162 EXPECT_FALSE(test_api.GetHost()); | 1162 EXPECT_FALSE(test_api.GetHost()); |
1163 changed_ = true; | 1163 changed_ = true; |
1164 } | 1164 } |
1165 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE { | 1165 virtual void OnDisplayRemoved(const gfx::Display& old_display) override { |
1166 // Mirror window should not be created until the external display | 1166 // Mirror window should not be created until the external display |
1167 // is removed. | 1167 // is removed. |
1168 EXPECT_FALSE(test_api.GetHost()); | 1168 EXPECT_FALSE(test_api.GetHost()); |
1169 changed_ = true; | 1169 changed_ = true; |
1170 } | 1170 } |
1171 | 1171 |
1172 bool changed_and_reset() { | 1172 bool changed_and_reset() { |
1173 bool changed = changed_; | 1173 bool changed = changed_; |
1174 changed_ = false; | 1174 changed_ = false; |
1175 return changed; | 1175 return changed; |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 EXPECT_EQ("200x300", host1->GetBounds().size().ToString()); | 1382 EXPECT_EQ("200x300", host1->GetBounds().size().ToString()); |
1383 } | 1383 } |
1384 | 1384 |
1385 | 1385 |
1386 class ScreenShutdownTest : public test::AshTestBase { | 1386 class ScreenShutdownTest : public test::AshTestBase { |
1387 public: | 1387 public: |
1388 ScreenShutdownTest() { | 1388 ScreenShutdownTest() { |
1389 } | 1389 } |
1390 virtual ~ScreenShutdownTest() {} | 1390 virtual ~ScreenShutdownTest() {} |
1391 | 1391 |
1392 virtual void TearDown() OVERRIDE { | 1392 virtual void TearDown() override { |
1393 gfx::Screen* orig_screen = | 1393 gfx::Screen* orig_screen = |
1394 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE); | 1394 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE); |
1395 AshTestBase::TearDown(); | 1395 AshTestBase::TearDown(); |
1396 if (!SupportsMultipleDisplays()) | 1396 if (!SupportsMultipleDisplays()) |
1397 return; | 1397 return; |
1398 gfx::Screen* screen = | 1398 gfx::Screen* screen = |
1399 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE); | 1399 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE); |
1400 EXPECT_NE(orig_screen, screen); | 1400 EXPECT_NE(orig_screen, screen); |
1401 EXPECT_EQ(2, screen->GetNumDisplays()); | 1401 EXPECT_EQ(2, screen->GetNumDisplays()); |
1402 EXPECT_EQ("500x300", screen->GetPrimaryDisplay().size().ToString()); | 1402 EXPECT_EQ("500x300", screen->GetPrimaryDisplay().size().ToString()); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1437 command_line->AppendSwitchASCII(switches::kAshHostWindowBounds, | 1437 command_line->AppendSwitchASCII(switches::kAshHostWindowBounds, |
1438 StringPrintf("1000x800*%f", scale)); | 1438 StringPrintf("1000x800*%f", scale)); |
1439 SetUp(); | 1439 SetUp(); |
1440 } | 1440 } |
1441 | 1441 |
1442 virtual ~FontTestHelper() { | 1442 virtual ~FontTestHelper() { |
1443 TearDown(); | 1443 TearDown(); |
1444 } | 1444 } |
1445 | 1445 |
1446 // test::AshTestBase: | 1446 // test::AshTestBase: |
1447 virtual void TestBody() OVERRIDE { | 1447 virtual void TestBody() override { |
1448 NOTREACHED(); | 1448 NOTREACHED(); |
1449 } | 1449 } |
1450 | 1450 |
1451 private: | 1451 private: |
1452 DISALLOW_COPY_AND_ASSIGN(FontTestHelper); | 1452 DISALLOW_COPY_AND_ASSIGN(FontTestHelper); |
1453 }; | 1453 }; |
1454 | 1454 |
1455 | 1455 |
1456 bool IsTextSubpixelPositioningEnabled() { | 1456 bool IsTextSubpixelPositioningEnabled() { |
1457 gfx::FontRenderParams params = | 1457 gfx::FontRenderParams params = |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1511 FontTestHelper helper(1.25f, FontTestHelper::INTERNAL); | 1511 FontTestHelper helper(1.25f, FontTestHelper::INTERNAL); |
1512 ASSERT_DOUBLE_EQ( | 1512 ASSERT_DOUBLE_EQ( |
1513 1.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); | 1513 1.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); |
1514 EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); | 1514 EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); |
1515 DisplayInfo::SetUse125DSFForUIScaling(false); | 1515 DisplayInfo::SetUse125DSFForUIScaling(false); |
1516 } | 1516 } |
1517 | 1517 |
1518 #endif // OS_CHROMEOS | 1518 #endif // OS_CHROMEOS |
1519 | 1519 |
1520 } // namespace ash | 1520 } // namespace ash |
OLD | NEW |