summaryrefslogtreecommitdiffstats
path: root/base/test
diff options
context:
space:
mode:
Diffstat (limited to 'base/test')
-rw-r--r--base/test/simple_test_clock.cc5
-rw-r--r--base/test/simple_test_clock.h8
-rw-r--r--base/test/simple_test_tick_clock.h5
3 files changed, 12 insertions, 6 deletions
diff --git a/base/test/simple_test_clock.cc b/base/test/simple_test_clock.cc
index 3bd6080..a2bdc2a 100644
--- a/base/test/simple_test_clock.cc
+++ b/base/test/simple_test_clock.cc
@@ -20,4 +20,9 @@ void SimpleTestClock::Advance(TimeDelta delta) {
now_ += delta;
}
+void SimpleTestClock::SetNow(Time now) {
+ AutoLock lock(lock_);
+ now_ = now;
+}
+
} // namespace base
diff --git a/base/test/simple_test_clock.h b/base/test/simple_test_clock.h
index a83312f..f96dabf 100644
--- a/base/test/simple_test_clock.h
+++ b/base/test/simple_test_clock.h
@@ -13,7 +13,7 @@
namespace base {
// SimpleTestClock is a Clock implementation that gives control over
-// the returned Time objects. All methods can be called from any
+// the returned Time objects. All methods may be called from any
// thread.
class SimpleTestClock : public Clock {
public:
@@ -23,10 +23,12 @@ class SimpleTestClock : public Clock {
virtual Time Now() OVERRIDE;
- // Sets the current time forward by |delta|. Safe to call from any
- // thread.
+ // Advances the clock by |delta|.
void Advance(TimeDelta delta);
+ // Sets the clock to the given time.
+ void SetNow(Time now);
+
private:
// Protects |now_|.
Lock lock_;
diff --git a/base/test/simple_test_tick_clock.h b/base/test/simple_test_tick_clock.h
index c53301b..2809774 100644
--- a/base/test/simple_test_tick_clock.h
+++ b/base/test/simple_test_tick_clock.h
@@ -13,7 +13,7 @@
namespace base {
// SimpleTestTickClock is a TickClock implementation that gives
-// control over the returned TimeTicks objects. All methods can be
+// control over the returned TimeTicks objects. All methods may be
// called from any thread.
class SimpleTestTickClock : public TickClock {
public:
@@ -23,8 +23,7 @@ class SimpleTestTickClock : public TickClock {
virtual TimeTicks NowTicks() OVERRIDE;
- // Sets the current time forward by |delta|. Safe to call from any
- // thread.
+ // Advances the clock by |delta|, which must not be negative.
void Advance(TimeDelta delta);
private: