src/net/quic/quic_client_session_cache_unittests.cc
// When the size limit is exceeded, the oldest entry should be erased.
When the size limit is exceeded, the oldest entry should be erased.
When the size limit is exceeded the oldest entry should be erased .
TEST_F(QuicClientSessionCacheTest, SizeLimit) {
  QuicClientSessionCache cache(2);
  std::unique_ptr<quic::QuicResumptionState> state1 =
      std::make_unique<quic::QuicResumptionState>();
  state1->application_state.push_back('a');
  state1->tls_session = NewSSLSession();
  quic::QuicServerId id1("a.com", 443);
  std::unique_ptr<quic::QuicResumptionState> state2 =
      std::make_unique<quic::QuicResumptionState>();
  state2->application_state.push_back('b');
  state2->tls_session = NewSSLSession();
  quic::QuicServerId id2("b.com", 443);
  std::unique_ptr<quic::QuicResumptionState> state3 =
      std::make_unique<quic::QuicResumptionState>();
  state3->application_state.push_back('c');
  state3->tls_session = NewSSLSession();
  quic::QuicServerId id3("c.com", 443);
  cache.Insert(id1, std::move(state1));
  cache.Insert(id2, std::move(state2));
  cache.Insert(id3, std::move(state3));
  EXPECT_EQ(2u, cache.size());
  EXPECT_EQ('b', cache.Lookup(id2, ssl_ctx_.get())->application_state.front());
  EXPECT_EQ('c', cache.Lookup(id3, ssl_ctx_.get())->application_state.front());
  EXPECT_EQ(nullptr, cache.Lookup(id1, ssl_ctx_.get()));
}
TEST_F ( QuicClientSessionCacheTest , SizeLimit ) { QuicClientSessionCache cache ( 2 ) ; std :: unique_ptr < quic :: QuicResumptionState > state1 = std :: make_unique < quic :: QuicResumptionState > ( ) ; state1 -> application_state . push_back ( ' ' ) ; state1 -> tls_session = NewSSLSession ( ) ; quic :: QuicServerId id1 ( " " , 443 ) ; std :: unique_ptr < quic :: QuicResumptionState > state2 = std :: make_unique < quic :: QuicResumptionState > ( ) ; state2 -> application_state . push_back ( ' ' ) ; state2 -> tls_session = NewSSLSession ( ) ; quic :: QuicServerId id2 ( " " , 443 ) ; std :: unique_ptr < quic :: QuicResumptionState > state3 = std :: make_unique < quic :: QuicResumptionState > ( ) ; state3 -> application_state . push_back ( ' ' ) ; state3 -> tls_session = NewSSLSession ( ) ; quic :: QuicServerId id3 ( " " , 443 ) ; cache . Insert ( id1 , std :: move ( state1 ) ) ; cache . Insert ( id2 , std :: move ( state2 ) ) ; cache . Insert ( id3 , std :: move ( state3 ) ) ; EXPECT_EQ ( 2u , cache . size ( ) ) ; EXPECT_EQ ( ' ' , cache . Lookup ( id2 , ssl_ctx_ . get ( ) ) -> application_state . front ( ) ) ; EXPECT_EQ ( ' ' , cache . Lookup ( id3 , ssl_ctx_ . get ( ) ) -> application_state . front ( ) ) ; EXPECT_EQ ( nullptr , cache . Lookup ( id1 , ssl_ctx_ . get ( ) ) ) ; }
When the size limit is exceeded, the oldest entry should be erased.
When the size limit is exceeded the oldest entry should be erased .