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

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

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