39 using Duration = RetryTestHooks::Duration;
40 using TimePoint = RetryTestHooks::TimePoint;
43 hooks_.now = [
this]() {
return now_; };
44 hooks_.sleep_for = [
this](Duration duration) {
45 sleep_durations_.push_back(duration);
48 hooks_.jitter = [
this](int32_t base_delay_ms) {
49 observed_base_delays_ms_.push_back(base_delay_ms);
50 return base_delay_ms + jitter_offset_ms_;
54 void Advance(Duration duration) { now_ += duration; }
56 void SetJitterOffsetMs(int32_t jitter_offset_ms) {
57 jitter_offset_ms_ = jitter_offset_ms;
62 const std::vector<Duration>& sleep_durations()
const {
return sleep_durations_; }
64 const std::vector<int32_t>& observed_base_delays_ms()
const {
65 return observed_base_delays_ms_;
71 int32_t jitter_offset_ms_ = 0;
72 std::vector<Duration> sleep_durations_;
73 std::vector<int32_t> observed_base_delays_ms_;