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/multi_display_manager.h" | 5 #include "ash/display/multi_display_manager.h" |
6 | 6 |
7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 display_manager()->GetDisplayAt(1)->bounds_in_pixel().ToString()); | 188 display_manager()->GetDisplayAt(1)->bounds_in_pixel().ToString()); |
189 reset(); | 189 reset(); |
190 | 190 |
191 aura::DisplayManager::set_use_fullscreen_host_window(false); | 191 aura::DisplayManager::set_use_fullscreen_host_window(false); |
192 } | 192 } |
193 | 193 |
194 // Test in emulation mode (use_fullscreen_host_window=false) | 194 // Test in emulation mode (use_fullscreen_host_window=false) |
195 TEST_F(MultiDisplayManagerTest, MAYBE_EmulatorTest) { | 195 TEST_F(MultiDisplayManagerTest, MAYBE_EmulatorTest) { |
196 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 196 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); |
197 | 197 |
198 internal::MultiDisplayManager::AddRemoveDisplay(); | 198 internal::MultiDisplayManager::CycleDisplay(); |
199 // Update primary and add seconary. | 199 // Update primary and add seconary. |
200 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); | 200 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); |
201 EXPECT_EQ("1 1 0", GetCountSummary()); | 201 EXPECT_EQ("0 1 0", GetCountSummary()); |
202 reset(); | 202 reset(); |
203 | 203 |
204 internal::MultiDisplayManager::CycleDisplay(); | 204 internal::MultiDisplayManager::CycleDisplay(); |
205 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); | |
206 // Observer gets called twice in this mode because | |
207 // it gets notified both from |OnNativeDisplayChagned| | |
208 // and from |RootWindowObserver|, which is the consequence of | |
209 // |SetHostSize()|. | |
210 EXPECT_EQ("4 0 0", GetCountSummary()); | |
211 reset(); | |
212 | |
213 internal::MultiDisplayManager::AddRemoveDisplay(); | |
214 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 205 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); |
215 EXPECT_EQ("0 0 1", GetCountSummary()); | 206 EXPECT_EQ("0 0 1", GetCountSummary()); |
216 reset(); | 207 reset(); |
217 | 208 |
218 internal::MultiDisplayManager::CycleDisplay(); | 209 internal::MultiDisplayManager::CycleDisplay(); |
219 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 210 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); |
220 EXPECT_EQ("0 0 0", GetCountSummary()); | 211 EXPECT_EQ("0 1 0", GetCountSummary()); |
221 reset(); | 212 reset(); |
222 } | 213 } |
223 | 214 |
224 // TODO(oshima): Device scale factor is supported on chromeos only for now. | 215 // TODO(oshima): Device scale factor is supported on chromeos only for now. |
225 #if defined(OS_CHROMEOS) | 216 #if defined(OS_CHROMEOS) |
226 #define MAYBE_TestDeviceScaleOnlyChange TestDeviceScaleOnlyChange | 217 #define MAYBE_TestDeviceScaleOnlyChange TestDeviceScaleOnlyChange |
227 #else | 218 #else |
228 #define MAYBE_TestDeviceScaleOnlyChange DISABLED_TestDeviceScaleOnlyChange | 219 #define MAYBE_TestDeviceScaleOnlyChange DISABLED_TestDeviceScaleOnlyChange |
229 #endif | 220 #endif |
230 | 221 |
231 TEST_F(MultiDisplayManagerTest, MAYBE_TestDeviceScaleOnlyChange) { | 222 TEST_F(MultiDisplayManagerTest, MAYBE_TestDeviceScaleOnlyChange) { |
232 aura::DisplayManager::set_use_fullscreen_host_window(true); | 223 aura::DisplayManager::set_use_fullscreen_host_window(true); |
233 UpdateDisplay("1000x600"); | 224 UpdateDisplay("1000x600"); |
234 EXPECT_EQ(1, | 225 EXPECT_EQ(1, |
235 Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor()); | 226 Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor()); |
236 EXPECT_EQ("1000x600", | 227 EXPECT_EQ("1000x600", |
237 Shell::GetPrimaryRootWindow()->bounds().size().ToString()); | 228 Shell::GetPrimaryRootWindow()->bounds().size().ToString()); |
238 UpdateDisplay("1000x600*2"); | 229 UpdateDisplay("1000x600*2"); |
239 EXPECT_EQ(2, | 230 EXPECT_EQ(2, |
240 Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor()); | 231 Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor()); |
241 EXPECT_EQ("500x300", | 232 EXPECT_EQ("500x300", |
242 Shell::GetPrimaryRootWindow()->bounds().size().ToString()); | 233 Shell::GetPrimaryRootWindow()->bounds().size().ToString()); |
243 aura::DisplayManager::set_use_fullscreen_host_window(false); | 234 aura::DisplayManager::set_use_fullscreen_host_window(false); |
244 } | 235 } |
245 | 236 |
246 } // namespace test | 237 } // namespace test |
247 } // namespace ash | 238 } // namespace ash |
OLD | NEW |