| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/screen_orientation_controller_chromeos.h" | 5 #include "ash/display/screen_orientation_controller_chromeos.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/common/ash_switches.h" | 10 #include "ash/common/ash_switches.h" |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 } | 601 } |
| 602 | 602 |
| 603 // Tests that when MaximizeMode is triggered before the internal display is | 603 // Tests that when MaximizeMode is triggered before the internal display is |
| 604 // ready, that ScreenOrientationController still begins listening to events, | 604 // ready, that ScreenOrientationController still begins listening to events, |
| 605 // which require an internal display to be acted upon. | 605 // which require an internal display to be acted upon. |
| 606 TEST_F(ScreenOrientationControllerTest, InternalDisplayNotAvailableAtStartup) { | 606 TEST_F(ScreenOrientationControllerTest, InternalDisplayNotAvailableAtStartup) { |
| 607 display::test::DisplayManagerTestApi(display_manager()) | 607 display::test::DisplayManagerTestApi(display_manager()) |
| 608 .SetFirstDisplayAsInternalDisplay(); | 608 .SetFirstDisplayAsInternalDisplay(); |
| 609 | 609 |
| 610 int64_t internal_display_id = display::Display::InternalDisplayId(); | 610 int64_t internal_display_id = display::Display::InternalDisplayId(); |
| 611 display::Display::SetInternalDisplayId(display::Display::kInvalidDisplayID); | 611 display::Display::SetInternalDisplayId(display::kInvalidDisplayId); |
| 612 | 612 |
| 613 EnableMaximizeMode(true); | 613 EnableMaximizeMode(true); |
| 614 | 614 |
| 615 // Should not crash, even though there is no internal display. | 615 // Should not crash, even though there is no internal display. |
| 616 SetDisplayRotationById(internal_display_id, display::Display::ROTATE_180); | 616 SetDisplayRotationById(internal_display_id, display::Display::ROTATE_180); |
| 617 EXPECT_FALSE(RotationLocked()); | 617 EXPECT_FALSE(RotationLocked()); |
| 618 | 618 |
| 619 // Should not crash, even though the invalid display id is requested. | 619 // Should not crash, even though the invalid display id is requested. |
| 620 SetDisplayRotationById(display::Display::kInvalidDisplayID, | 620 SetDisplayRotationById(display::kInvalidDisplayId, |
| 621 display::Display::ROTATE_180); | 621 display::Display::ROTATE_180); |
| 622 EXPECT_FALSE(RotationLocked()); | 622 EXPECT_FALSE(RotationLocked()); |
| 623 | 623 |
| 624 // With an internal display now available, functionality should resume. | 624 // With an internal display now available, functionality should resume. |
| 625 display::Display::SetInternalDisplayId(internal_display_id); | 625 display::Display::SetInternalDisplayId(internal_display_id); |
| 626 SetInternalDisplayRotation(display::Display::ROTATE_90); | 626 SetInternalDisplayRotation(display::Display::ROTATE_90); |
| 627 EXPECT_TRUE(RotationLocked()); | 627 EXPECT_TRUE(RotationLocked()); |
| 628 } | 628 } |
| 629 | 629 |
| 630 // Verifies rotating an inactive Display is successful. | 630 // Verifies rotating an inactive Display is successful. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 660 | 660 |
| 661 Shell::GetInstance()->screen_orientation_controller()->SetDisplayRotation( | 661 Shell::GetInstance()->screen_orientation_controller()->SetDisplayRotation( |
| 662 kNewRotation, display::Display::ROTATION_SOURCE_ACTIVE); | 662 kNewRotation, display::Display::ROTATION_SOURCE_ACTIVE); |
| 663 | 663 |
| 664 EXPECT_EQ(kNewRotation, display_manager() | 664 EXPECT_EQ(kNewRotation, display_manager() |
| 665 ->GetDisplayInfo(kInternalDisplayId) | 665 ->GetDisplayInfo(kInternalDisplayId) |
| 666 .GetActiveRotation()); | 666 .GetActiveRotation()); |
| 667 } | 667 } |
| 668 | 668 |
| 669 } // namespace ash | 669 } // namespace ash |
| OLD | NEW |