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/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/display/display_layout_store.h" | 8 #include "ash/display/display_layout_store.h" |
9 #include "ash/screen_ash.h" | 9 #include "ash/screen_ash.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 display_manager()->SetOverscanInsets(display2_id, gfx::Insets(0, 0, 0, 0)); | 379 display_manager()->SetOverscanInsets(display2_id, gfx::Insets(0, 0, 0, 0)); |
380 EXPECT_EQ(1u, changed().size()); | 380 EXPECT_EQ(1u, changed().size()); |
381 EXPECT_EQ(display2_id, changed()[0].id()); | 381 EXPECT_EQ(display2_id, changed()[0].id()); |
382 } | 382 } |
383 | 383 |
384 TEST_F(DisplayManagerTest, TestDeviceScaleOnlyChange) { | 384 TEST_F(DisplayManagerTest, TestDeviceScaleOnlyChange) { |
385 if (!SupportsHostWindowResize()) | 385 if (!SupportsHostWindowResize()) |
386 return; | 386 return; |
387 | 387 |
388 UpdateDisplay("1000x600"); | 388 UpdateDisplay("1000x600"); |
389 EXPECT_EQ(1, | 389 aura::WindowEventDispatcher* dispatcher = |
390 Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor()); | 390 Shell::GetPrimaryRootWindow()->GetDispatcher(); |
| 391 EXPECT_EQ(1, dispatcher->compositor()->device_scale_factor()); |
391 EXPECT_EQ("1000x600", | 392 EXPECT_EQ("1000x600", |
392 Shell::GetPrimaryRootWindow()->bounds().size().ToString()); | 393 Shell::GetPrimaryRootWindow()->bounds().size().ToString()); |
393 UpdateDisplay("1000x600*2"); | 394 UpdateDisplay("1000x600*2"); |
394 EXPECT_EQ(2, | 395 EXPECT_EQ(2, dispatcher->compositor()->device_scale_factor()); |
395 Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor()); | |
396 EXPECT_EQ("500x300", | 396 EXPECT_EQ("500x300", |
397 Shell::GetPrimaryRootWindow()->bounds().size().ToString()); | 397 Shell::GetPrimaryRootWindow()->bounds().size().ToString()); |
398 } | 398 } |
399 | 399 |
400 DisplayInfo CreateDisplayInfo(int64 id, const gfx::Rect& bounds) { | 400 DisplayInfo CreateDisplayInfo(int64 id, const gfx::Rect& bounds) { |
401 DisplayInfo info(id, ToDisplayName(id), false); | 401 DisplayInfo info(id, ToDisplayName(id), false); |
402 info.SetBounds(bounds); | 402 info.SetBounds(bounds); |
403 return info; | 403 return info; |
404 } | 404 } |
405 | 405 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 587 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); |
588 | 588 |
589 // Connect another display which will become primary. | 589 // Connect another display which will become primary. |
590 const DisplayInfo external_display_info = | 590 const DisplayInfo external_display_info = |
591 CreateDisplayInfo(10, gfx::Rect(1, 1, 100, 100)); | 591 CreateDisplayInfo(10, gfx::Rect(1, 1, 100, 100)); |
592 display_info_list.push_back(external_display_info); | 592 display_info_list.push_back(external_display_info); |
593 display_manager()->OnNativeDisplaysChanged(display_info_list); | 593 display_manager()->OnNativeDisplaysChanged(display_info_list); |
594 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 594 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); |
595 EXPECT_EQ("1,1 100x100", | 595 EXPECT_EQ("1,1 100x100", |
596 GetDisplayInfoForId(10).bounds_in_native().ToString()); | 596 GetDisplayInfoForId(10).bounds_in_native().ToString()); |
597 EXPECT_EQ("100x100", | 597 EXPECT_EQ("100x100", ash::Shell::GetPrimaryRootWindow()->GetDispatcher()-> |
598 ash::Shell::GetPrimaryRootWindow()->GetHostSize().ToString()); | 598 GetHostSize().ToString()); |
599 } | 599 } |
600 | 600 |
601 #if defined(OS_WIN) | 601 #if defined(OS_WIN) |
602 // Tests that rely on the actual host size/location does not work on windows. | 602 // Tests that rely on the actual host size/location does not work on windows. |
603 #define MAYBE_EnsurePointerInDisplays DISABLED_EnsurePointerInDisplays | 603 #define MAYBE_EnsurePointerInDisplays DISABLED_EnsurePointerInDisplays |
604 #define MAYBE_EnsurePointerInDisplays_2ndOnLeft DISABLED_EnsurePointerInDisplays
_2ndOnLeft | 604 #define MAYBE_EnsurePointerInDisplays_2ndOnLeft DISABLED_EnsurePointerInDisplays
_2ndOnLeft |
605 #else | 605 #else |
606 #define MAYBE_EnsurePointerInDisplays EnsurePointerInDisplays | 606 #define MAYBE_EnsurePointerInDisplays EnsurePointerInDisplays |
607 #define MAYBE_EnsurePointerInDisplays_2ndOnLeft EnsurePointerInDisplays_2ndOnLef
t | 607 #define MAYBE_EnsurePointerInDisplays_2ndOnLeft EnsurePointerInDisplays_2ndOnLef
t |
608 #endif | 608 #endif |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 UpdateDisplay("100+200-100x200,300+500-200x300"); | 1115 UpdateDisplay("100+200-100x200,300+500-200x300"); |
1116 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); | 1116 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); |
1117 EXPECT_EQ("100,200", root_windows[0]->GetHostOrigin().ToString()); | 1117 EXPECT_EQ("100,200", root_windows[0]->GetHostOrigin().ToString()); |
1118 EXPECT_EQ("100x200", root_windows[0]->GetHostSize().ToString()); | 1118 EXPECT_EQ("100x200", root_windows[0]->GetHostSize().ToString()); |
1119 EXPECT_EQ("300,500", root_windows[1]->GetHostOrigin().ToString()); | 1119 EXPECT_EQ("300,500", root_windows[1]->GetHostOrigin().ToString()); |
1120 EXPECT_EQ("200x300", root_windows[1]->GetHostSize().ToString()); | 1120 EXPECT_EQ("200x300", root_windows[1]->GetHostSize().ToString()); |
1121 } | 1121 } |
1122 | 1122 |
1123 } // namespace internal | 1123 } // namespace internal |
1124 } // namespace ash | 1124 } // namespace ash |
OLD | NEW |