| 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/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 EXPECT_CALL(visitor_, HasPendingHandshake()).Times(AnyNumber()); | 712 EXPECT_CALL(visitor_, HasPendingHandshake()).Times(AnyNumber()); |
| 713 EXPECT_CALL(visitor_, OnCanWrite()).Times(AnyNumber()); | 713 EXPECT_CALL(visitor_, OnCanWrite()).Times(AnyNumber()); |
| 714 EXPECT_CALL(visitor_, HasOpenDynamicStreams()) | 714 EXPECT_CALL(visitor_, HasOpenDynamicStreams()) |
| 715 .WillRepeatedly(Return(false)); | 715 .WillRepeatedly(Return(false)); |
| 716 EXPECT_CALL(visitor_, OnCongestionWindowChange(_)).Times(AnyNumber()); | 716 EXPECT_CALL(visitor_, OnCongestionWindowChange(_)).Times(AnyNumber()); |
| 717 | 717 |
| 718 EXPECT_CALL(*loss_algorithm_, GetLossTimeout()) | 718 EXPECT_CALL(*loss_algorithm_, GetLossTimeout()) |
| 719 .WillRepeatedly(Return(QuicTime::Zero())); | 719 .WillRepeatedly(Return(QuicTime::Zero())); |
| 720 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) | 720 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) |
| 721 .WillRepeatedly(Return(PacketNumberSet())); | 721 .WillRepeatedly(Return(PacketNumberSet())); |
| 722 // TODO(ianswett): Fix QuicConnectionTests so they don't attempt to write | |
| 723 // non-crypto stream data at ENCRYPTION_NONE. | |
| 724 FLAGS_quic_never_write_unencrypted_data = false; | |
| 725 } | 722 } |
| 726 | 723 |
| 727 QuicVersion version() { return GetParam().version; } | 724 QuicVersion version() { return GetParam().version; } |
| 728 | 725 |
| 729 QuicAckFrame* outgoing_ack() { | 726 QuicAckFrame* outgoing_ack() { |
| 730 QuicConnectionPeer::PopulateAckFrame(&connection_, &ack_); | 727 QuicConnectionPeer::PopulateAckFrame(&connection_, &ack_); |
| 731 return &ack_; | 728 return &ack_; |
| 732 } | 729 } |
| 733 | 730 |
| 734 QuicStopWaitingFrame* stop_waiting() { | 731 QuicStopWaitingFrame* stop_waiting() { |
| (...skipping 4071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4806 | 4803 |
| 4807 TEST_P(QuicConnectionTest, DoNotSendGoAwayTwice) { | 4804 TEST_P(QuicConnectionTest, DoNotSendGoAwayTwice) { |
| 4808 EXPECT_FALSE(connection_.goaway_sent()); | 4805 EXPECT_FALSE(connection_.goaway_sent()); |
| 4809 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1); | 4806 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1); |
| 4810 connection_.SendGoAway(QUIC_PEER_GOING_AWAY, kHeadersStreamId, "Going Away."); | 4807 connection_.SendGoAway(QUIC_PEER_GOING_AWAY, kHeadersStreamId, "Going Away."); |
| 4811 EXPECT_TRUE(connection_.goaway_sent()); | 4808 EXPECT_TRUE(connection_.goaway_sent()); |
| 4812 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0); | 4809 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0); |
| 4813 connection_.SendGoAway(QUIC_PEER_GOING_AWAY, kHeadersStreamId, "Going Away."); | 4810 connection_.SendGoAway(QUIC_PEER_GOING_AWAY, kHeadersStreamId, "Going Away."); |
| 4814 } | 4811 } |
| 4815 | 4812 |
| 4816 TEST_P(QuicConnectionTest, SendingUnencryptedStreamDataFails) { | |
| 4817 FLAGS_quic_never_write_unencrypted_data = true; | |
| 4818 EXPECT_CALL(visitor_, | |
| 4819 OnConnectionClosed(QUIC_UNENCRYPTED_STREAM_DATA, false)); | |
| 4820 EXPECT_DFATAL(connection_.SendStreamDataWithString(3, "", 0, kFin, nullptr), | |
| 4821 "Cannot send stream data without encryption."); | |
| 4822 EXPECT_FALSE(connection_.connected()); | |
| 4823 } | |
| 4824 | |
| 4825 } // namespace | 4813 } // namespace |
| 4826 } // namespace test | 4814 } // namespace test |
| 4827 } // namespace net | 4815 } // namespace net |
| OLD | NEW |