| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/public/cpp/config.h" | 5 #include "ash/public/cpp/config.h" |
| 6 #include "ash/rotator/screen_rotation_animator.h" | 6 #include "ash/rotator/screen_rotation_animator.h" |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
| 9 #include "ash/test/display_configuration_controller_test_api.h" | 9 #include "ash/test/display_configuration_controller_test_api.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "ui/display/manager/display_manager.h" | 11 #include "ui/display/manager/display_manager.h" |
| 12 | 12 |
| 13 namespace ash { | 13 namespace ash { |
| 14 | 14 |
| 15 using DisplayConfigurationControllerTest = test::AshTestBase; | 15 using DisplayConfigurationControllerTest = test::AshTestBase; |
| 16 | 16 |
| 17 TEST_F(DisplayConfigurationControllerTest, OnlyHasOneAnimator) { | 17 TEST_F(DisplayConfigurationControllerTest, OnlyHasOneAnimator) { |
| 18 // TODO(wutao): needs display_configuration_controller | 18 // TODO(wutao): needs display_configuration_controller |
| 19 // http://crbug.com/686839. | 19 // http://crbug.com/686839. |
| 20 if (Shell::GetAshConfig() == Config::MASH) | 20 if (Shell::GetAshConfig() == Config::MASH) |
| 21 return; | 21 return; |
| 22 | 22 |
| 23 display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay(); | 23 display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay(); |
| 24 test::DisplayConfigurationControllerTestApi testapi( | 24 test::DisplayConfigurationControllerTestApi testapi( |
| 25 Shell::Get()->display_configuration_controller()); | 25 Shell::Get()->display_configuration_controller()); |
| 26 ScreenRotationAnimator* screen_rotation_animator = | 26 ScreenRotationAnimator* old_screen_rotation_animator = |
| 27 testapi.GetScreenRotationAnimatorForDisplay(display.id()); | 27 testapi.GetScreenRotationAnimatorForDisplay(display.id()); |
| 28 EXPECT_EQ(1, testapi.DisplayScreenRotationAnimatorMapSize()); | |
| 29 | 28 |
| 30 Shell::Get()->display_manager()->SetDisplayRotation( | 29 Shell::Get()->display_manager()->SetDisplayRotation( |
| 31 display.id(), display::Display::ROTATE_0, | 30 display.id(), display::Display::ROTATE_0, |
| 32 display::Display::RotationSource::ROTATION_SOURCE_USER); | 31 display::Display::RotationSource::ROTATION_SOURCE_USER); |
| 33 screen_rotation_animator->Rotate( | 32 old_screen_rotation_animator->Rotate( |
| 34 display::Display::ROTATE_90, | 33 display::Display::ROTATE_90, |
| 35 display::Display::RotationSource::ROTATION_SOURCE_USER); | 34 display::Display::RotationSource::ROTATION_SOURCE_USER); |
| 36 EXPECT_EQ(1, testapi.DisplayScreenRotationAnimatorMapSize()); | |
| 37 | 35 |
| 38 screen_rotation_animator = | 36 ScreenRotationAnimator* new_screen_rotation_animator = |
| 39 testapi.GetScreenRotationAnimatorForDisplay(display.id()); | 37 testapi.GetScreenRotationAnimatorForDisplay(display.id()); |
| 40 screen_rotation_animator->Rotate( | 38 new_screen_rotation_animator->Rotate( |
| 41 display::Display::ROTATE_180, | 39 display::Display::ROTATE_180, |
| 42 display::Display::RotationSource::ROTATION_SOURCE_USER); | 40 display::Display::RotationSource::ROTATION_SOURCE_USER); |
| 43 EXPECT_EQ(1, testapi.DisplayScreenRotationAnimatorMapSize()); | 41 EXPECT_EQ(old_screen_rotation_animator, new_screen_rotation_animator); |
| 44 } | 42 } |
| 45 | 43 |
| 46 } // namespace ash | 44 } // namespace ash |
| OLD | NEW |