| 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 <ostream> | 7 #include <ostream> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 4658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4669 EXPECT_CALL(visitor_, OnWindowUpdateFrame(_)); | 4669 EXPECT_CALL(visitor_, OnWindowUpdateFrame(_)); |
| 4670 ProcessFramePacket(QuicFrame(&window_update)); | 4670 ProcessFramePacket(QuicFrame(&window_update)); |
| 4671 } | 4671 } |
| 4672 | 4672 |
| 4673 TEST_P(QuicConnectionTest, Blocked) { | 4673 TEST_P(QuicConnectionTest, Blocked) { |
| 4674 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 4674 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
| 4675 | 4675 |
| 4676 QuicBlockedFrame blocked; | 4676 QuicBlockedFrame blocked; |
| 4677 blocked.stream_id = 3; | 4677 blocked.stream_id = 3; |
| 4678 EXPECT_CALL(visitor_, OnBlockedFrame(_)); | 4678 EXPECT_CALL(visitor_, OnBlockedFrame(_)); |
| 4679 ProcessFramePacket(QuicFrame(&blocked)); | 4679 ProcessFramePacket(QuicFrame(blocked)); |
| 4680 } | 4680 } |
| 4681 | 4681 |
| 4682 TEST_P(QuicConnectionTest, ZeroBytePacket) { | 4682 TEST_P(QuicConnectionTest, ZeroBytePacket) { |
| 4683 // Don't close the connection for zero byte packets. | 4683 // Don't close the connection for zero byte packets. |
| 4684 EXPECT_CALL(visitor_, OnConnectionClosed(_, _)).Times(0); | 4684 EXPECT_CALL(visitor_, OnConnectionClosed(_, _)).Times(0); |
| 4685 QuicEncryptedPacket encrypted(nullptr, 0); | 4685 QuicEncryptedPacket encrypted(nullptr, 0); |
| 4686 connection_.ProcessUdpPacket(kSelfAddress, kPeerAddress, encrypted); | 4686 connection_.ProcessUdpPacket(kSelfAddress, kPeerAddress, encrypted); |
| 4687 } | 4687 } |
| 4688 | 4688 |
| 4689 TEST_P(QuicConnectionTest, MissingPacketsBeforeLeastUnacked) { | 4689 TEST_P(QuicConnectionTest, MissingPacketsBeforeLeastUnacked) { |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5453 EXPECT_TRUE(ack_alarm->IsSet()); | 5453 EXPECT_TRUE(ack_alarm->IsSet()); |
| 5454 } | 5454 } |
| 5455 | 5455 |
| 5456 TEST_P(QuicConnectionTest, BlockedFrameInstigateAcks) { | 5456 TEST_P(QuicConnectionTest, BlockedFrameInstigateAcks) { |
| 5457 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 5457 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
| 5458 | 5458 |
| 5459 // Send a BLOCKED frame. | 5459 // Send a BLOCKED frame. |
| 5460 QuicBlockedFrame blocked; | 5460 QuicBlockedFrame blocked; |
| 5461 blocked.stream_id = 3; | 5461 blocked.stream_id = 3; |
| 5462 EXPECT_CALL(visitor_, OnBlockedFrame(_)); | 5462 EXPECT_CALL(visitor_, OnBlockedFrame(_)); |
| 5463 ProcessFramePacket(QuicFrame(&blocked)); | 5463 ProcessFramePacket(QuicFrame(blocked)); |
| 5464 | 5464 |
| 5465 // Ensure that this has caused the ACK alarm to be set. | 5465 // Ensure that this has caused the ACK alarm to be set. |
| 5466 QuicAlarm* ack_alarm = QuicConnectionPeer::GetAckAlarm(&connection_); | 5466 QuicAlarm* ack_alarm = QuicConnectionPeer::GetAckAlarm(&connection_); |
| 5467 EXPECT_TRUE(ack_alarm->IsSet()); | 5467 EXPECT_TRUE(ack_alarm->IsSet()); |
| 5468 } | 5468 } |
| 5469 | 5469 |
| 5470 TEST_P(QuicConnectionTest, NoDataNoFin) { | 5470 TEST_P(QuicConnectionTest, NoDataNoFin) { |
| 5471 // Make sure that a call to SendStreamWithData, with no data and no FIN, does | 5471 // Make sure that a call to SendStreamWithData, with no data and no FIN, does |
| 5472 // not result in a QuicAckNotifier being used-after-free (fail under ASAN). | 5472 // not result in a QuicAckNotifier being used-after-free (fail under ASAN). |
| 5473 // Regression test for b/18594622 | 5473 // Regression test for b/18594622 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5568 EXPECT_CALL(visitor_, | 5568 EXPECT_CALL(visitor_, |
| 5569 OnConnectionClosed(QUIC_UNENCRYPTED_STREAM_DATA, false)); | 5569 OnConnectionClosed(QUIC_UNENCRYPTED_STREAM_DATA, false)); |
| 5570 EXPECT_DFATAL(connection_.SendStreamDataWithString(3, "", 0, kFin, nullptr), | 5570 EXPECT_DFATAL(connection_.SendStreamDataWithString(3, "", 0, kFin, nullptr), |
| 5571 "Cannot send stream data without encryption."); | 5571 "Cannot send stream data without encryption."); |
| 5572 EXPECT_FALSE(connection_.connected()); | 5572 EXPECT_FALSE(connection_.connected()); |
| 5573 } | 5573 } |
| 5574 | 5574 |
| 5575 } // namespace | 5575 } // namespace |
| 5576 } // namespace test | 5576 } // namespace test |
| 5577 } // namespace net | 5577 } // namespace net |
| OLD | NEW |