Source release 19.4.0
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
namespace wvutil {
|
||||
|
||||
class TestSleep {
|
||||
@@ -67,13 +69,18 @@ class TestSleep {
|
||||
static bool real_sleep() { return real_sleep_; }
|
||||
|
||||
// The callback is notified whenever sleep is called.
|
||||
static void set_callback(CallBack* callback) { callback_ = callback; }
|
||||
static void AddCallback(CallBack* callback) {
|
||||
callbacks_.insert(callback);
|
||||
}
|
||||
static void RemoveCallback(CallBack* callback) {
|
||||
callbacks_.erase(callback);
|
||||
}
|
||||
|
||||
private:
|
||||
// Controls if the test sleep should use real sleep.
|
||||
static bool real_sleep_;
|
||||
// Called when the clock should advance.
|
||||
static CallBack* callback_;
|
||||
static std::unordered_set<CallBack*> callbacks_;
|
||||
// The sum of all calls to RollBackSystemTime. Kept so we can undo all changes
|
||||
// at the end of a test.
|
||||
static int total_clock_rollback_seconds_;
|
||||
|
||||
Reference in New Issue
Block a user