OLD | NEW |
(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/test/scoped_time_controller.h" |
| 6 |
| 7 namespace base { |
| 8 namespace test { |
| 9 |
| 10 ScopedTimeController::ScopedTimeController() { |
| 11 replaced_instance_ = TimeFactory::instance_; |
| 12 TimeFactory::instance_ = this; |
| 13 } |
| 14 |
| 15 ScopedTimeController::~ScopedTimeController() { |
| 16 TimeFactory::instance_ = replaced_instance_; |
| 17 } |
| 18 |
| 19 void ScopedTimeController::Advance(base::TimeDelta delta) { |
| 20 current_time_ += delta; |
| 21 current_timeticks_ += delta; |
| 22 } |
| 23 |
| 24 Time ScopedTimeController::TimeNow() { |
| 25 return current_time_; |
| 26 } |
| 27 |
| 28 TimeTicks ScopedTimeController::TimeTicksNow() { |
| 29 return current_timeticks_; |
| 30 } |
| 31 |
| 32 TimeTicks ScopedTimeController::TimeTicksHighResNow() { |
| 33 return current_timeticks_; |
| 34 } |
| 35 |
| 36 } // namespace base |
| 37 } // namespace test |
OLD | NEW |