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

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

Issue 1525303003: Remove QuicPacketGenerator::OnSerializedPacket with functionality in QuicPacketCreator. No functio… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@110008813
Patch Set: get newly added files from upstream 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_packet_generator.cc ('k') | no next file » | 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 class MockDelegate : public QuicPacketGenerator::DelegateInterface { 42 class MockDelegate : public QuicPacketGenerator::DelegateInterface {
43 public: 43 public:
44 MockDelegate() {} 44 MockDelegate() {}
45 ~MockDelegate() override {} 45 ~MockDelegate() override {}
46 46
47 MOCK_METHOD2(ShouldGeneratePacket, 47 MOCK_METHOD2(ShouldGeneratePacket,
48 bool(HasRetransmittableData retransmittable, 48 bool(HasRetransmittableData retransmittable,
49 IsHandshake handshake)); 49 IsHandshake handshake));
50 MOCK_METHOD1(PopulateAckFrame, void(QuicAckFrame*)); 50 MOCK_METHOD1(PopulateAckFrame, void(QuicAckFrame*));
51 MOCK_METHOD1(PopulateStopWaitingFrame, void(QuicStopWaitingFrame*)); 51 MOCK_METHOD1(PopulateStopWaitingFrame, void(QuicStopWaitingFrame*));
52 MOCK_METHOD1(OnSerializedPacket, void(const SerializedPacket& packet)); 52 MOCK_METHOD1(OnSerializedPacket, void(SerializedPacket* packet));
53 MOCK_METHOD2(CloseConnection, void(QuicErrorCode, bool)); 53 MOCK_METHOD2(CloseConnection, void(QuicErrorCode, bool));
54 MOCK_METHOD0(OnResetFecGroup, void()); 54 MOCK_METHOD0(OnResetFecGroup, void());
55 55
56 void SetCanWriteAnything() { 56 void SetCanWriteAnything() {
57 EXPECT_CALL(*this, ShouldGeneratePacket(_, _)).WillRepeatedly(Return(true)); 57 EXPECT_CALL(*this, ShouldGeneratePacket(_, _)).WillRepeatedly(Return(true));
58 EXPECT_CALL(*this, ShouldGeneratePacket(NO_RETRANSMITTABLE_DATA, _)) 58 EXPECT_CALL(*this, ShouldGeneratePacket(NO_RETRANSMITTABLE_DATA, _))
59 .WillRepeatedly(Return(true)); 59 .WillRepeatedly(Return(true));
60 } 60 }
61 61
62 void SetCanNotWrite() { 62 void SetCanNotWrite() {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 generator_.set_fec_send_policy(GetParam()); 118 generator_.set_fec_send_policy(GetParam());
119 } 119 }
120 120
121 ~QuicPacketGeneratorTest() override { 121 ~QuicPacketGeneratorTest() override {
122 for (SerializedPacket& packet : packets_) { 122 for (SerializedPacket& packet : packets_) {
123 delete packet.packet; 123 delete packet.packet;
124 delete packet.retransmittable_frames; 124 delete packet.retransmittable_frames;
125 } 125 }
126 } 126 }
127 127
128 void SavePacket(const SerializedPacket& packet) { 128 void SavePacket(SerializedPacket* packet) {
129 packets_.push_back(packet); 129 packets_.push_back(*packet);
130 ASSERT_FALSE(packet.packet->owns_buffer()); 130 ASSERT_FALSE(packet->packet->owns_buffer());
131 scoped_ptr<QuicEncryptedPacket> encrypted_deleter(packets_.back().packet); 131 scoped_ptr<QuicEncryptedPacket> encrypted_deleter(packets_.back().packet);
132 packets_.back().packet = packets_.back().packet->Clone(); 132 packets_.back().packet = packets_.back().packet->Clone();
133 } 133 }
134 134
135 protected: 135 protected:
136 QuicRstStreamFrame* CreateRstStreamFrame() { 136 QuicRstStreamFrame* CreateRstStreamFrame() {
137 return new QuicRstStreamFrame(1, QUIC_STREAM_NO_ERROR, 0); 137 return new QuicRstStreamFrame(1, QUIC_STREAM_NO_ERROR, 0);
138 } 138 }
139 139
140 QuicGoAwayFrame* CreateGoAwayFrame() { 140 QuicGoAwayFrame* CreateGoAwayFrame() {
(...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 EXPECT_CALL(delegate_, OnSerializedPacket(_)) 1704 EXPECT_CALL(delegate_, OnSerializedPacket(_))
1705 .WillOnce(Invoke(this, &QuicPacketGeneratorTest::SavePacket)); 1705 .WillOnce(Invoke(this, &QuicPacketGeneratorTest::SavePacket));
1706 generator_.FlushAllQueuedFrames(); 1706 generator_.FlushAllQueuedFrames();
1707 EXPECT_FALSE(generator_.HasQueuedFrames()); 1707 EXPECT_FALSE(generator_.HasQueuedFrames());
1708 generator_.SetCurrentPath(kTestPathId1, 1, 0); 1708 generator_.SetCurrentPath(kTestPathId1, 1, 0);
1709 EXPECT_EQ(kTestPathId1, QuicPacketCreatorPeer::GetCurrentPath(creator_)); 1709 EXPECT_EQ(kTestPathId1, QuicPacketCreatorPeer::GetCurrentPath(creator_));
1710 } 1710 }
1711 1711
1712 } // namespace test 1712 } // namespace test
1713 } // namespace net 1713 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_packet_generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698