| 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/ash_switches.h" | 5 #include "ash/ash_switches.h" | 
| 6 #include "ash/content/display/screen_orientation_controller_chromeos.h" | 6 #include "ash/content/display/screen_orientation_controller_chromeos.h" | 
| 7 #include "ash/display/display_info.h" | 7 #include "ash/display/display_info.h" | 
| 8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 582   delegate()->Unlock(content.get()); | 582   delegate()->Unlock(content.get()); | 
| 583 | 583 | 
| 584   SetRotationLocked(true); | 584   SetRotationLocked(true); | 
| 585   EXPECT_TRUE(RotationLocked()); | 585   EXPECT_TRUE(RotationLocked()); | 
| 586   EXPECT_EQ(gfx::Display::ROTATE_0, Rotation()); | 586   EXPECT_EQ(gfx::Display::ROTATE_0, Rotation()); | 
| 587 | 587 | 
| 588   TriggerLidUpdate(gfx::Vector3dF(0.0f, kMeanGravity, 0.0f)); | 588   TriggerLidUpdate(gfx::Vector3dF(0.0f, kMeanGravity, 0.0f)); | 
| 589   EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); | 589   EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); | 
| 590 } | 590 } | 
| 591 | 591 | 
|  | 592 // Tests that when MaximizeMode is triggered before the internal display is | 
|  | 593 // ready, that ScreenOrientationController still begins listening to events, | 
|  | 594 // which require an internal display to be acted upon. | 
|  | 595 TEST_F(ScreenOrientationControllerTest, InternalDisplayNotAvailableAtStartup) { | 
|  | 596   int64 internal_display_id = gfx::Display::InternalDisplayId(); | 
|  | 597   gfx::Display::SetInternalDisplayId(gfx::Display::kInvalidDisplayID); | 
|  | 598 | 
|  | 599   EnableMaximizeMode(true); | 
|  | 600 | 
|  | 601   // Should not crash, even thought there is no internal display. | 
|  | 602   SetInternalDisplayRotation(gfx::Display::ROTATE_180); | 
|  | 603   EXPECT_FALSE(RotationLocked()); | 
|  | 604 | 
|  | 605   // With an internal display now available, functionality should resume. | 
|  | 606   gfx::Display::SetInternalDisplayId(internal_display_id); | 
|  | 607   SetInternalDisplayRotation(gfx::Display::ROTATE_90); | 
|  | 608   EXPECT_TRUE(RotationLocked()); | 
|  | 609 } | 
|  | 610 | 
| 592 }  // namespace ash | 611 }  // namespace ash | 
| OLD | NEW | 
|---|