| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/quic/quic_connection.h" | 5 #include "net/quic/quic_connection.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <ostream> | 9 #include <ostream> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 5024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5035 // result in multiple attempts to close the connection - it will be marked as | 5035 // result in multiple attempts to close the connection - it will be marked as |
| 5036 // disconnected after the first call. | 5036 // disconnected after the first call. |
| 5037 EXPECT_CALL(visitor_, OnConnectionClosed(_, _, _)).Times(1); | 5037 EXPECT_CALL(visitor_, OnConnectionClosed(_, _, _)).Times(1); |
| 5038 connection_.CloseConnection(QUIC_NO_ERROR, "no reason", | 5038 connection_.CloseConnection(QUIC_NO_ERROR, "no reason", |
| 5039 ConnectionCloseBehavior::SILENT_CLOSE); | 5039 ConnectionCloseBehavior::SILENT_CLOSE); |
| 5040 connection_.CloseConnection(QUIC_NO_ERROR, "no reason", | 5040 connection_.CloseConnection(QUIC_NO_ERROR, "no reason", |
| 5041 ConnectionCloseBehavior::SILENT_CLOSE); | 5041 ConnectionCloseBehavior::SILENT_CLOSE); |
| 5042 } | 5042 } |
| 5043 | 5043 |
| 5044 TEST_P(QuicConnectionTest, ServerReceivesChloOnNonCryptoStream) { | 5044 TEST_P(QuicConnectionTest, ServerReceivesChloOnNonCryptoStream) { |
| 5045 FLAGS_quic_detect_memory_corrpution = true; | |
| 5046 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 5045 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
| 5047 | 5046 |
| 5048 set_perspective(Perspective::IS_SERVER); | 5047 set_perspective(Perspective::IS_SERVER); |
| 5049 QuicPacketCreatorPeer::SetSendVersionInPacket(creator_, false); | 5048 QuicPacketCreatorPeer::SetSendVersionInPacket(creator_, false); |
| 5050 | 5049 |
| 5051 CryptoHandshakeMessage message; | 5050 CryptoHandshakeMessage message; |
| 5052 CryptoFramer framer; | 5051 CryptoFramer framer; |
| 5053 message.set_tag(kCHLO); | 5052 message.set_tag(kCHLO); |
| 5054 std::unique_ptr<QuicData> data(framer.ConstructHandshakeMessage(message)); | 5053 std::unique_ptr<QuicData> data(framer.ConstructHandshakeMessage(message)); |
| 5055 frame1_.stream_id = 10; | 5054 frame1_.stream_id = 10; |
| 5056 frame1_.data_buffer = data->data(); | 5055 frame1_.data_buffer = data->data(); |
| 5057 frame1_.data_length = data->length(); | 5056 frame1_.data_length = data->length(); |
| 5058 | 5057 |
| 5059 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_MAYBE_CORRUPTED_MEMORY, _, | 5058 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_MAYBE_CORRUPTED_MEMORY, _, |
| 5060 ConnectionCloseSource::FROM_SELF)); | 5059 ConnectionCloseSource::FROM_SELF)); |
| 5061 ProcessFramePacket(QuicFrame(&frame1_)); | 5060 ProcessFramePacket(QuicFrame(&frame1_)); |
| 5062 } | 5061 } |
| 5063 | 5062 |
| 5064 TEST_P(QuicConnectionTest, ClientReceivesRejOnNonCryptoStream) { | 5063 TEST_P(QuicConnectionTest, ClientReceivesRejOnNonCryptoStream) { |
| 5065 FLAGS_quic_detect_memory_corrpution = true; | |
| 5066 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 5064 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
| 5067 | 5065 |
| 5068 CryptoHandshakeMessage message; | 5066 CryptoHandshakeMessage message; |
| 5069 CryptoFramer framer; | 5067 CryptoFramer framer; |
| 5070 message.set_tag(kREJ); | 5068 message.set_tag(kREJ); |
| 5071 std::unique_ptr<QuicData> data(framer.ConstructHandshakeMessage(message)); | 5069 std::unique_ptr<QuicData> data(framer.ConstructHandshakeMessage(message)); |
| 5072 frame1_.stream_id = 10; | 5070 frame1_.stream_id = 10; |
| 5073 frame1_.data_buffer = data->data(); | 5071 frame1_.data_buffer = data->data(); |
| 5074 frame1_.data_length = data->length(); | 5072 frame1_.data_length = data->length(); |
| 5075 | 5073 |
| 5076 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_MAYBE_CORRUPTED_MEMORY, _, | 5074 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_MAYBE_CORRUPTED_MEMORY, _, |
| 5077 ConnectionCloseSource::FROM_SELF)); | 5075 ConnectionCloseSource::FROM_SELF)); |
| 5078 ProcessFramePacket(QuicFrame(&frame1_)); | 5076 ProcessFramePacket(QuicFrame(&frame1_)); |
| 5079 } | 5077 } |
| 5080 | 5078 |
| 5081 } // namespace | 5079 } // namespace |
| 5082 } // namespace test | 5080 } // namespace test |
| 5083 } // namespace net | 5081 } // namespace net |
| OLD | NEW |