Chromium Code Reviews| 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" |
| 11 #include "ash/rotator/test/screen_rotation_animator_test_api.h" | 11 #include "ash/rotator/test/screen_rotation_animator_test_api.h" |
| 12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "ash/shell_port.h" | 13 #include "ash/shell_port.h" |
| 14 #include "ash/test/ash_test_base.h" | 14 #include "ash/test/ash_test_base.h" |
| 15 #include "ash/test/ash_test_helper.h" | |
| 15 #include "base/callback_forward.h" | 16 #include "base/callback_forward.h" |
| 16 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 17 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
| 18 #include "base/run_loop.h" | 19 #include "base/run_loop.h" |
| 19 #include "cc/output/copy_output_request.h" | 20 #include "cc/output/copy_output_request.h" |
| 20 #include "cc/output/copy_output_result.h" | 21 #include "cc/output/copy_output_result.h" |
| 21 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 22 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
| 22 #include "ui/display/display.h" | 23 #include "ui/display/display.h" |
| 23 #include "ui/display/manager/display_manager.h" | 24 #include "ui/display/manager/display_manager.h" |
| 24 #include "ui/display/screen.h" | 25 #include "ui/display/screen.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 UpdateDisplay(specs); | 216 UpdateDisplay(specs); |
| 216 QuitWaitForCopyCallback(); | 217 QuitWaitForCopyCallback(); |
| 217 } | 218 } |
| 218 | 219 |
| 219 void ScreenRotationAnimatorSmoothAnimationTest::QuitWaitForCopyCallback() { | 220 void ScreenRotationAnimatorSmoothAnimationTest::QuitWaitForCopyCallback() { |
| 220 run_loop_->QuitWhenIdle(); | 221 run_loop_->QuitWhenIdle(); |
| 221 } | 222 } |
| 222 | 223 |
| 223 void ScreenRotationAnimatorSmoothAnimationTest::SetUp() { | 224 void ScreenRotationAnimatorSmoothAnimationTest::SetUp() { |
| 224 AshTestBase::SetUp(); | 225 AshTestBase::SetUp(); |
| 226 ash_test_helper()->reset_commandline(); | |
|
oshima
2017/04/25 23:36:01
Since resetting itself doesn't change the value ob
wutao
2017/04/26 01:05:34
Comments added.
| |
| 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 |