| Index: ui/base/animation/animation_container_test_helper.h
|
| diff --git a/ui/base/animation/animation_container_test_helper.h b/ui/base/animation/animation_container_test_helper.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8d1d987be4c295e89679c17e64b43a37f219f9ea
|
| --- /dev/null
|
| +++ b/ui/base/animation/animation_container_test_helper.h
|
| @@ -0,0 +1,48 @@
|
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef UI_BASE_ANIMATION_ANIMATION_CONTAINER_TEST_HELPER_H_
|
| +#define UI_BASE_ANIMATION_ANIMATION_CONTAINER_TEST_HELPER_H_
|
| +
|
| +#include "base/test/scoped_time_controller.h"
|
| +#include "base/time.h"
|
| +#include "ui/base/animation/animation_container.h"
|
| +#include "ui/base/ui_export.h"
|
| +
|
| +namespace ui {
|
| +namespace test {
|
| +
|
| +// This class can be used in tests for fine control over animations.
|
| +
|
| +class AnimationContainerTestHelper {
|
| + public:
|
| + // Creates helper for given container. Container is now driven by this
|
| + // helper rather than by internal timer.
|
| + explicit AnimationContainerTestHelper(AnimationContainer* container);
|
| +
|
| + ~AnimationContainerTestHelper();
|
| +
|
| + // Advances AnimationContainer for |delta|.
|
| + void Advance(base::TimeDelta delta);
|
| +
|
| + // Returns if AnimationContainer is animating.
|
| + bool IsAnimating();
|
| +
|
| + // Forwards in large steps (1 second) while there are any animations running.
|
| + // Use it before deleting Helper to avoid negative time delta in animations
|
| + // once timer gets cleaned up.
|
| + void AdvanceUntilDone();
|
| +
|
| + private:
|
| + AnimationContainer* container_;
|
| +
|
| + base::test::ScopedTimeController time_controller_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(AnimationContainerTestHelper);
|
| +};
|
| +
|
| +} // namespace test
|
| +} // namespace ui
|
| +
|
| +#endif // UI_BASE_ANIMATION_ANIMATION_CONTAINER_TEST_HELPER_H_
|
|
|