| 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 4341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4352 | 4352 |
| 4353 // Increase FEC timeout by increasing RTT. | 4353 // Increase FEC timeout by increasing RTT. |
| 4354 RttStats* rtt_stats = QuicSentPacketManagerPeer::GetRttStats(manager_); | 4354 RttStats* rtt_stats = QuicSentPacketManagerPeer::GetRttStats(manager_); |
| 4355 rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(300), | 4355 rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(300), |
| 4356 QuicTime::Delta::Zero(), QuicTime::Zero()); | 4356 QuicTime::Delta::Zero(), QuicTime::Zero()); |
| 4357 visitor->OnRttChange(); | 4357 visitor->OnRttChange(); |
| 4358 EXPECT_LT(QuicTime::Delta::Zero(), | 4358 EXPECT_LT(QuicTime::Delta::Zero(), |
| 4359 QuicPacketGeneratorPeer::GetFecTimeout(generator_)); | 4359 QuicPacketGeneratorPeer::GetFecTimeout(generator_)); |
| 4360 } | 4360 } |
| 4361 | 4361 |
| 4362 class MockQuicConnectionDebugVisitor | |
| 4363 : public QuicConnectionDebugVisitor { | |
| 4364 public: | |
| 4365 MOCK_METHOD1(OnFrameAddedToPacket, | |
| 4366 void(const QuicFrame&)); | |
| 4367 | |
| 4368 MOCK_METHOD6(OnPacketSent, | |
| 4369 void(const SerializedPacket&, | |
| 4370 QuicPacketSequenceNumber, | |
| 4371 EncryptionLevel, | |
| 4372 TransmissionType, | |
| 4373 const QuicEncryptedPacket&, | |
| 4374 QuicTime)); | |
| 4375 | |
| 4376 MOCK_METHOD3(OnPacketReceived, | |
| 4377 void(const IPEndPoint&, | |
| 4378 const IPEndPoint&, | |
| 4379 const QuicEncryptedPacket&)); | |
| 4380 | |
| 4381 MOCK_METHOD1(OnProtocolVersionMismatch, | |
| 4382 void(QuicVersion)); | |
| 4383 | |
| 4384 MOCK_METHOD1(OnPacketHeader, | |
| 4385 void(const QuicPacketHeader& header)); | |
| 4386 | |
| 4387 MOCK_METHOD1(OnStreamFrame, | |
| 4388 void(const QuicStreamFrame&)); | |
| 4389 | |
| 4390 MOCK_METHOD1(OnAckFrame, | |
| 4391 void(const QuicAckFrame& frame)); | |
| 4392 | |
| 4393 MOCK_METHOD1(OnStopWaitingFrame, | |
| 4394 void(const QuicStopWaitingFrame&)); | |
| 4395 | |
| 4396 MOCK_METHOD1(OnRstStreamFrame, | |
| 4397 void(const QuicRstStreamFrame&)); | |
| 4398 | |
| 4399 MOCK_METHOD1(OnConnectionCloseFrame, | |
| 4400 void(const QuicConnectionCloseFrame&)); | |
| 4401 | |
| 4402 MOCK_METHOD1(OnPublicResetPacket, | |
| 4403 void(const QuicPublicResetPacket&)); | |
| 4404 | |
| 4405 MOCK_METHOD1(OnVersionNegotiationPacket, | |
| 4406 void(const QuicVersionNegotiationPacket&)); | |
| 4407 | |
| 4408 MOCK_METHOD2(OnRevivedPacket, | |
| 4409 void(const QuicPacketHeader&, StringPiece payload)); | |
| 4410 }; | |
| 4411 | |
| 4412 TEST_P(QuicConnectionTest, OnPacketHeaderDebugVisitor) { | 4362 TEST_P(QuicConnectionTest, OnPacketHeaderDebugVisitor) { |
| 4413 QuicPacketHeader header; | 4363 QuicPacketHeader header; |
| 4414 | 4364 |
| 4415 scoped_ptr<MockQuicConnectionDebugVisitor> debug_visitor( | 4365 scoped_ptr<MockQuicConnectionDebugVisitor> debug_visitor( |
| 4416 new MockQuicConnectionDebugVisitor()); | 4366 new MockQuicConnectionDebugVisitor()); |
| 4417 connection_.set_debug_visitor(debug_visitor.get()); | 4367 connection_.set_debug_visitor(debug_visitor.get()); |
| 4418 EXPECT_CALL(*debug_visitor, OnPacketHeader(Ref(header))).Times(1); | 4368 EXPECT_CALL(*debug_visitor, OnPacketHeader(Ref(header))).Times(1); |
| 4419 connection_.OnPacketHeader(header); | 4369 connection_.OnPacketHeader(header); |
| 4420 } | 4370 } |
| 4421 | 4371 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4457 // Regression test for b/18594622 | 4407 // Regression test for b/18594622 |
| 4458 scoped_refptr<MockAckNotifierDelegate> delegate(new MockAckNotifierDelegate); | 4408 scoped_refptr<MockAckNotifierDelegate> delegate(new MockAckNotifierDelegate); |
| 4459 EXPECT_DFATAL( | 4409 EXPECT_DFATAL( |
| 4460 connection_.SendStreamDataWithString(3, "", 0, !kFin, delegate.get()), | 4410 connection_.SendStreamDataWithString(3, "", 0, !kFin, delegate.get()), |
| 4461 "Attempt to send empty stream frame"); | 4411 "Attempt to send empty stream frame"); |
| 4462 } | 4412 } |
| 4463 | 4413 |
| 4464 } // namespace | 4414 } // namespace |
| 4465 } // namespace test | 4415 } // namespace test |
| 4466 } // namespace net | 4416 } // namespace net |
| OLD | NEW |