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

Unified Diff: base/test/scoped_time_controller.h

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: base/test/scoped_time_controller.h
diff --git a/base/test/scoped_time_controller.h b/base/test/scoped_time_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..211dbd73dcf7daee2f2fb3391dde8b3d270ba921
--- /dev/null
+++ b/base/test/scoped_time_controller.h
@@ -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.
+
+#ifndef BASE_TEST_SCOPED_TIME_CONTROLLER_H_
+#define BASE_TEST_SCOPED_TIME_CONTROLLER_H_
+
+#include "base/time.h"
+
+namespace base {
+namespace test {
+
+// Sets itself as a TimeFactory construction, and restores the previous one
+// on destruction.
+class BASE_EXPORT ScopedTimeController : public base::TimeFactory {
+ public:
+ ScopedTimeController();
+ ~ScopedTimeController();
Daniel Erat 2012/12/10 23:56:52 nit: need 'virtual' here
Denis Kuznetsov (DE-MUC) 2012/12/11 13:27:57 Done.
+
+ // Advances inner time for |delta|.
+ void Advance(base::TimeDelta delta);
+
+ // TimeFactory overrides
+ virtual base::Time TimeNow();
+ virtual base::TimeTicks TimeTicksNow();
+ virtual base::TimeTicks TimeTicksHighResNow();
+
+ private:
+ base::TimeTicks current_timeticks_;
+ base::Time current_time_;
+
+ base::TimeFactory* replaced_instance_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedTimeController);
+};
+
+} // namespace test
+} // namespace base
+
+#endif // BASE_TEST_SCOPED_TIME_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698