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

Side by Side Diff: base/test/mock_time_provider.cc

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « base/test/mock_time_provider.h ('k') | base/test/test_suite.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/logging.h"
6 #include "base/test/mock_time_provider.h"
7
8 using ::testing::DefaultValue;
9
10 namespace base {
11
12 MockTimeProvider* MockTimeProvider::instance_ = NULL;
13
14 MockTimeProvider::MockTimeProvider() {
15 DCHECK(!instance_) << "Only one instance of MockTimeProvider can exist";
16 DCHECK(!DefaultValue<Time>::IsSet());
17 instance_ = this;
18 DefaultValue<Time>::Set(Time::FromInternalValue(0));
19 }
20
21 MockTimeProvider::~MockTimeProvider() {
22 instance_ = NULL;
23 DefaultValue<Time>::Clear();
24 }
25
26 // static
27 Time MockTimeProvider::StaticNow() {
28 return instance_->Now();
29 }
30
31 } // namespace base
OLDNEW
« no previous file with comments | « base/test/mock_time_provider.h ('k') | base/test/test_suite.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698