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

Unified Diff: base/mock_time_provider.cc

Issue 7232023: Added last_modified field to TemplateURL and database. Updated unit tests, including refactoring ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Initial upload. Created 9 years, 6 months 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/mock_time_provider.cc
===================================================================
--- base/mock_time_provider.cc (revision 0)
+++ base/mock_time_provider.cc (revision 0)
@@ -0,0 +1,31 @@
+// 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/mock_time_provider.h"
+
+using ::testing::DefaultValue;
+
+namespace base {
+
+MockTimeProvider* MockTimeProvider::instance_ = NULL;
+
+MockTimeProvider::MockTimeProvider() {
+ DCHECK(!instance_) << "Only one instance of MockTimeProvider can exist";
+ DCHECK(!DefaultValue<Time>::IsSet());
+ instance_ = this;
+ DefaultValue<Time>::Set(Time::FromInternalValue(0));
+}
+
+MockTimeProvider::~MockTimeProvider() {
+ instance_ = NULL;
+ DefaultValue<Time>::Clear();
+}
+
+// static
+Time MockTimeProvider::StaticNow() {
+ return instance_->Now();
+}
+
+} // namespace
Property changes on: base\mock_time_provider.cc
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698