net/nqe/observation_buffer_unittest.cc
// Verify that the buffer size is never exceeded.
Verify that the buffer size is never exceeded.
Verify that the buffer size is never exceeded .
TEST(NetworkQualityObservationBufferTest, BoundedBuffer) {
  std::map<std::string, std::string> variation_params;
  NetworkQualityEstimatorParams params(variation_params);
  base::SimpleTestTickClock tick_clock;
  tick_clock.Advance(base::TimeDelta::FromMinutes(1));
  ObservationBuffer observation_buffer(&params, &tick_clock, 1.0, 1.0);
  const base::TimeTicks now =
      base::TimeTicks() + base::TimeDelta::FromSeconds(1);
  for (int i = 1; i <= 1000; ++i) {
    observation_buffer.AddObservation(
        Observation(i, now, INT32_MIN, NETWORK_QUALITY_OBSERVATION_SOURCE_TCP));
    EXPECT_GE(300u, observation_buffer.Size());
  }
}
TEST ( NetworkQualityObservationBufferTest , BoundedBuffer ) { std :: map < std :: string , std :: string > variation_params ; NetworkQualityEstimatorParams params ( variation_params ) ; base :: SimpleTestTickClock tick_clock ; tick_clock . Advance ( base :: TimeDelta :: FromMinutes ( 1 ) ) ; ObservationBuffer observation_buffer ( & params , & tick_clock , 1.0 , 1.0 ) ; const base :: TimeTicks now = base :: TimeTicks ( ) + base :: TimeDelta :: FromSeconds ( 1 ) ; for ( int i = 1 ; i <= 1000 ; ++ i ) { observation_buffer . AddObservation ( Observation ( i , now , INT32_MIN , NETWORK_QUALITY_OBSERVATION_SOURCE_TCP ) ) ; EXPECT_GE ( 300u , observation_buffer . Size ( ) ) ; } }
Verify that the buffer size is never exceeded.
Verify that the buffer size is never exceeded .
// The number of entries should be at most the maximum buffer size.