| 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..466227a38f92fcb2d49177ea411b2a56e688e07d
|
| --- /dev/null
|
| +++ b/ui/base/animation/animation_container_test_helper.h
|
| @@ -0,0 +1,49 @@
|
| +// 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/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 UI_EXPORT AnimationContainerTestHelper {
|
| + public:
|
| + // Creates helper for given container. Container is now driven by this
|
| + // helper rather than by internal timer.
|
| + explicit AnimationContainerTestHelper(AnimationContainer* container);
|
| + virtual ~AnimationContainerTestHelper();
|
| +
|
| + // Advances AnimationContainer for |delta|.
|
| + void Forward(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 ForwardWhileRunning();
|
| +
|
| + // Calls Run method of Container without advancing time. Call this method once
|
| + // some animations were added to container so that any immediate animations
|
| + // get processed.
|
| + void Ping();
|
| +
|
| + private:
|
| + AnimationContainer* container_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(AnimationContainerTestHelper);
|
| +};
|
| +
|
| +} // namespace test
|
| +} // namespace ui
|
| +
|
| +#endif // UI_BASE_ANIMATION_ANIMATION_CONTAINER_TEST_HELPER_H_
|
|
|