| 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/rotator/screen_rotation_animator.h" | 5 #include "ash/rotator/screen_rotation_animator.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/display/window_tree_host_manager.h" | 8 #include "ash/display/window_tree_host_manager.h" |
| 9 #include "ash/public/cpp/config.h" | 9 #include "ash/public/cpp/config.h" |
| 10 #include "ash/rotator/screen_rotation_animator_observer.h" | 10 #include "ash/rotator/screen_rotation_animator_observer.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 void ScreenRotationAnimatorSlowAnimationTest::SetUp() { | 156 void ScreenRotationAnimatorSlowAnimationTest::SetUp() { |
| 157 AshTestBase::SetUp(); | 157 AshTestBase::SetUp(); |
| 158 | 158 |
| 159 display_ = display::Screen::GetScreen()->GetPrimaryDisplay(); | 159 display_ = display::Screen::GetScreen()->GetPrimaryDisplay(); |
| 160 if (Shell::GetAshConfig() == Config::MASH) { | 160 if (Shell::GetAshConfig() == Config::MASH) { |
| 161 ASSERT_TRUE(ShellPort::Get()->GetDisplayInfo(display_id()).id() != | 161 ASSERT_TRUE(ShellPort::Get()->GetDisplayInfo(display_id()).id() != |
| 162 display_id()); | 162 display_id()); |
| 163 return; | 163 return; |
| 164 } | 164 } |
| 165 | 165 |
| 166 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 167 switches::kAshDisableSmoothScreenRotation); |
| 166 animator_ = base::MakeUnique<ScreenRotationAnimator>(display_.id()); | 168 animator_ = base::MakeUnique<ScreenRotationAnimator>(display_.id()); |
| 167 test_api_ = | 169 test_api_ = |
| 168 base::MakeUnique<test::ScreenRotationAnimatorTestApi>(animator_.get()); | 170 base::MakeUnique<test::ScreenRotationAnimatorTestApi>(animator_.get()); |
| 169 test_api()->DisableAnimationTimers(); | 171 test_api()->DisableAnimationTimers(); |
| 170 non_zero_duration_mode_ = | 172 non_zero_duration_mode_ = |
| 171 base::MakeUnique<ui::ScopedAnimationDurationScaleMode>( | 173 base::MakeUnique<ui::ScopedAnimationDurationScaleMode>( |
| 172 ui::ScopedAnimationDurationScaleMode::SLOW_DURATION); | 174 ui::ScopedAnimationDurationScaleMode::SLOW_DURATION); |
| 173 } | 175 } |
| 174 | 176 |
| 175 class ScreenRotationAnimatorSmoothAnimationTest : public test::AshTestBase { | 177 class ScreenRotationAnimatorSmoothAnimationTest : public test::AshTestBase { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 void ScreenRotationAnimatorSmoothAnimationTest::SetUp() { | 225 void ScreenRotationAnimatorSmoothAnimationTest::SetUp() { |
| 224 AshTestBase::SetUp(); | 226 AshTestBase::SetUp(); |
| 225 | 227 |
| 226 display_ = display::Screen::GetScreen()->GetPrimaryDisplay(); | 228 display_ = display::Screen::GetScreen()->GetPrimaryDisplay(); |
| 227 if (Shell::GetAshConfig() == Config::MASH) { | 229 if (Shell::GetAshConfig() == Config::MASH) { |
| 228 ASSERT_TRUE(ShellPort::Get()->GetDisplayInfo(display_id()).id() != | 230 ASSERT_TRUE(ShellPort::Get()->GetDisplayInfo(display_id()).id() != |
| 229 display_id()); | 231 display_id()); |
| 230 return; | 232 return; |
| 231 } | 233 } |
| 232 | 234 |
| 233 base::CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 234 switches::kAshEnableSmoothScreenRotation); | |
| 235 run_loop_ = base::MakeUnique<base::RunLoop>(); | 235 run_loop_ = base::MakeUnique<base::RunLoop>(); |
| 236 SetScreenRotationAnimator(display_.id(), run_loop_->QuitWhenIdleClosure(), | 236 SetScreenRotationAnimator(display_.id(), run_loop_->QuitWhenIdleClosure(), |
| 237 run_loop_->QuitWhenIdleClosure()); | 237 run_loop_->QuitWhenIdleClosure()); |
| 238 non_zero_duration_mode_ = | 238 non_zero_duration_mode_ = |
| 239 base::MakeUnique<ui::ScopedAnimationDurationScaleMode>( | 239 base::MakeUnique<ui::ScopedAnimationDurationScaleMode>( |
| 240 ui::ScopedAnimationDurationScaleMode::SLOW_DURATION); | 240 ui::ScopedAnimationDurationScaleMode::SLOW_DURATION); |
| 241 } | 241 } |
| 242 | 242 |
| 243 void ScreenRotationAnimatorSmoothAnimationTest::SetScreenRotationAnimator( | 243 void ScreenRotationAnimatorSmoothAnimationTest::SetScreenRotationAnimator( |
| 244 int64_t display_id, | 244 int64_t display_id, |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 SetDisplayRotation(display_manager()->GetDisplayAt(1).id(), | 534 SetDisplayRotation(display_manager()->GetDisplayAt(1).id(), |
| 535 display::Display::ROTATE_0); | 535 display::Display::ROTATE_0); |
| 536 animator()->Rotate(display::Display::ROTATE_90, | 536 animator()->Rotate(display::Display::ROTATE_90, |
| 537 display::Display::RotationSource::ROTATION_SOURCE_USER); | 537 display::Display::RotationSource::ROTATION_SOURCE_USER); |
| 538 WaitForCopyCallback(); | 538 WaitForCopyCallback(); |
| 539 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 539 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); |
| 540 EXPECT_EQ(secondary_display_id, display_manager()->GetDisplayAt(0).id()); | 540 EXPECT_EQ(secondary_display_id, display_manager()->GetDisplayAt(0).id()); |
| 541 } | 541 } |
| 542 | 542 |
| 543 } // namespace ash | 543 } // namespace ash |
| OLD | NEW |