| 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/core/quic_connection.h" | 5 #include "net/quic/core/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 4388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4399 ProcessFramePacket(QuicFrame(&window_update)); | 4399 ProcessFramePacket(QuicFrame(&window_update)); |
| 4400 } | 4400 } |
| 4401 | 4401 |
| 4402 TEST_P(QuicConnectionTest, Blocked) { | 4402 TEST_P(QuicConnectionTest, Blocked) { |
| 4403 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 4403 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
| 4404 | 4404 |
| 4405 QuicBlockedFrame blocked; | 4405 QuicBlockedFrame blocked; |
| 4406 blocked.stream_id = 3; | 4406 blocked.stream_id = 3; |
| 4407 EXPECT_CALL(visitor_, OnBlockedFrame(_)); | 4407 EXPECT_CALL(visitor_, OnBlockedFrame(_)); |
| 4408 ProcessFramePacket(QuicFrame(&blocked)); | 4408 ProcessFramePacket(QuicFrame(&blocked)); |
| 4409 EXPECT_EQ(1u, connection_.GetStats().blocked_frames_received); |
| 4410 EXPECT_EQ(0u, connection_.GetStats().blocked_frames_sent); |
| 4409 } | 4411 } |
| 4410 | 4412 |
| 4411 TEST_P(QuicConnectionTest, PathClose) { | 4413 TEST_P(QuicConnectionTest, PathClose) { |
| 4412 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 4414 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
| 4413 | 4415 |
| 4414 QuicPathCloseFrame path_close = QuicPathCloseFrame(1); | 4416 QuicPathCloseFrame path_close = QuicPathCloseFrame(1); |
| 4415 ProcessPathClosePacket(&path_close); | 4417 ProcessPathClosePacket(&path_close); |
| 4416 EXPECT_TRUE(QuicFramerPeer::IsPathClosed( | 4418 EXPECT_TRUE(QuicFramerPeer::IsPathClosed( |
| 4417 QuicConnectionPeer::GetFramer(&connection_), 1)); | 4419 QuicConnectionPeer::GetFramer(&connection_), 1)); |
| 4418 } | 4420 } |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5087 connection_.set_debug_visitor(&debug_visitor); | 5089 connection_.set_debug_visitor(&debug_visitor); |
| 5088 | 5090 |
| 5089 CongestionBlockWrites(); | 5091 CongestionBlockWrites(); |
| 5090 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1); | 5092 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1); |
| 5091 EXPECT_CALL(debug_visitor, OnPacketSent(_, _, _, _, _)).Times(1); | 5093 EXPECT_CALL(debug_visitor, OnPacketSent(_, _, _, _, _)).Times(1); |
| 5092 EXPECT_CALL(debug_visitor, OnPingSent()).Times(1); | 5094 EXPECT_CALL(debug_visitor, OnPingSent()).Times(1); |
| 5093 connection_.SendPing(); | 5095 connection_.SendPing(); |
| 5094 EXPECT_FALSE(connection_.HasQueuedData()); | 5096 EXPECT_FALSE(connection_.HasQueuedData()); |
| 5095 } | 5097 } |
| 5096 | 5098 |
| 5099 TEST_P(QuicConnectionTest, SendBlockedImmediately) { |
| 5100 MockQuicConnectionDebugVisitor debug_visitor; |
| 5101 connection_.set_debug_visitor(&debug_visitor); |
| 5102 |
| 5103 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1); |
| 5104 EXPECT_CALL(debug_visitor, OnPacketSent(_, _, _, _, _)).Times(1); |
| 5105 EXPECT_EQ(0u, connection_.GetStats().blocked_frames_sent); |
| 5106 connection_.SendBlocked(3); |
| 5107 EXPECT_EQ(1u, connection_.GetStats().blocked_frames_sent); |
| 5108 EXPECT_FALSE(connection_.HasQueuedData()); |
| 5109 } |
| 5110 |
| 5097 TEST_P(QuicConnectionTest, SendingUnencryptedStreamDataFails) { | 5111 TEST_P(QuicConnectionTest, SendingUnencryptedStreamDataFails) { |
| 5098 EXPECT_CALL(visitor_, | 5112 EXPECT_CALL(visitor_, |
| 5099 OnConnectionClosed(QUIC_ATTEMPT_TO_SEND_UNENCRYPTED_STREAM_DATA, | 5113 OnConnectionClosed(QUIC_ATTEMPT_TO_SEND_UNENCRYPTED_STREAM_DATA, |
| 5100 _, ConnectionCloseSource::FROM_SELF)); | 5114 _, ConnectionCloseSource::FROM_SELF)); |
| 5101 struct iovec iov; | 5115 struct iovec iov; |
| 5102 QuicIOVector data_iov(MakeIOVector("", &iov)); | 5116 QuicIOVector data_iov(MakeIOVector("", &iov)); |
| 5103 EXPECT_QUIC_BUG(connection_.SendStreamData(3, data_iov, 0, kFin, nullptr), | 5117 EXPECT_QUIC_BUG(connection_.SendStreamData(3, data_iov, 0, kFin, nullptr), |
| 5104 "Cannot send stream data without encryption."); | 5118 "Cannot send stream data without encryption."); |
| 5105 EXPECT_FALSE(connection_.connected()); | 5119 EXPECT_FALSE(connection_.connected()); |
| 5106 } | 5120 } |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5307 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); | 5321 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); |
| 5308 EXPECT_EQ(1u, writer_->frame_count()); | 5322 EXPECT_EQ(1u, writer_->frame_count()); |
| 5309 EXPECT_FALSE(writer_->connection_close_frames().empty()); | 5323 EXPECT_FALSE(writer_->connection_close_frames().empty()); |
| 5310 // Ack frame is not bundled in connection close packet. | 5324 // Ack frame is not bundled in connection close packet. |
| 5311 EXPECT_TRUE(writer_->ack_frames().empty()); | 5325 EXPECT_TRUE(writer_->ack_frames().empty()); |
| 5312 } | 5326 } |
| 5313 | 5327 |
| 5314 } // namespace | 5328 } // namespace |
| 5315 } // namespace test | 5329 } // namespace test |
| 5316 } // namespace net | 5330 } // namespace net |
| OLD | NEW |