OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/desktop_background/desktop_background_controller.h" | 5 #include "ash/desktop_background/desktop_background_controller.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <cstdlib> | 8 #include <cstdlib> |
9 | 9 |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 // Steps a widget's layer animation until it is completed. Animations must be | 47 // Steps a widget's layer animation until it is completed. Animations must be |
48 // enabled. | 48 // enabled. |
49 void RunAnimationForWidget(views::Widget* widget) { | 49 void RunAnimationForWidget(views::Widget* widget) { |
50 // Animations must be enabled for stepping to work. | 50 // Animations must be enabled for stepping to work. |
51 ASSERT_NE(ui::ScopedAnimationDurationScaleMode::duration_scale_mode(), | 51 ASSERT_NE(ui::ScopedAnimationDurationScaleMode::duration_scale_mode(), |
52 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); | 52 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); |
53 | 53 |
54 ui::Layer* layer = widget->GetNativeView()->layer(); | 54 ui::Layer* layer = widget->GetNativeView()->layer(); |
55 ui::LayerAnimatorTestController controller(layer->GetAnimator()); | 55 ui::LayerAnimatorTestController controller(layer->GetAnimator()); |
| 56 gfx::AnimationContainerElement* element = layer->GetAnimator(); |
56 // Multiple steps are required to complete complex animations. | 57 // Multiple steps are required to complete complex animations. |
57 // TODO(vollick): This should not be necessary. crbug.com/154017 | 58 // TODO(vollick): This should not be necessary. crbug.com/154017 |
58 while (controller.animator()->is_animating()) { | 59 while (controller.animator()->is_animating()) { |
59 controller.StartThreadedAnimationsIfNeeded(); | 60 controller.StartThreadedAnimationsIfNeeded(); |
60 base::TimeTicks step_time = controller.animator()->last_step_time(); | 61 base::TimeTicks step_time = controller.animator()->last_step_time(); |
61 layer->GetAnimator()->Step(step_time + | 62 element->Step(step_time + base::TimeDelta::FromMilliseconds(1000)); |
62 base::TimeDelta::FromMilliseconds(1000)); | |
63 } | 63 } |
64 } | 64 } |
65 | 65 |
66 } // namespace | 66 } // namespace |
67 | 67 |
68 class DesktopBackgroundControllerTest : public test::AshTestBase { | 68 class DesktopBackgroundControllerTest : public test::AshTestBase { |
69 public: | 69 public: |
70 DesktopBackgroundControllerTest() | 70 DesktopBackgroundControllerTest() |
71 : controller_(NULL) { | 71 : controller_(NULL) { |
72 } | 72 } |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 | 342 |
343 // Maximum width and height belongs to different displays. | 343 // Maximum width and height belongs to different displays. |
344 UpdateDisplay("400x300,100x500"); | 344 UpdateDisplay("400x300,100x500"); |
345 EXPECT_EQ( | 345 EXPECT_EQ( |
346 "400x500", | 346 "400x500", |
347 DesktopBackgroundController::GetMaxDisplaySizeInNative().ToString()); | 347 DesktopBackgroundController::GetMaxDisplaySizeInNative().ToString()); |
348 } | 348 } |
349 | 349 |
350 | 350 |
351 } // namespace ash | 351 } // namespace ash |
OLD | NEW |