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_packet_creator.h" | 5 #include "net/quic/quic_packet_creator.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "net/quic/crypto/null_encrypter.h" | 8 #include "net/quic/crypto/null_encrypter.h" |
9 #include "net/quic/crypto/quic_decrypter.h" | 9 #include "net/quic/crypto/quic_decrypter.h" |
10 #include "net/quic/crypto/quic_encrypter.h" | 10 #include "net/quic/crypto/quic_encrypter.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 return params; | 70 return params; |
71 } | 71 } |
72 | 72 |
73 class QuicPacketCreatorTest : public ::testing::TestWithParam<TestParams> { | 73 class QuicPacketCreatorTest : public ::testing::TestWithParam<TestParams> { |
74 protected: | 74 protected: |
75 QuicPacketCreatorTest() | 75 QuicPacketCreatorTest() |
76 : server_framer_(SupportedVersions(GetParam().version), QuicTime::Zero(), | 76 : server_framer_(SupportedVersions(GetParam().version), QuicTime::Zero(), |
77 true), | 77 true), |
78 client_framer_(SupportedVersions(GetParam().version), QuicTime::Zero(), | 78 client_framer_(SupportedVersions(GetParam().version), QuicTime::Zero(), |
79 false), | 79 false), |
80 sequence_number_(0), | |
81 connection_id_(2), | 80 connection_id_(2), |
82 data_("foo"), | 81 data_("foo"), |
83 creator_(connection_id_, &client_framer_, &mock_random_) { | 82 creator_(connection_id_, &client_framer_, &mock_random_) { |
84 creator_.set_connection_id_length(GetParam().connection_id_length); | 83 creator_.set_connection_id_length(GetParam().connection_id_length); |
85 client_framer_.set_visitor(&framer_visitor_); | 84 client_framer_.set_visitor(&framer_visitor_); |
86 client_framer_.set_received_entropy_calculator(&entropy_calculator_); | 85 client_framer_.set_received_entropy_calculator(&entropy_calculator_); |
87 server_framer_.set_visitor(&framer_visitor_); | 86 server_framer_.set_visitor(&framer_visitor_); |
88 } | 87 } |
89 | 88 |
90 ~QuicPacketCreatorTest() override {} | 89 ~QuicPacketCreatorTest() override {} |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 creator_.StartFecProtectingPackets(); | 135 creator_.StartFecProtectingPackets(); |
137 return creator_.IsFecProtected(); | 136 return creator_.IsFecProtected(); |
138 } | 137 } |
139 | 138 |
140 static const QuicStreamOffset kOffset = 1u; | 139 static const QuicStreamOffset kOffset = 1u; |
141 | 140 |
142 QuicFrames frames_; | 141 QuicFrames frames_; |
143 QuicFramer server_framer_; | 142 QuicFramer server_framer_; |
144 QuicFramer client_framer_; | 143 QuicFramer client_framer_; |
145 testing::StrictMock<MockFramerVisitor> framer_visitor_; | 144 testing::StrictMock<MockFramerVisitor> framer_visitor_; |
146 QuicPacketSequenceNumber sequence_number_; | |
147 QuicConnectionId connection_id_; | 145 QuicConnectionId connection_id_; |
148 string data_; | 146 string data_; |
149 MockRandom mock_random_; | 147 MockRandom mock_random_; |
150 QuicPacketCreator creator_; | 148 QuicPacketCreator creator_; |
151 MockEntropyCalculator entropy_calculator_; | 149 MockEntropyCalculator entropy_calculator_; |
152 }; | 150 }; |
153 | 151 |
154 // Run all packet creator tests with all supported versions of QUIC, and with | 152 // Run all packet creator tests with all supported versions of QUIC, and with |
155 // and without version in the packet header, as well as doing a run for each | 153 // and without version in the packet header, as well as doing a run for each |
156 // length of truncated connection id. | 154 // length of truncated connection id. |
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 // After 64 calls, BoolSource will refresh the bucket - make sure it does. | 1052 // After 64 calls, BoolSource will refresh the bucket - make sure it does. |
1055 mock_random_.ChangeValue(); | 1053 mock_random_.ChangeValue(); |
1056 } | 1054 } |
1057 | 1055 |
1058 delete frames_[0].stream_frame; | 1056 delete frames_[0].stream_frame; |
1059 } | 1057 } |
1060 | 1058 |
1061 } // namespace | 1059 } // namespace |
1062 } // namespace test | 1060 } // namespace test |
1063 } // namespace net | 1061 } // namespace net |
OLD | NEW |