1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_COMPOSITOR_SCOPED_ANIMATION_DURATION_SCALE_MODE_H_
6 #define UI_COMPOSITOR_SCOPED_ANIMATION_DURATION_SCALE_MODE_H_
8 #include "base/basictypes.h"
9 #include "ui/compositor/compositor_export.h"
13 // Speed up or slow down animations for testing or debugging.
14 class COMPOSITOR_EXPORT ScopedAnimationDurationScaleMode
{
16 enum DurationScaleMode
{
20 // A very short but guaranteed non-zero duration for individual tests that
21 // need to assert things about animations after creating them.
23 // Animations complete immediately after being created. Used by most tests.
27 explicit ScopedAnimationDurationScaleMode(
28 DurationScaleMode scoped_duration_scale_mode
)
29 : old_duration_scale_mode_(duration_scale_mode_
) {
30 duration_scale_mode_
= scoped_duration_scale_mode
;
33 ~ScopedAnimationDurationScaleMode() {
34 duration_scale_mode_
= old_duration_scale_mode_
;
37 static DurationScaleMode
duration_scale_mode() {
38 return duration_scale_mode_
;
42 DurationScaleMode old_duration_scale_mode_
;
44 static DurationScaleMode duration_scale_mode_
;
46 DISALLOW_COPY_AND_ASSIGN(ScopedAnimationDurationScaleMode
);
51 #endif // UI_COMPOSITOR_SCOPED_ANIMATION_DURATION_SCALE_MODE_H