Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: net/quic/quic_connection_test.cc

Issue 1507853003: Reland of Close the QUIC connection when non-crypto stream data is written at ENCRYPTION_NONE. Flag protected… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2526
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_flags.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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;
722 } 725 }
723 726
724 QuicVersion version() { return GetParam().version; } 727 QuicVersion version() { return GetParam().version; }
725 728
726 QuicAckFrame* outgoing_ack() { 729 QuicAckFrame* outgoing_ack() {
727 QuicConnectionPeer::PopulateAckFrame(&connection_, &ack_); 730 QuicConnectionPeer::PopulateAckFrame(&connection_, &ack_);
728 return &ack_; 731 return &ack_;
729 } 732 }
730 733
731 QuicStopWaitingFrame* stop_waiting() { 734 QuicStopWaitingFrame* stop_waiting() {
(...skipping 4071 matching lines...) Expand 10 before | Expand all | Expand 10 after
4803 4806
4804 TEST_P(QuicConnectionTest, DoNotSendGoAwayTwice) { 4807 TEST_P(QuicConnectionTest, DoNotSendGoAwayTwice) {
4805 EXPECT_FALSE(connection_.goaway_sent()); 4808 EXPECT_FALSE(connection_.goaway_sent());
4806 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1); 4809 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1);
4807 connection_.SendGoAway(QUIC_PEER_GOING_AWAY, kHeadersStreamId, "Going Away."); 4810 connection_.SendGoAway(QUIC_PEER_GOING_AWAY, kHeadersStreamId, "Going Away.");
4808 EXPECT_TRUE(connection_.goaway_sent()); 4811 EXPECT_TRUE(connection_.goaway_sent());
4809 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0); 4812 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0);
4810 connection_.SendGoAway(QUIC_PEER_GOING_AWAY, kHeadersStreamId, "Going Away."); 4813 connection_.SendGoAway(QUIC_PEER_GOING_AWAY, kHeadersStreamId, "Going Away.");
4811 } 4814 }
4812 4815
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
4813 } // namespace 4825 } // namespace
4814 } // namespace test 4826 } // namespace test
4815 } // namespace net 4827 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_flags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698