Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Unified Diff: ui/base/animation/animation_container_test_helper.cc

Issue 11453012: Fix black background when locking with fullscreen window: (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Mock TimeTicks::Now() Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/base/animation/animation_container_test_helper.cc
diff --git a/ui/base/animation/animation_container_test_helper.cc b/ui/base/animation/animation_container_test_helper.cc
new file mode 100644
index 0000000000000000000000000000000000000000..673e97cc1467e91eaab961d949b0c805f587933f
--- /dev/null
+++ b/ui/base/animation/animation_container_test_helper.cc
@@ -0,0 +1,40 @@
+// 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.
+
+#include "ui/base/animation/animation_container_test_helper.h"
+
+using base::TimeDelta;
+using base::TimeTicks;
+
+namespace ui {
+namespace test {
+
+AnimationContainerTestHelper::AnimationContainerTestHelper(
+ AnimationContainer* container)
+ : container_(container),
+ time_controller_(new base::test::ScopedTimeController()) {
+}
+
+void AnimationContainerTestHelper::Advance(TimeDelta delta) {
+ time_controller_->Advance(delta);
+ if (IsAnimating())
+ container_->Run();
+}
+
+void AnimationContainerTestHelper::Ping() {
+ if (IsAnimating())
+ container_->Run();
+}
+
+void AnimationContainerTestHelper::AdvanceWhileRunning() {
+ while (IsAnimating())
+ Advance(TimeDelta::FromSeconds(1));
+}
+
+bool AnimationContainerTestHelper::IsAnimating() {
+ return container_->timer_.IsRunning();
+}
+
+} // namespace test
+} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698