| 97 | } |
| 98 | |
| 99 | TEST(GcsThrottleDisabledTest, Disabled) { |
| 100 | TestTime time; |
| 101 | GcsThrottle throttle(&time); |
| 102 | ASSERT_FALSE(throttle.is_enabled()); // Verify throttle is disabled. |
| 103 | |
| 104 | EXPECT_EQ(0, throttle.available_tokens()); |
| 105 | time.AdvanceSeconds(1); |
| 106 | EXPECT_EQ(100000, throttle.available_tokens()); |
| 107 | EXPECT_TRUE(throttle.AdmitRequest()); |
| 108 | EXPECT_EQ(99900, throttle.available_tokens()); |
| 109 | time.AdvanceSeconds(1); |
| 110 | EXPECT_EQ(199900, throttle.available_tokens()); |
| 111 | throttle.RecordResponse(128000000); // 128 MB response. |
| 112 | EXPECT_LT(0, throttle.available_tokens()); |
| 113 | // Admit request even without available tokens |
| 114 | EXPECT_TRUE(throttle.AdmitRequest()); |
| 115 | } |
| 116 | |
| 117 | } // namespace |
| 118 |
nothing calls this directly
no test coverage detected