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/display_manager.h" |
6 | 6 |
7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
11 #include "base/format_macros.h" | 11 #include "base/format_macros.h" |
12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
13 #include "ui/aura/display_observer.h" | |
14 #include "ui/aura/env.h" | 13 #include "ui/aura/env.h" |
15 #include "ui/aura/root_window.h" | 14 #include "ui/aura/root_window.h" |
16 #include "ui/aura/window_observer.h" | 15 #include "ui/aura/window_observer.h" |
| 16 #include "ui/gfx/display_observer.h" |
17 #include "ui/gfx/display.h" | 17 #include "ui/gfx/display.h" |
18 | 18 |
19 namespace ash { | 19 namespace ash { |
20 namespace internal { | 20 namespace internal { |
21 | 21 |
22 using std::vector; | 22 using std::vector; |
23 using std::string; | 23 using std::string; |
24 | 24 |
25 class MultiDisplayManagerTest : public test::AshTestBase, | 25 class DisplayManagerTest : public test::AshTestBase, |
26 public aura::DisplayObserver, | 26 public gfx::DisplayObserver, |
27 public aura::WindowObserver { | 27 public aura::WindowObserver { |
28 public: | 28 public: |
29 MultiDisplayManagerTest() | 29 DisplayManagerTest() |
30 : removed_count_(0U), | 30 : removed_count_(0U), |
31 root_window_destroyed_(false) { | 31 root_window_destroyed_(false) { |
32 } | 32 } |
33 virtual ~MultiDisplayManagerTest() {} | 33 virtual ~DisplayManagerTest() {} |
34 | 34 |
35 virtual void SetUp() OVERRIDE { | 35 virtual void SetUp() OVERRIDE { |
36 AshTestBase::SetUp(); | 36 AshTestBase::SetUp(); |
37 display_manager()->AddObserver(this); | 37 Shell::GetScreen()->AddObserver(this); |
38 Shell::GetPrimaryRootWindow()->AddObserver(this); | 38 Shell::GetPrimaryRootWindow()->AddObserver(this); |
39 } | 39 } |
40 virtual void TearDown() OVERRIDE { | 40 virtual void TearDown() OVERRIDE { |
41 Shell::GetPrimaryRootWindow()->RemoveObserver(this); | 41 Shell::GetPrimaryRootWindow()->RemoveObserver(this); |
42 display_manager()->RemoveObserver(this); | 42 Shell::GetScreen()->RemoveObserver(this); |
43 AshTestBase::TearDown(); | 43 AshTestBase::TearDown(); |
44 } | 44 } |
45 | 45 |
46 MultiDisplayManager* display_manager() { | 46 DisplayManager* display_manager() { |
47 return static_cast<MultiDisplayManager*>( | 47 return Shell::GetInstance()->display_manager(); |
48 aura::Env::GetInstance()->display_manager()); | |
49 } | 48 } |
50 const vector<gfx::Display>& changed() const { return changed_; } | 49 const vector<gfx::Display>& changed() const { return changed_; } |
51 const vector<gfx::Display>& added() const { return added_; } | 50 const vector<gfx::Display>& added() const { return added_; } |
52 | 51 |
53 string GetCountSummary() const { | 52 string GetCountSummary() const { |
54 return StringPrintf("%"PRIuS" %"PRIuS" %"PRIuS, | 53 return StringPrintf("%"PRIuS" %"PRIuS" %"PRIuS, |
55 changed_.size(), added_.size(), removed_count_); | 54 changed_.size(), added_.size(), removed_count_); |
56 } | 55 } |
57 | 56 |
58 void reset() { | 57 void reset() { |
(...skipping 27 matching lines...) Expand all Loading... |
86 ASSERT_EQ(Shell::GetPrimaryRootWindow(), window); | 85 ASSERT_EQ(Shell::GetPrimaryRootWindow(), window); |
87 root_window_destroyed_ = true; | 86 root_window_destroyed_ = true; |
88 } | 87 } |
89 | 88 |
90 private: | 89 private: |
91 vector<gfx::Display> changed_; | 90 vector<gfx::Display> changed_; |
92 vector<gfx::Display> added_; | 91 vector<gfx::Display> added_; |
93 size_t removed_count_; | 92 size_t removed_count_; |
94 bool root_window_destroyed_; | 93 bool root_window_destroyed_; |
95 | 94 |
96 DISALLOW_COPY_AND_ASSIGN(MultiDisplayManagerTest); | 95 DISALLOW_COPY_AND_ASSIGN(DisplayManagerTest); |
97 }; | 96 }; |
98 | 97 |
99 #if defined(OS_CHROMEOS) | 98 #if defined(OS_CHROMEOS) |
100 // TODO(oshima): This fails with non extended desktop on windows. | 99 // TODO(oshima): This fails with non extended desktop on windows. |
101 // Reenable when extended desktop is enabled by default. | 100 // Reenable when extended desktop is enabled by default. |
102 #define MAYBE_NativeDisplayTest NativeDisplayTest | 101 #define MAYBE_NativeDisplayTest NativeDisplayTest |
103 #define MAYBE_EmulatorTest EmulatorTest | 102 #define MAYBE_EmulatorTest EmulatorTest |
104 #define MAYBE_OverscanInsetsTest OverscanInsetsTest | 103 #define MAYBE_OverscanInsetsTest OverscanInsetsTest |
105 #define MAYBE_ZeroOverscanInsets ZeroOverscanInsets | 104 #define MAYBE_ZeroOverscanInsets ZeroOverscanInsets |
106 #else | 105 #else |
107 #define MAYBE_NativeDisplayTest DISABLED_NativeDisplayTest | 106 #define MAYBE_NativeDisplayTest DISABLED_NativeDisplayTest |
108 #define MAYBE_EmulatorTest DISABLED_EmulatorTest | 107 #define MAYBE_EmulatorTest DISABLED_EmulatorTest |
109 #define MAYBE_OverscanInsetsTest DISABLED_OverscanInsetsTest | 108 #define MAYBE_OverscanInsetsTest DISABLED_OverscanInsetsTest |
110 #define MAYBE_ZeroOverscanInsets DISABLED_ZeroOverscanInsets | 109 #define MAYBE_ZeroOverscanInsets DISABLED_ZeroOverscanInsets |
111 #endif | 110 #endif |
112 | 111 |
113 TEST_F(MultiDisplayManagerTest, MAYBE_NativeDisplayTest) { | 112 TEST_F(DisplayManagerTest, MAYBE_NativeDisplayTest) { |
114 aura::DisplayManager::set_use_fullscreen_host_window(true); | |
115 | |
116 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 113 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); |
117 | 114 |
118 // Update primary and add seconary. | 115 // Update primary and add seconary. |
119 UpdateDisplay("100+0-500x500,0+501-400x400"); | 116 UpdateDisplay("100+0-500x500,0+501-400x400"); |
120 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); | 117 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); |
121 EXPECT_EQ("0,0 500x500", | 118 EXPECT_EQ("0,0 500x500", |
122 display_manager()->GetDisplayAt(0)->bounds().ToString()); | 119 display_manager()->GetDisplayAt(0)->bounds().ToString()); |
123 | 120 |
124 EXPECT_EQ("1 1 0", GetCountSummary()); | 121 EXPECT_EQ("1 1 0", GetCountSummary()); |
125 EXPECT_EQ(display_manager()->GetDisplayAt(0)->id(), changed()[0].id()); | 122 EXPECT_EQ(display_manager()->GetDisplayAt(0)->id(), changed()[0].id()); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 UpdateDisplay("0+0-1000x600,1000+1000-600x400"); | 187 UpdateDisplay("0+0-1000x600,1000+1000-600x400"); |
191 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); | 188 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); |
192 EXPECT_EQ("0,0 1000x600", | 189 EXPECT_EQ("0,0 1000x600", |
193 display_manager()->GetDisplayAt(0)->bounds().ToString()); | 190 display_manager()->GetDisplayAt(0)->bounds().ToString()); |
194 // Secondary display is on right. | 191 // Secondary display is on right. |
195 EXPECT_EQ("1000,0 600x400", | 192 EXPECT_EQ("1000,0 600x400", |
196 display_manager()->GetDisplayAt(1)->bounds().ToString()); | 193 display_manager()->GetDisplayAt(1)->bounds().ToString()); |
197 EXPECT_EQ("1000,1000 600x400", | 194 EXPECT_EQ("1000,1000 600x400", |
198 display_manager()->GetDisplayAt(1)->bounds_in_pixel().ToString()); | 195 display_manager()->GetDisplayAt(1)->bounds_in_pixel().ToString()); |
199 reset(); | 196 reset(); |
200 | |
201 aura::DisplayManager::set_use_fullscreen_host_window(false); | |
202 } | 197 } |
203 | 198 |
204 // Test in emulation mode (use_fullscreen_host_window=false) | 199 // Test in emulation mode (use_fullscreen_host_window=false) |
205 TEST_F(MultiDisplayManagerTest, MAYBE_EmulatorTest) { | 200 TEST_F(DisplayManagerTest, MAYBE_EmulatorTest) { |
206 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 201 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); |
207 | 202 |
208 MultiDisplayManager::CycleDisplay(); | 203 DisplayManager::CycleDisplay(); |
209 // Update primary and add seconary. | 204 // Update primary and add seconary. |
210 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); | 205 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); |
211 EXPECT_EQ("0 1 0", GetCountSummary()); | 206 EXPECT_EQ("0 1 0", GetCountSummary()); |
212 reset(); | 207 reset(); |
213 | 208 |
214 MultiDisplayManager::CycleDisplay(); | 209 DisplayManager::CycleDisplay(); |
215 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 210 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); |
216 EXPECT_EQ("0 0 1", GetCountSummary()); | 211 EXPECT_EQ("0 0 1", GetCountSummary()); |
217 reset(); | 212 reset(); |
218 | 213 |
219 MultiDisplayManager::CycleDisplay(); | 214 DisplayManager::CycleDisplay(); |
220 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); | 215 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); |
221 EXPECT_EQ("0 1 0", GetCountSummary()); | 216 EXPECT_EQ("0 1 0", GetCountSummary()); |
222 reset(); | 217 reset(); |
223 } | 218 } |
224 | 219 |
225 TEST_F(MultiDisplayManagerTest, MAYBE_OverscanInsetsTest) { | 220 TEST_F(DisplayManagerTest, MAYBE_OverscanInsetsTest) { |
226 UpdateDisplay("0+0-500x500,0+501-400x400"); | 221 UpdateDisplay("0+0-500x500,0+501-400x400"); |
227 reset(); | 222 reset(); |
228 ASSERT_EQ(2u, display_manager()->GetNumDisplays()); | 223 ASSERT_EQ(2u, display_manager()->GetNumDisplays()); |
229 gfx::Display display1(*display_manager()->GetDisplayAt(0)); | 224 gfx::Display display1(*display_manager()->GetDisplayAt(0)); |
230 gfx::Display display2(*display_manager()->GetDisplayAt(1)); | 225 gfx::Display display2(*display_manager()->GetDisplayAt(1)); |
231 | 226 |
232 display_manager()->SetOverscanInsets( | 227 display_manager()->SetOverscanInsets( |
233 display2.id(), gfx::Insets(13, 12, 11, 10)); | 228 display2.id(), gfx::Insets(13, 12, 11, 10)); |
234 std::vector<gfx::Display> changed_displays = changed(); | 229 std::vector<gfx::Display> changed_displays = changed(); |
235 EXPECT_EQ(1u, changed_displays.size()); | 230 EXPECT_EQ(1u, changed_displays.size()); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 UpdateDisplay("0+0-500x500,0+501-400x400*2"); | 267 UpdateDisplay("0+0-500x500,0+501-400x400*2"); |
273 display_manager()->SetOverscanInsets( | 268 display_manager()->SetOverscanInsets( |
274 display_manager()->GetDisplayAt(1)->id(), gfx::Insets(4, 5, 6, 7)); | 269 display_manager()->GetDisplayAt(1)->id(), gfx::Insets(4, 5, 6, 7)); |
275 EXPECT_EQ("0,0 500x500", | 270 EXPECT_EQ("0,0 500x500", |
276 display_manager()->GetDisplayAt(0)->bounds_in_pixel().ToString()); | 271 display_manager()->GetDisplayAt(0)->bounds_in_pixel().ToString()); |
277 EXPECT_EQ("10,509 376x380", | 272 EXPECT_EQ("10,509 376x380", |
278 display_manager()->GetDisplayAt(1)->bounds_in_pixel().ToString()); | 273 display_manager()->GetDisplayAt(1)->bounds_in_pixel().ToString()); |
279 EXPECT_EQ("188x190", display_manager()->GetDisplayAt(1)->size().ToString()); | 274 EXPECT_EQ("188x190", display_manager()->GetDisplayAt(1)->size().ToString()); |
280 } | 275 } |
281 | 276 |
282 TEST_F(MultiDisplayManagerTest, MAYBE_ZeroOverscanInsets) { | 277 TEST_F(DisplayManagerTest, MAYBE_ZeroOverscanInsets) { |
283 // Make sure the display change events is emitted for overscan inset changes. | 278 // Make sure the display change events is emitted for overscan inset changes. |
284 UpdateDisplay("0+0-500x500,0+501-400x400"); | 279 UpdateDisplay("0+0-500x500,0+501-400x400"); |
285 ASSERT_EQ(2u, display_manager()->GetNumDisplays()); | 280 ASSERT_EQ(2u, display_manager()->GetNumDisplays()); |
286 int64 display2_id = display_manager()->GetDisplayAt(1)->id(); | 281 int64 display2_id = display_manager()->GetDisplayAt(1)->id(); |
287 | 282 |
288 reset(); | 283 reset(); |
289 display_manager()->SetOverscanInsets(display2_id, gfx::Insets(0, 0, 0, 0)); | 284 display_manager()->SetOverscanInsets(display2_id, gfx::Insets(0, 0, 0, 0)); |
290 EXPECT_EQ(0u, changed().size()); | 285 EXPECT_EQ(0u, changed().size()); |
291 | 286 |
292 reset(); | 287 reset(); |
(...skipping 13 matching lines...) Expand all Loading... |
306 #define MAYBE_TestNativeDisplaysChanged TestNativeDisplaysChanged | 301 #define MAYBE_TestNativeDisplaysChanged TestNativeDisplaysChanged |
307 #define MAYBE_NativeDisplaysChangedAfterPrimaryChange \ | 302 #define MAYBE_NativeDisplaysChangedAfterPrimaryChange \ |
308 NativeDisplaysChangedAfterPrimaryChange | 303 NativeDisplaysChangedAfterPrimaryChange |
309 #else | 304 #else |
310 #define MAYBE_TestDeviceScaleOnlyChange DISABLED_TestDeviceScaleOnlyChange | 305 #define MAYBE_TestDeviceScaleOnlyChange DISABLED_TestDeviceScaleOnlyChange |
311 #define MAYBE_TestNativeDisplaysChanged DISABLED_TestNativeDisplaysChanged | 306 #define MAYBE_TestNativeDisplaysChanged DISABLED_TestNativeDisplaysChanged |
312 #define MAYBE_NativeDisplaysChangedAfterPrimaryChange \ | 307 #define MAYBE_NativeDisplaysChangedAfterPrimaryChange \ |
313 DISABLED_NativeDisplaysChangedAfterPrimaryChange | 308 DISABLED_NativeDisplaysChangedAfterPrimaryChange |
314 #endif | 309 #endif |
315 | 310 |
316 TEST_F(MultiDisplayManagerTest, MAYBE_TestDeviceScaleOnlyChange) { | 311 TEST_F(DisplayManagerTest, MAYBE_TestDeviceScaleOnlyChange) { |
317 aura::DisplayManager::set_use_fullscreen_host_window(true); | |
318 UpdateDisplay("1000x600"); | 312 UpdateDisplay("1000x600"); |
319 EXPECT_EQ(1, | 313 EXPECT_EQ(1, |
320 Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor()); | 314 Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor()); |
321 EXPECT_EQ("1000x600", | 315 EXPECT_EQ("1000x600", |
322 Shell::GetPrimaryRootWindow()->bounds().size().ToString()); | 316 Shell::GetPrimaryRootWindow()->bounds().size().ToString()); |
323 UpdateDisplay("1000x600*2"); | 317 UpdateDisplay("1000x600*2"); |
324 EXPECT_EQ(2, | 318 EXPECT_EQ(2, |
325 Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor()); | 319 Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor()); |
326 EXPECT_EQ("500x300", | 320 EXPECT_EQ("500x300", |
327 Shell::GetPrimaryRootWindow()->bounds().size().ToString()); | 321 Shell::GetPrimaryRootWindow()->bounds().size().ToString()); |
328 aura::DisplayManager::set_use_fullscreen_host_window(false); | |
329 } | 322 } |
330 | 323 |
331 TEST_F(MultiDisplayManagerTest, MAYBE_TestNativeDisplaysChanged) { | 324 TEST_F(DisplayManagerTest, MAYBE_TestNativeDisplaysChanged) { |
332 const int64 internal_display_id = | 325 const int64 internal_display_id = |
333 display_manager()->SetFirstDisplayAsInternalDisplayForTest(); | 326 display_manager()->SetFirstDisplayAsInternalDisplayForTest(); |
334 const gfx::Display native_display(internal_display_id, | 327 const gfx::Display native_display(internal_display_id, |
335 gfx::Rect(0, 0, 500, 500)); | 328 gfx::Rect(0, 0, 500, 500)); |
336 | 329 |
337 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 330 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); |
338 std::string default_bounds = | 331 std::string default_bounds = |
339 display_manager()->GetDisplayAt(0)->bounds().ToString(); | 332 display_manager()->GetDisplayAt(0)->bounds().ToString(); |
340 | 333 |
341 std::vector<gfx::Display> displays; | 334 std::vector<gfx::Display> displays; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 #define MAYBE_EnsurePointerInDisplays EnsurePointerInDisplays | 389 #define MAYBE_EnsurePointerInDisplays EnsurePointerInDisplays |
397 #define MAYBE_EnsurePointerInDisplays_2ndOnLeft \ | 390 #define MAYBE_EnsurePointerInDisplays_2ndOnLeft \ |
398 EnsurePointerInDisplays_2ndOnLeft | 391 EnsurePointerInDisplays_2ndOnLeft |
399 #else | 392 #else |
400 // TODO(oshima): Re-enable these tests on WinAura (http://crbug.com/158163). | 393 // TODO(oshima): Re-enable these tests on WinAura (http://crbug.com/158163). |
401 #define MAYBE_EnsurePointerInDisplays DISABLED_EnsurePointerInDisplays | 394 #define MAYBE_EnsurePointerInDisplays DISABLED_EnsurePointerInDisplays |
402 #define MAYBE_EnsurePointerInDisplays_2ndOnLeft \ | 395 #define MAYBE_EnsurePointerInDisplays_2ndOnLeft \ |
403 DISABLED_EnsurePointerInDisplays_2ndOnLeft | 396 DISABLED_EnsurePointerInDisplays_2ndOnLeft |
404 #endif | 397 #endif |
405 | 398 |
406 TEST_F(MultiDisplayManagerTest, MAYBE_EnsurePointerInDisplays) { | 399 TEST_F(DisplayManagerTest, MAYBE_EnsurePointerInDisplays) { |
407 UpdateDisplay("200x200,300x300"); | 400 UpdateDisplay("200x200,300x300"); |
408 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 401 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
409 | 402 |
410 aura::Env* env = aura::Env::GetInstance(); | 403 aura::Env* env = aura::Env::GetInstance(); |
411 | 404 |
412 // Set the initial position. | 405 // Set the initial position. |
413 root_windows[0]->MoveCursorTo(gfx::Point(350, 150)); | 406 root_windows[0]->MoveCursorTo(gfx::Point(350, 150)); |
414 EXPECT_EQ("350,150", env->last_mouse_location().ToString()); | 407 EXPECT_EQ("350,150", env->last_mouse_location().ToString()); |
415 | 408 |
416 // A mouse pointer will be inside 2nd display. | 409 // A mouse pointer will be inside 2nd display. |
(...skipping 17 matching lines...) Expand all Loading... |
434 | 427 |
435 // Move the mouse pointer to the bottom of 1st display. | 428 // Move the mouse pointer to the bottom of 1st display. |
436 root_windows[0]->MoveCursorTo(gfx::Point(150, 290)); | 429 root_windows[0]->MoveCursorTo(gfx::Point(150, 290)); |
437 EXPECT_EQ("150,290", env->last_mouse_location().ToString()); | 430 EXPECT_EQ("150,290", env->last_mouse_location().ToString()); |
438 | 431 |
439 // The mouse pointer is outside and closest display is 1st one. | 432 // The mouse pointer is outside and closest display is 1st one. |
440 UpdateDisplay("300x280,200x200"); | 433 UpdateDisplay("300x280,200x200"); |
441 EXPECT_EQ("150,140", env->last_mouse_location().ToString()); | 434 EXPECT_EQ("150,140", env->last_mouse_location().ToString()); |
442 } | 435 } |
443 | 436 |
444 TEST_F(MultiDisplayManagerTest, MAYBE_EnsurePointerInDisplays_2ndOnLeft) { | 437 TEST_F(DisplayManagerTest, MAYBE_EnsurePointerInDisplays_2ndOnLeft) { |
445 UpdateDisplay("200x200,300x300"); | 438 UpdateDisplay("200x200,300x300"); |
446 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 439 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
447 | 440 |
448 // Set the 2nd display on the left. | 441 // Set the 2nd display on the left. |
449 DisplayController* display_controller = | 442 DisplayController* display_controller = |
450 Shell::GetInstance()->display_controller(); | 443 Shell::GetInstance()->display_controller(); |
451 DisplayLayout layout = display_controller->default_display_layout(); | 444 DisplayLayout layout = display_controller->default_display_layout(); |
452 layout.position = DisplayLayout::LEFT; | 445 layout.position = DisplayLayout::LEFT; |
453 display_controller->SetDefaultDisplayLayout(layout); | 446 display_controller->SetDefaultDisplayLayout(layout); |
454 | 447 |
(...skipping 14 matching lines...) Expand all Loading... |
469 // center of 2nd display. | 462 // center of 2nd display. |
470 UpdateDisplay("300x300,200x100"); | 463 UpdateDisplay("300x300,200x100"); |
471 EXPECT_EQ("-100,50", env->last_mouse_location().ToString()); | 464 EXPECT_EQ("-100,50", env->last_mouse_location().ToString()); |
472 | 465 |
473 // 2nd display was disconnected. Mouse pointer should move to | 466 // 2nd display was disconnected. Mouse pointer should move to |
474 // 1st display. | 467 // 1st display. |
475 UpdateDisplay("300x300"); | 468 UpdateDisplay("300x300"); |
476 EXPECT_EQ("150,150", env->last_mouse_location().ToString()); | 469 EXPECT_EQ("150,150", env->last_mouse_location().ToString()); |
477 } | 470 } |
478 | 471 |
479 TEST_F(MultiDisplayManagerTest, MAYBE_NativeDisplaysChangedAfterPrimaryChange) { | 472 TEST_F(DisplayManagerTest, MAYBE_NativeDisplaysChangedAfterPrimaryChange) { |
480 const int64 internal_display_id = | 473 const int64 internal_display_id = |
481 display_manager()->SetFirstDisplayAsInternalDisplayForTest(); | 474 display_manager()->SetFirstDisplayAsInternalDisplayForTest(); |
482 const gfx::Display native_display(internal_display_id, | 475 const gfx::Display native_display(internal_display_id, |
483 gfx::Rect(0, 0, 500, 500)); | 476 gfx::Rect(0, 0, 500, 500)); |
484 const gfx::Display secondary_display(10, gfx::Rect(1, 1, 100, 100)); | 477 const gfx::Display secondary_display(10, gfx::Rect(1, 1, 100, 100)); |
485 | 478 |
486 std::vector<gfx::Display> displays; | 479 std::vector<gfx::Display> displays; |
487 displays.push_back(native_display); | 480 displays.push_back(native_display); |
488 displays.push_back(secondary_display); | 481 displays.push_back(secondary_display); |
489 display_manager()->OnNativeDisplaysChanged(displays); | 482 display_manager()->OnNativeDisplaysChanged(displays); |
(...skipping 11 matching lines...) Expand all Loading... |
501 // OnNativeDisplaysChanged may change the display bounds. Here makes sure | 494 // OnNativeDisplaysChanged may change the display bounds. Here makes sure |
502 // nothing changed if the exactly same displays are specified. | 495 // nothing changed if the exactly same displays are specified. |
503 display_manager()->OnNativeDisplaysChanged(displays); | 496 display_manager()->OnNativeDisplaysChanged(displays); |
504 EXPECT_EQ("-500,0 500x500", | 497 EXPECT_EQ("-500,0 500x500", |
505 FindDisplayForId(internal_display_id).bounds().ToString()); | 498 FindDisplayForId(internal_display_id).bounds().ToString()); |
506 EXPECT_EQ("0,0 100x100", FindDisplayForId(10).bounds().ToString()); | 499 EXPECT_EQ("0,0 100x100", FindDisplayForId(10).bounds().ToString()); |
507 } | 500 } |
508 | 501 |
509 } // namespace internal | 502 } // namespace internal |
510 } // namespace ash | 503 } // namespace ash |
OLD | NEW |