| Index: net/url_request/url_request_throttler_simulation_unittest.cc
|
| diff --git a/net/url_request/url_request_throttler_simulation_unittest.cc b/net/url_request/url_request_throttler_simulation_unittest.cc
|
| index 39991595f56d4b8d16c37a24af5b723d38e61c7f..80734ae29cc66582f587ea6b18fd86ffdca3e8d6 100644
|
| --- a/net/url_request/url_request_throttler_simulation_unittest.cc
|
| +++ b/net/url_request/url_request_throttler_simulation_unittest.cc
|
| @@ -303,31 +303,26 @@ class MockURLRequestThrottlerEntry : public URLRequestThrottlerEntry {
|
| public:
|
| explicit MockURLRequestThrottlerEntry(URLRequestThrottlerManager* manager)
|
| : URLRequestThrottlerEntry(manager, std::string()),
|
| - mock_backoff_entry_(&backoff_policy_) {}
|
| + backoff_entry_(&backoff_policy_, &fake_clock_) {}
|
|
|
| const BackoffEntry* GetBackoffEntry() const override {
|
| - return &mock_backoff_entry_;
|
| + return &backoff_entry_;
|
| }
|
|
|
| - BackoffEntry* GetBackoffEntry() override { return &mock_backoff_entry_; }
|
| + BackoffEntry* GetBackoffEntry() override { return &backoff_entry_; }
|
|
|
| - TimeTicks ImplGetTimeNow() const override { return fake_now_; }
|
| + TimeTicks ImplGetTimeNow() const override { return fake_clock_.NowTicks(); }
|
|
|
| void SetFakeNow(const TimeTicks& fake_time) {
|
| - fake_now_ = fake_time;
|
| - mock_backoff_entry_.set_fake_now(fake_time);
|
| - }
|
| -
|
| - TimeTicks fake_now() const {
|
| - return fake_now_;
|
| + fake_clock_.set_now(fake_time);
|
| }
|
|
|
| protected:
|
| ~MockURLRequestThrottlerEntry() override {}
|
|
|
| private:
|
| - TimeTicks fake_now_;
|
| - MockBackoffEntry mock_backoff_entry_;
|
| + mutable TestTickClock fake_clock_;
|
| + BackoffEntry backoff_entry_;
|
| };
|
|
|
| // Registry of results for a class of |Requester| objects (e.g. attackers vs.
|
| @@ -426,7 +421,7 @@ class Requester : public DiscreteTimeSimulation::Actor {
|
| effective_delay += current_jitter;
|
| }
|
|
|
| - if (throttler_entry_->fake_now() - time_of_last_attempt_ >
|
| + if (throttler_entry_->ImplGetTimeNow() - time_of_last_attempt_ >
|
| effective_delay) {
|
| if (!throttler_entry_->ShouldRejectRequest(
|
| server_->mock_request(),
|
| @@ -441,10 +436,10 @@ class Requester : public DiscreteTimeSimulation::Actor {
|
|
|
| if (last_attempt_was_failure_) {
|
| last_downtime_duration_ =
|
| - throttler_entry_->fake_now() - time_of_last_success_;
|
| + throttler_entry_->ImplGetTimeNow() - time_of_last_success_;
|
| }
|
|
|
| - time_of_last_success_ = throttler_entry_->fake_now();
|
| + time_of_last_success_ = throttler_entry_->ImplGetTimeNow();
|
| last_attempt_was_failure_ = false;
|
| } else {
|
| if (results_)
|
| @@ -457,7 +452,7 @@ class Requester : public DiscreteTimeSimulation::Actor {
|
| last_attempt_was_failure_ = true;
|
| }
|
|
|
| - time_of_last_attempt_ = throttler_entry_->fake_now();
|
| + time_of_last_attempt_ = throttler_entry_->ImplGetTimeNow();
|
| }
|
| }
|
|
|
|
|