| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 display_manager()->GetDisplayAt(1)->bounds_in_pixel().ToString()); | 189 display_manager()->GetDisplayAt(1)->bounds_in_pixel().ToString()); |
| 190 reset(); | 190 reset(); |
| 191 | 191 |
| 192 aura::DisplayManager::set_use_fullscreen_host_window(false); | 192 aura::DisplayManager::set_use_fullscreen_host_window(false); |
| 193 } | 193 } |
| 194 | 194 |
| 195 // Test in emulation mode (use_fullscreen_host_window=false) | 195 // Test in emulation mode (use_fullscreen_host_window=false) |
| 196 TEST_F(MultiDisplayManagerTest, MAYBE_EmulatorTest) { | 196 TEST_F(MultiDisplayManagerTest, MAYBE_EmulatorTest) { |
| 197 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 197 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); |
| 198 | 198 |
| 199 MultiDisplayManager::AddRemoveDisplay(); | 199 MultiDisplayManager::CycleDisplay(); |
| 200 // Update primary and add seconary. | 200 // Update primary and add seconary. |
| 201 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); | 201 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); |
| 202 EXPECT_EQ("1 1 0", GetCountSummary()); | 202 EXPECT_EQ("0 1 0", GetCountSummary()); |
| 203 reset(); | 203 reset(); |
| 204 | 204 |
| 205 MultiDisplayManager::CycleDisplay(); | 205 MultiDisplayManager::CycleDisplay(); |
| 206 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); | |
| 207 // Observer gets called twice in this mode because | |
| 208 // it gets notified both from |OnNativeDisplayChagned| | |
| 209 // and from |RootWindowObserver|, which is the consequence of | |
| 210 // |SetHostSize()|. | |
| 211 EXPECT_EQ("4 0 0", GetCountSummary()); | |
| 212 reset(); | |
| 213 | |
| 214 MultiDisplayManager::AddRemoveDisplay(); | |
| 215 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 206 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); |
| 216 EXPECT_EQ("0 0 1", GetCountSummary()); | 207 EXPECT_EQ("0 0 1", GetCountSummary()); |
| 217 reset(); | 208 reset(); |
| 218 | 209 |
| 219 MultiDisplayManager::CycleDisplay(); | 210 MultiDisplayManager::CycleDisplay(); |
| 220 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 211 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); |
| 221 EXPECT_EQ("0 0 0", GetCountSummary()); | 212 EXPECT_EQ("0 1 0", GetCountSummary()); |
| 222 reset(); | 213 reset(); |
| 223 } | 214 } |
| 224 | 215 |
| 225 // TODO(oshima): Device scale factor is supported on chromeos only for now. | 216 // TODO(oshima): Device scale factor is supported on chromeos only for now. |
| 226 #if defined(OS_CHROMEOS) | 217 #if defined(OS_CHROMEOS) |
| 227 #define MAYBE_TestDeviceScaleOnlyChange TestDeviceScaleOnlyChange | 218 #define MAYBE_TestDeviceScaleOnlyChange TestDeviceScaleOnlyChange |
| 228 #define MAYBE_TestNativeDisplaysChanged TestNativeDisplaysChanged | 219 #define MAYBE_TestNativeDisplaysChanged TestNativeDisplaysChanged |
| 229 #else | 220 #else |
| 230 #define MAYBE_TestDeviceScaleOnlyChange DISABLED_TestDeviceScaleOnlyChange | 221 #define MAYBE_TestDeviceScaleOnlyChange DISABLED_TestDeviceScaleOnlyChange |
| 231 #define MAYBE_TestNativeDisplaysChanged DISABLED_TestNativeDisplaysChanged | 222 #define MAYBE_TestNativeDisplaysChanged DISABLED_TestNativeDisplaysChanged |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 // External display has disconnected then resumed. | 296 // External display has disconnected then resumed. |
| 306 displays.push_back(native_display); | 297 displays.push_back(native_display); |
| 307 display_manager()->OnNativeDisplaysChanged(displays); | 298 display_manager()->OnNativeDisplaysChanged(displays); |
| 308 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 299 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); |
| 309 EXPECT_EQ("0,0 500x500", | 300 EXPECT_EQ("0,0 500x500", |
| 310 display_manager()->GetDisplayAt(0)->bounds().ToString()); | 301 display_manager()->GetDisplayAt(0)->bounds().ToString()); |
| 311 } | 302 } |
| 312 | 303 |
| 313 } // namespace internal | 304 } // namespace internal |
| 314 } // namespace ash | 305 } // namespace ash |
| OLD | NEW |