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_connection.h" | 5 #include "net/quic/quic_connection.h" |
6 | 6 |
7 #include <ostream> | 7 #include <ostream> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 uint32_t cipher_id() const override { return 0xFFFFFFF1; } | 195 uint32_t cipher_id() const override { return 0xFFFFFFF1; } |
196 | 196 |
197 private: | 197 private: |
198 const uint8_t tag_; | 198 const uint8_t tag_; |
199 }; | 199 }; |
200 | 200 |
201 class TestConnectionHelper : public QuicConnectionHelperInterface { | 201 class TestConnectionHelper : public QuicConnectionHelperInterface { |
202 public: | 202 public: |
203 class TestAlarm : public QuicAlarm { | 203 class TestAlarm : public QuicAlarm { |
204 public: | 204 public: |
205 explicit TestAlarm(QuicAlarm::Delegate* delegate) : QuicAlarm(delegate) {} | 205 explicit TestAlarm(QuicArenaScopedPtr<QuicAlarm::Delegate> delegate) |
| 206 : QuicAlarm(std::move(delegate)) {} |
206 | 207 |
207 void SetImpl() override {} | 208 void SetImpl() override {} |
208 void CancelImpl() override {} | 209 void CancelImpl() override {} |
209 using QuicAlarm::Fire; | 210 using QuicAlarm::Fire; |
210 }; | 211 }; |
211 | 212 |
212 TestConnectionHelper(MockClock* clock, MockRandom* random_generator) | 213 TestConnectionHelper(MockClock* clock, MockRandom* random_generator) |
213 : clock_(clock), random_generator_(random_generator) { | 214 : clock_(clock), random_generator_(random_generator) { |
214 clock_->AdvanceTime(QuicTime::Delta::FromSeconds(1)); | 215 clock_->AdvanceTime(QuicTime::Delta::FromSeconds(1)); |
215 } | 216 } |
216 | 217 |
217 // QuicConnectionHelperInterface | 218 // QuicConnectionHelperInterface |
218 const QuicClock* GetClock() const override { return clock_; } | 219 const QuicClock* GetClock() const override { return clock_; } |
219 | 220 |
220 QuicRandom* GetRandomGenerator() override { return random_generator_; } | 221 QuicRandom* GetRandomGenerator() override { return random_generator_; } |
221 | 222 |
222 QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) override { | 223 QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) override { |
223 return new TestAlarm(delegate); | 224 return new TestAlarm(QuicArenaScopedPtr<QuicAlarm::Delegate>(delegate)); |
| 225 } |
| 226 |
| 227 QuicArenaScopedPtr<QuicAlarm> CreateAlarm( |
| 228 QuicArenaScopedPtr<QuicAlarm::Delegate> delegate, |
| 229 QuicConnectionArena* arena) override { |
| 230 return arena->New<TestAlarm>(std::move(delegate)); |
224 } | 231 } |
225 | 232 |
226 QuicBufferAllocator* GetBufferAllocator() override { | 233 QuicBufferAllocator* GetBufferAllocator() override { |
227 return &buffer_allocator_; | 234 return &buffer_allocator_; |
228 } | 235 } |
229 | 236 |
230 private: | 237 private: |
231 MockClock* clock_; | 238 MockClock* clock_; |
232 MockRandom* random_generator_; | 239 MockRandom* random_generator_; |
233 SimpleBufferAllocator buffer_allocator_; | 240 SimpleBufferAllocator buffer_allocator_; |
(...skipping 5348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5582 config.ProcessPeerHello(msg, CLIENT, &error_details); | 5589 config.ProcessPeerHello(msg, CLIENT, &error_details); |
5583 EXPECT_EQ(QUIC_NO_ERROR, error); | 5590 EXPECT_EQ(QUIC_NO_ERROR, error); |
5584 | 5591 |
5585 connection_.SetFromConfig(config); | 5592 connection_.SetFromConfig(config); |
5586 EXPECT_TRUE(QuicConnectionPeer::IsMultipathEnabled(&connection_)); | 5593 EXPECT_TRUE(QuicConnectionPeer::IsMultipathEnabled(&connection_)); |
5587 } | 5594 } |
5588 | 5595 |
5589 } // namespace | 5596 } // namespace |
5590 } // namespace test | 5597 } // namespace test |
5591 } // namespace net | 5598 } // namespace net |
OLD | NEW |