Chromium Code Reviews| Index: net/base/backoff_entry_unittest.cc |
| diff --git a/net/base/backoff_entry_unittest.cc b/net/base/backoff_entry_unittest.cc |
| index 9a9f4cfca0a232024182784f87d5d4a9b19f579a..c2bfc943d80b153a7be56690d1496d0839f5f05e 100644 |
| --- a/net/base/backoff_entry_unittest.cc |
| +++ b/net/base/backoff_entry_unittest.cc |
| @@ -293,4 +293,19 @@ TEST(BackoffEntryTest, RetainCustomHorizonWhenInitialErrorsIgnored) { |
| EXPECT_EQ(custom_horizon, custom.GetReleaseTime()); |
| } |
| +TEST(BackoffEntryTest, OverflowProtection) { |
| + TestBackoffEntry custom(&base_policy); |
| + |
| + // Trigger enough failures such that more than 11 bits of exponent are used |
| + // to represent the exponential backoff intermediate values. |
|
cbentzel
2014/06/14 15:16:07
Could you use a different policy for this test wit
Nicolas Zea
2014/06/16 20:27:25
Done.
|
| + for (size_t i = 0; i < (1 << 11); ++i) { |
| + custom.set_now(custom.ImplGetTimeNow() + custom.GetTimeUntilRelease()); |
| + custom.InformOfRequest(false); |
| + EXPECT_TRUE(custom.ShouldRejectRequest()); |
| + } |
| + |
| + // Max delay should still be respected. |
| + EXPECT_EQ(20000, custom.GetTimeUntilRelease().InMilliseconds()); |
| +} |
| + |
| } // namespace |