src/net/third_party/quiche/src/quic/core/quic_dispatcher_test.cc
// Tests that when dispatcher's packet buffer is full, a CHLO on connection
// which doesn't have buffered CHLO should be buffered.
Tests that when dispatcher's packet buffer is full, a CHLO on connection
which doesn't have buffered CHLO should be buffered.
Tests that when dispatcher ' s packet buffer is full a CHLO on connection which doesn ' t have buffered CHLO should be buffered .
TEST_P(BufferedPacketStoreTest, ReceiveCHLOForBufferedConnection) {
  QuicBufferedPacketStore* store =
      QuicDispatcherPeer::GetBufferedPackets(dispatcher_.get());
  uint64_t conn_id = 1;
  ProcessPacket(client_addr_, TestConnectionId(conn_id), true, "data packet",
                CONNECTION_ID_PRESENT, PACKET_4BYTE_PACKET_NUMBER,
                1);
  for (conn_id = 2;
       conn_id <= kDefaultMaxConnectionsInStore + kMaxNumSessionsToCreate;
       ++conn_id) {
    if (conn_id <= kMaxNumSessionsToCreate + 1) {
      EXPECT_CALL(*dispatcher_,
                  CreateQuicSession(TestConnectionId(conn_id), client_addr_,
                                    quiche::QuicheStringPiece(), _))
          .WillOnce(Return(ByMove(CreateSession(
              dispatcher_.get(), config_, TestConnectionId(conn_id),
              client_addr_, &mock_helper_, &mock_alarm_factory_,
              &crypto_config_, QuicDispatcherPeer::GetCache(dispatcher_.get()),
              &session1_))));
      EXPECT_CALL(
          *reinterpret_cast<MockQuicConnection*>(session1_->connection()),
          ProcessUdpPacket(_, _, _))
          .WillOnce(WithArg<2>(
              Invoke([this, conn_id](const QuicEncryptedPacket& packet) {
                ValidatePacket(TestConnectionId(conn_id), packet);
              })));
    }
    ProcessPacket(client_addr_, TestConnectionId(conn_id), true,
                  SerializeFullCHLO());
  }
  EXPECT_FALSE(store->HasChloForConnection(
      TestConnectionId(1)));
  ProcessPacket(client_addr_, TestConnectionId(1),
                true, SerializeFullCHLO());
  EXPECT_TRUE(store->HasChloForConnection(
      TestConnectionId(1)));
}
TEST_P ( BufferedPacketStoreTest , ReceiveCHLOForBufferedConnection ) { QuicBufferedPacketStore * store = QuicDispatcherPeer :: GetBufferedPackets ( dispatcher_ . get ( ) ) ; uint64_t conn_id = 1 ; ProcessPacket ( client_addr_ , TestConnectionId ( conn_id ) , true , " " , CONNECTION_ID_PRESENT , PACKET_4BYTE_PACKET_NUMBER , 1 ) ; for ( conn_id = 2 ; conn_id <= kDefaultMaxConnectionsInStore + kMaxNumSessionsToCreate ; ++ conn_id ) { if ( conn_id <= kMaxNumSessionsToCreate + 1 ) { EXPECT_CALL ( * dispatcher_ , CreateQuicSession ( TestConnectionId ( conn_id ) , client_addr_ , quiche :: QuicheStringPiece ( ) , _ ) ) . WillOnce ( Return ( ByMove ( CreateSession ( dispatcher_ . get ( ) , config_ , TestConnectionId ( conn_id ) , client_addr_ , & mock_helper_ , & mock_alarm_factory_ , & crypto_config_ , QuicDispatcherPeer :: GetCache ( dispatcher_ . get ( ) ) , & session1_ ) ) ) ) ; EXPECT_CALL ( * reinterpret_cast < MockQuicConnection * > ( session1_ -> connection ( ) ) , ProcessUdpPacket ( _ , _ , _ ) ) . WillOnce ( WithArg < 2 > ( Invoke ( [ this , conn_id ] ( const QuicEncryptedPacket & packet ) { ValidatePacket ( TestConnectionId ( conn_id ) , packet ) ; } ) ) ) ; } ProcessPacket ( client_addr_ , TestConnectionId ( conn_id ) , true , SerializeFullCHLO ( ) ) ; } EXPECT_FALSE ( store -> HasChloForConnection ( TestConnectionId ( 1 ) ) ) ; ProcessPacket ( client_addr_ , TestConnectionId ( 1 ) , true , SerializeFullCHLO ( ) ) ; EXPECT_TRUE ( store -> HasChloForConnection ( TestConnectionId ( 1 ) ) ) ; }
Tests that when dispatcher's packet buffer is full, a CHLO on connection
which doesn't have buffered CHLO should be buffered.
Tests that when dispatcher ' s packet buffer is full a CHLO on connection which doesn ' t have buffered CHLO should be buffered .
/*packet_number=*/ // Fill packet buffer to full with CHLOs on other connections. Need to feed // extra CHLOs because the first |kMaxNumSessionsToCreate| are going to create // session directly. /*connection_id=*/ // CHLO on connection 1 should still be buffered. /*server_connection_id=*/ /*connection_id=*/