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/test_tools/quic_test_utils.h" | 5 #include "net/quic/test_tools/quic_test_utils.h" |
6 | 6 |
7 #include "base/sha1.h" | 7 #include "base/sha1.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "net/quic/crypto/crypto_framer.h" | 10 #include "net/quic/crypto/crypto_framer.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 using base::StringPiece; | 25 using base::StringPiece; |
26 using std::max; | 26 using std::max; |
27 using std::min; | 27 using std::min; |
28 using std::string; | 28 using std::string; |
29 using testing::Invoke; | 29 using testing::Invoke; |
30 using testing::_; | 30 using testing::_; |
31 | 31 |
32 namespace net { | 32 namespace net { |
33 namespace test { | 33 namespace test { |
34 namespace { | |
35 | |
36 // No-op alarm implementation used by MockConnectionHelper. | |
37 class TestAlarm : public QuicAlarm { | |
38 public: | |
39 explicit TestAlarm(QuicAlarm::Delegate* delegate) : QuicAlarm(delegate) {} | |
40 | |
41 void SetImpl() override {} | |
42 void CancelImpl() override {} | |
43 }; | |
44 | |
45 } // namespace | |
46 | 34 |
47 QuicAckFrame MakeAckFrame(QuicPacketNumber largest_observed) { | 35 QuicAckFrame MakeAckFrame(QuicPacketNumber largest_observed) { |
48 QuicAckFrame ack; | 36 QuicAckFrame ack; |
49 ack.largest_observed = largest_observed; | 37 ack.largest_observed = largest_observed; |
50 ack.entropy_hash = 0; | 38 ack.entropy_hash = 0; |
51 return ack; | 39 return ack; |
52 } | 40 } |
53 | 41 |
54 QuicAckFrame MakeAckFrameWithNackRanges(size_t num_nack_ranges, | 42 QuicAckFrame MakeAckFrameWithNackRanges(size_t num_nack_ranges, |
55 QuicPacketNumber least_unacked) { | 43 QuicPacketNumber least_unacked) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 187 |
200 const QuicClock* MockConnectionHelper::GetClock() const { | 188 const QuicClock* MockConnectionHelper::GetClock() const { |
201 return &clock_; | 189 return &clock_; |
202 } | 190 } |
203 | 191 |
204 QuicRandom* MockConnectionHelper::GetRandomGenerator() { | 192 QuicRandom* MockConnectionHelper::GetRandomGenerator() { |
205 return &random_generator_; | 193 return &random_generator_; |
206 } | 194 } |
207 | 195 |
208 QuicAlarm* MockConnectionHelper::CreateAlarm(QuicAlarm::Delegate* delegate) { | 196 QuicAlarm* MockConnectionHelper::CreateAlarm(QuicAlarm::Delegate* delegate) { |
209 return new TestAlarm(delegate); | 197 return new MockConnectionHelper::TestAlarm(delegate); |
210 } | 198 } |
211 | 199 |
212 QuicBufferAllocator* MockConnectionHelper::GetBufferAllocator() { | 200 QuicBufferAllocator* MockConnectionHelper::GetBufferAllocator() { |
213 return &buffer_allocator_; | 201 return &buffer_allocator_; |
214 } | 202 } |
215 | 203 |
216 void MockConnectionHelper::AdvanceTime(QuicTime::Delta delta) { | 204 void MockConnectionHelper::AdvanceTime(QuicTime::Delta delta) { |
217 clock_.AdvanceTime(delta); | 205 clock_.AdvanceTime(delta); |
218 } | 206 } |
219 | 207 |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 // strike register worries that we've just overflowed a uint32_t time. | 809 // strike register worries that we've just overflowed a uint32_t time. |
822 (*server_connection)->AdvanceTime(connection_start_time); | 810 (*server_connection)->AdvanceTime(connection_start_time); |
823 } | 811 } |
824 | 812 |
825 QuicStreamId QuicClientDataStreamId(int i) { | 813 QuicStreamId QuicClientDataStreamId(int i) { |
826 return kClientDataStreamId1 + 2 * i; | 814 return kClientDataStreamId1 + 2 * i; |
827 } | 815 } |
828 | 816 |
829 } // namespace test | 817 } // namespace test |
830 } // namespace net | 818 } // namespace net |
OLD | NEW |