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/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" |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 // suspend... | 383 // suspend... |
384 displays.clear(); | 384 displays.clear(); |
385 display_manager()->OnNativeDisplaysChanged(displays); | 385 display_manager()->OnNativeDisplaysChanged(displays); |
386 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); | 386 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); |
387 | 387 |
388 // and resume with different external display. | 388 // and resume with different external display. |
389 displays.push_back(native_display); | 389 displays.push_back(native_display); |
390 displays.push_back(gfx::Display(11, gfx::Rect(1, 1, 100, 100))); | 390 displays.push_back(gfx::Display(11, gfx::Rect(1, 1, 100, 100))); |
391 display_manager()->OnNativeDisplaysChanged(displays); | 391 display_manager()->OnNativeDisplaysChanged(displays); |
392 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); | 392 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); |
| 393 |
| 394 display_manager()->ResetInternalDisplayForTest(); |
393 } | 395 } |
394 | 396 |
395 #if defined(OS_WIN) | 397 #if defined(OS_WIN) |
396 // This test currently fails on Win8/Metro as it picks up the actual | 398 // This test currently fails on Win8/Metro as it picks up the actual |
397 // display size. http://crbug.com/154081 | 399 // display size. http://crbug.com/154081 |
398 #define MAYBE_TestNativeDisplaysChangedNoInternal \ | 400 #define MAYBE_TestNativeDisplaysChangedNoInternal \ |
399 DISABLED_TestNativeDisplaysChangedNoInternal | 401 DISABLED_TestNativeDisplaysChangedNoInternal |
400 #else | 402 #else |
401 #define MAYBE_TestNativeDisplaysChangedNoInternal \ | 403 #define MAYBE_TestNativeDisplaysChangedNoInternal \ |
402 TestNativeDisplaysChangedNoInternal | 404 TestNativeDisplaysChangedNoInternal |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 EXPECT_EQ("-500,0 500x500", | 517 EXPECT_EQ("-500,0 500x500", |
516 FindDisplayForId(internal_display_id).bounds().ToString()); | 518 FindDisplayForId(internal_display_id).bounds().ToString()); |
517 EXPECT_EQ("0,0 100x100", FindDisplayForId(10).bounds().ToString()); | 519 EXPECT_EQ("0,0 100x100", FindDisplayForId(10).bounds().ToString()); |
518 | 520 |
519 // OnNativeDisplaysChanged may change the display bounds. Here makes sure | 521 // OnNativeDisplaysChanged may change the display bounds. Here makes sure |
520 // nothing changed if the exactly same displays are specified. | 522 // nothing changed if the exactly same displays are specified. |
521 display_manager()->OnNativeDisplaysChanged(displays); | 523 display_manager()->OnNativeDisplaysChanged(displays); |
522 EXPECT_EQ("-500,0 500x500", | 524 EXPECT_EQ("-500,0 500x500", |
523 FindDisplayForId(internal_display_id).bounds().ToString()); | 525 FindDisplayForId(internal_display_id).bounds().ToString()); |
524 EXPECT_EQ("0,0 100x100", FindDisplayForId(10).bounds().ToString()); | 526 EXPECT_EQ("0,0 100x100", FindDisplayForId(10).bounds().ToString()); |
| 527 |
| 528 display_manager()->ResetInternalDisplayForTest(); |
525 } | 529 } |
526 | 530 |
527 TEST_F(DisplayManagerTest, AutomaticOverscanInsets) { | 531 TEST_F(DisplayManagerTest, AutomaticOverscanInsets) { |
528 UpdateDisplay("200x200,400x400"); | 532 UpdateDisplay("200x200,400x400"); |
529 | 533 |
530 std::vector<gfx::Display> displays; | 534 std::vector<gfx::Display> displays; |
531 displays.push_back(*display_manager()->GetDisplayAt(0)); | 535 displays.push_back(*display_manager()->GetDisplayAt(0)); |
532 displays.push_back(*display_manager()->GetDisplayAt(1)); | 536 displays.push_back(*display_manager()->GetDisplayAt(1)); |
533 int64 id = displays[1].id(); | 537 int64 id = displays[1].id(); |
534 display_manager()->SetHasOverscanFlagForTest(id, true); | 538 display_manager()->SetHasOverscanFlagForTest(id, true); |
(...skipping 12 matching lines...) Expand all Loading... |
547 // Do not overscan even though it has 'has_overscan' flag, if the custom | 551 // Do not overscan even though it has 'has_overscan' flag, if the custom |
548 // insets is empty. | 552 // insets is empty. |
549 display_manager()->SetOverscanInsets(id, gfx::Insets()); | 553 display_manager()->SetOverscanInsets(id, gfx::Insets()); |
550 display_manager()->OnNativeDisplaysChanged(displays); | 554 display_manager()->OnNativeDisplaysChanged(displays); |
551 EXPECT_EQ("1,201 400x400", | 555 EXPECT_EQ("1,201 400x400", |
552 display_manager()->GetDisplayAt(1)->bounds_in_pixel().ToString()); | 556 display_manager()->GetDisplayAt(1)->bounds_in_pixel().ToString()); |
553 } | 557 } |
554 | 558 |
555 } // namespace internal | 559 } // namespace internal |
556 } // namespace ash | 560 } // namespace ash |
OLD | NEW |