Remove QuicConnectionPeer::GetVisitor(). The code is only used in test. And we should directly use the test session rather than the visitor interface in tests. gfe-relnote: n/a. test only. PiperOrigin-RevId: 277181966 Change-Id: I932cdca15d1fea8f51f58df453c43e66b20da073
diff --git a/quic/core/http/quic_server_session_base_test.cc b/quic/core/http/quic_server_session_base_test.cc index e9c1f9c..cd45c50 100644 --- a/quic/core/http/quic_server_session_base_test.cc +++ b/quic/core/http/quic_server_session_base_test.cc
@@ -154,7 +154,6 @@ session_->Initialize(); QuicSessionPeer::GetMutableCryptoStream(session_.get()) ->OnSuccessfulVersionNegotiation(supported_versions.front()); - visitor_ = QuicConnectionPeer::GetVisitor(connection_); QuicConfigPeer::SetReceivedInitialSessionFlowControlWindow( session_->config(), kMinimumFlowControlSendWindow); session_->OnConfigNegotiated(); @@ -208,7 +207,6 @@ QuicMemoryCacheBackend memory_cache_backend_; std::unique_ptr<TestServerSession> session_; std::unique_ptr<CryptoHandshakeMessage> handshake_message_; - QuicConnectionVisitorInterface* visitor_; }; // Compares CachedNetworkParameters. @@ -253,7 +251,7 @@ OnStreamReset(GetNthClientInitiatedBidirectionalId(0), QUIC_RST_ACKNOWLEDGEMENT)); } - visitor_->OnRstStream(rst1); + session_->OnRstStream(rst1); // For version-99 will create and receive a stop-sending, completing // the full-close expected by this test. @@ -263,7 +261,7 @@ EXPECT_EQ(0u, session_->GetNumOpenIncomingStreams()); // Send the same two bytes of payload in a new packet. - visitor_->OnStreamFrame(data1); + session_->OnStreamFrame(data1); // The stream should not be re-opened. EXPECT_EQ(0u, session_->GetNumOpenIncomingStreams()); @@ -284,7 +282,7 @@ OnStreamReset(GetNthClientInitiatedBidirectionalId(0), QUIC_RST_ACKNOWLEDGEMENT)); } - visitor_->OnRstStream(rst1); + session_->OnRstStream(rst1); // For version-99 will create and receive a stop-sending, completing // the full-close expected by this test. @@ -296,7 +294,7 @@ // Send two bytes of payload. QuicStreamFrame data1(GetNthClientInitiatedBidirectionalId(0), false, 0, QuicStringPiece("HT")); - visitor_->OnStreamFrame(data1); + session_->OnStreamFrame(data1); // The stream should never be opened, now that the reset is received. EXPECT_EQ(0u, session_->GetNumOpenIncomingStreams()); @@ -309,8 +307,8 @@ QuicStringPiece("\1\0\0\0\0\0\0\0HT")); QuicStreamFrame frame2(GetNthClientInitiatedBidirectionalId(1), false, 0, QuicStringPiece("\2\0\0\0\0\0\0\0HT")); - visitor_->OnStreamFrame(frame1); - visitor_->OnStreamFrame(frame2); + session_->OnStreamFrame(frame1); + session_->OnStreamFrame(frame2); EXPECT_EQ(2u, session_->GetNumOpenIncomingStreams()); // Send a reset (and expect the peer to send a RST in response). @@ -326,7 +324,7 @@ OnStreamReset(GetNthClientInitiatedBidirectionalId(0), QUIC_RST_ACKNOWLEDGEMENT)); } - visitor_->OnRstStream(rst); + session_->OnRstStream(rst); // For version-99 will create and receive a stop-sending, completing // the full-close expected by this test. @@ -340,8 +338,8 @@ QuicStringPiece("TP")); QuicStreamFrame frame4(GetNthClientInitiatedBidirectionalId(1), false, 2, QuicStringPiece("TP")); - visitor_->OnStreamFrame(frame3); - visitor_->OnStreamFrame(frame4); + session_->OnStreamFrame(frame3); + session_->OnStreamFrame(frame4); // The stream should never be opened, now that the reset is received. EXPECT_EQ(1u, session_->GetNumOpenIncomingStreams()); EXPECT_TRUE(connection_->connected());
diff --git a/quic/test_tools/quic_connection_peer.cc b/quic/test_tools/quic_connection_peer.cc index 6276b2e..f2f1f2f 100644 --- a/quic/test_tools/quic_connection_peer.cc +++ b/quic/test_tools/quic_connection_peer.cc
@@ -37,12 +37,6 @@ } // static -QuicConnectionVisitorInterface* QuicConnectionPeer::GetVisitor( - QuicConnection* connection) { - return connection->visitor_; -} - -// static QuicPacketCreator* QuicConnectionPeer::GetPacketCreator( QuicConnection* connection) { return QuicPacketGeneratorPeer::GetPacketCreator(
diff --git a/quic/test_tools/quic_connection_peer.h b/quic/test_tools/quic_connection_peer.h index a0e47ca..04d7826 100644 --- a/quic/test_tools/quic_connection_peer.h +++ b/quic/test_tools/quic_connection_peer.h
@@ -41,8 +41,6 @@ static void PopulateStopWaitingFrame(QuicConnection* connection, QuicStopWaitingFrame* stop_waiting); - static QuicConnectionVisitorInterface* GetVisitor(QuicConnection* connection); - static QuicPacketCreator* GetPacketCreator(QuicConnection* connection); static QuicPacketGenerator* GetPacketGenerator(QuicConnection* connection);
diff --git a/quic/tools/quic_simple_server_session_test.cc b/quic/tools/quic_simple_server_session_test.cc index a4bab0f..b127885 100644 --- a/quic/tools/quic_simple_server_session_test.cc +++ b/quic/tools/quic_simple_server_session_test.cc
@@ -230,7 +230,6 @@ session_->Initialize(); QuicSessionPeer::GetMutableCryptoStream(session_.get()) ->OnSuccessfulVersionNegotiation(supported_versions.front()); - visitor_ = QuicConnectionPeer::GetVisitor(connection_); if (VersionHasIetfQuicFrames(transport_version())) { EXPECT_CALL(*connection_, SendControlFrame(_)) @@ -284,7 +283,6 @@ QuicMemoryCacheBackend memory_cache_backend_; std::unique_ptr<MockQuicSimpleServerSession> session_; std::unique_ptr<CryptoHandshakeMessage> handshake_message_; - QuicConnectionVisitorInterface* visitor_; }; INSTANTIATE_TEST_SUITE_P(Tests, @@ -311,7 +309,7 @@ OnStreamReset(GetNthClientInitiatedBidirectionalId(0), QUIC_RST_ACKNOWLEDGEMENT)); } - visitor_->OnRstStream(rst1); + session_->OnRstStream(rst1); // Create and inject a STOP_SENDING frame. In GOOGLE QUIC, receiving a // RST_STREAM frame causes a two-way close. For IETF QUIC, RST_STREAM causes // a one-way close. @@ -320,7 +318,7 @@ EXPECT_EQ(0u, session_->GetNumOpenIncomingStreams()); // Send the same two bytes of payload in a new packet. - visitor_->OnStreamFrame(data1); + session_->OnStreamFrame(data1); // The stream should not be re-opened. EXPECT_EQ(0u, session_->GetNumOpenIncomingStreams()); @@ -340,7 +338,7 @@ OnStreamReset(GetNthClientInitiatedBidirectionalId(0), QUIC_RST_ACKNOWLEDGEMENT)); } - visitor_->OnRstStream(rst1); + session_->OnRstStream(rst1); // Create and inject a STOP_SENDING frame. In GOOGLE QUIC, receiving a // RST_STREAM frame causes a two-way close. For IETF QUIC, RST_STREAM causes // a one-way close. @@ -352,7 +350,7 @@ // Send two bytes of payload. QuicStreamFrame data1(GetNthClientInitiatedBidirectionalId(0), false, 0, QuicStringPiece("HT")); - visitor_->OnStreamFrame(data1); + session_->OnStreamFrame(data1); // The stream should never be opened, now that the reset is received. EXPECT_EQ(0u, session_->GetNumOpenIncomingStreams()); @@ -365,8 +363,8 @@ QuicStringPiece("\1\0\0\0\0\0\0\0HT")); QuicStreamFrame frame2(GetNthClientInitiatedBidirectionalId(1), false, 0, QuicStringPiece("\2\0\0\0\0\0\0\0HT")); - visitor_->OnStreamFrame(frame1); - visitor_->OnStreamFrame(frame2); + session_->OnStreamFrame(frame1); + session_->OnStreamFrame(frame2); EXPECT_EQ(2u, session_->GetNumOpenIncomingStreams()); // Send a reset (and expect the peer to send a RST in response). @@ -381,7 +379,7 @@ OnStreamReset(GetNthClientInitiatedBidirectionalId(0), QUIC_RST_ACKNOWLEDGEMENT)); } - visitor_->OnRstStream(rst); + session_->OnRstStream(rst); // Create and inject a STOP_SENDING frame. In GOOGLE QUIC, receiving a // RST_STREAM frame causes a two-way close. For IETF QUIC, RST_STREAM causes // a one-way close. @@ -395,8 +393,8 @@ QuicStringPiece("TP")); QuicStreamFrame frame4(GetNthClientInitiatedBidirectionalId(1), false, 2, QuicStringPiece("TP")); - visitor_->OnStreamFrame(frame3); - visitor_->OnStreamFrame(frame4); + session_->OnStreamFrame(frame3); + session_->OnStreamFrame(frame4); // The stream should never be opened, now that the reset is received. EXPECT_EQ(1u, session_->GetNumOpenIncomingStreams()); EXPECT_TRUE(connection_->connected()); @@ -600,8 +598,6 @@ } session_->OnConfigNegotiated(); - visitor_ = QuicConnectionPeer::GetVisitor(connection_); - if (!VersionUsesHttp3(connection_->transport_version())) { session_->UnregisterStreamPriority( QuicUtils::GetHeadersStreamId(connection_->transport_version()), @@ -844,7 +840,7 @@ .WillOnce(Invoke(&ClearControlFrame)); EXPECT_CALL(*connection_, OnStreamReset(stream_got_reset, QUIC_RST_ACKNOWLEDGEMENT)); - visitor_->OnRstStream(rst); + session_->OnRstStream(rst); // When the first 2 streams becomes draining, the two queued up stream could // be created. But since one of them was marked cancelled due to RST frame, @@ -969,7 +965,7 @@ session_->OnMaxStreamsFrame( QuicMaxStreamsFrame(0, num_resources + 3, /*unidirectional=*/true)); } - visitor_->OnRstStream(rst); + session_->OnRstStream(rst); // Create and inject a STOP_SENDING frame. In GOOGLE QUIC, receiving a // RST_STREAM frame causes a two-way close. For IETF QUIC, RST_STREAM causes // a one-way close.