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

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

Issue 1246793002: relnote: Protect against a QUIC crash bug but logging a DFATAL and (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months 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_packet_generator.cc ('k') | net/quic/quic_protocol.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_packet_generator.h" 5 #include "net/quic/quic_packet_generator.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "net/quic/crypto/crypto_protocol.h" 9 #include "net/quic/crypto/crypto_protocol.h"
10 #include "net/quic/crypto/null_encrypter.h" 10 #include "net/quic/crypto/null_encrypter.h"
(...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after
1619 PacketContents probe_contents; 1619 PacketContents probe_contents;
1620 probe_contents.num_mtu_discovery_frames = 1; 1620 probe_contents.num_mtu_discovery_frames = 1;
1621 1621
1622 CheckPacketHasSingleStreamFrame(0); 1622 CheckPacketHasSingleStreamFrame(0);
1623 CheckPacketHasSingleStreamFrame(1); 1623 CheckPacketHasSingleStreamFrame(1);
1624 CheckPacketContains(probe_contents, 2); 1624 CheckPacketContains(probe_contents, 2);
1625 CheckPacketHasSingleStreamFrame(3); 1625 CheckPacketHasSingleStreamFrame(3);
1626 CheckPacketHasSingleStreamFrame(4); 1626 CheckPacketHasSingleStreamFrame(4);
1627 } 1627 }
1628 1628
1629 TEST_P(QuicPacketGeneratorTest, DontCrashOnInvalidStopWaiting) {
1630 // Test added to ensure the generator does not crash when an invalid frame is
1631 // added. Because this is an indication of internal programming errors,
1632 // DFATALs are expected.
1633 // A 1 byte sequence number length can't encode a gap of 1000.
1634 QuicPacketCreatorPeer::SetSequenceNumber(creator_, 1000);
1635
1636 delegate_.SetCanNotWrite();
1637 generator_.SetShouldSendAck(true);
1638 delegate_.SetCanWriteAnything();
1639 generator_.StartBatchOperations();
1640
1641 // Set up frames to write into the creator when control frames are written.
1642 EXPECT_CALL(delegate_, PopulateAckFrame(_));
1643 EXPECT_CALL(delegate_, PopulateStopWaitingFrame(_));
1644 // Generator should have queued control frames, and creator should be empty.
1645 EXPECT_TRUE(generator_.HasQueuedFrames());
1646 EXPECT_FALSE(creator_->HasPendingFrames());
1647
1648 // This will not serialize any packets, because of the invalid frame.
1649 EXPECT_CALL(delegate_,
1650 CloseConnection(QUIC_FAILED_TO_SERIALIZE_PACKET, false));
1651 EXPECT_DFATAL(generator_.FinishBatchOperations(),
1652 "sequence_number_length 1 is too small "
1653 "for least_unacked_delta: 1001");
1654 }
1655
1629 } // namespace test 1656 } // namespace test
1630 } // namespace net 1657 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_packet_generator.cc ('k') | net/quic/quic_protocol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698