extension_throttle_test_support.h 923 B

123456789101112131415161718192021222324252627282930313233
  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. #ifndef EXTENSIONS_RENDERER_EXTENSION_THROTTLE_TEST_SUPPORT_H_
  5. #define EXTENSIONS_RENDERER_EXTENSION_THROTTLE_TEST_SUPPORT_H_
  6. #include "base/time/tick_clock.h"
  7. #include "base/time/time.h"
  8. #include "net/base/backoff_entry.h"
  9. namespace extensions {
  10. class TestTickClock : public base::TickClock {
  11. public:
  12. TestTickClock();
  13. explicit TestTickClock(base::TimeTicks now);
  14. TestTickClock(const TestTickClock&) = delete;
  15. TestTickClock& operator=(const TestTickClock&) = delete;
  16. ~TestTickClock() override;
  17. base::TimeTicks NowTicks() const override;
  18. void set_now(base::TimeTicks now) { now_ticks_ = now; }
  19. private:
  20. base::TimeTicks now_ticks_;
  21. };
  22. } // namespace extensions
  23. #endif // EXTENSIONS_RENDERER_EXTENSION_THROTTLE_TEST_SUPPORT_H_