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

Unified Diff: base/test/scoped_time_controller.cc

Issue 11453012: Fix black background when locking with fullscreen window: (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rename undo/stop to cancel 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.cc
diff --git a/base/test/scoped_time_controller.cc b/base/test/scoped_time_controller.cc
new file mode 100644
index 0000000000000000000000000000000000000000..32aba03f9c40a68788990a2854c7e3e001b47ecd
--- /dev/null
+++ b/base/test/scoped_time_controller.cc
@@ -0,0 +1,37 @@
+// 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 "base/logging.h"
+#include "base/test/scoped_time_controller.h"
+
+namespace base {
+namespace test {
+
+ScopedTimeController::ScopedTimeController()
+ : current_time_(Time::Now()),
+ current_timeticks_(TimeTicks::Now()) {
+ replaced_instance_ = TimeFactory::instance_;
+ TimeFactory::instance_ = this;
+}
+
+ScopedTimeController::~ScopedTimeController() {
+ TimeFactory::instance_ = replaced_instance_;
+}
+
+void ScopedTimeController::Advance(base::TimeDelta delta) {
+ DCHECK(delta >= base::TimeDelta());
+ current_time_ += delta;
+ current_timeticks_ += delta;
+}
+
+Time ScopedTimeController::TimeNow() {
+ return current_time_;
+}
+
+TimeTicks ScopedTimeController::TimeTicksNow() {
+ return current_timeticks_;
+}
+
+} // namespace base
brettw 2012/12/13 21:39:16 Flip the order of these two lines :)
+} // namespace test

Powered by Google App Engine
This is Rietveld 408576698