| 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 4426 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4437   ProcessAckPacket(&second_ack_frame); | 4437   ProcessAckPacket(&second_ack_frame); | 
| 4438 | 4438 | 
| 4439   // Verify that the listener is not notified again when the | 4439   // Verify that the listener is not notified again when the | 
| 4440   // retransmit is acked. | 4440   // retransmit is acked. | 
| 4441   EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); | 4441   EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); | 
| 4442   EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); | 4442   EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); | 
| 4443   QuicAckFrame third_ack_frame = InitAckFrame(5); | 4443   QuicAckFrame third_ack_frame = InitAckFrame(5); | 
| 4444   ProcessAckPacket(&third_ack_frame); | 4444   ProcessAckPacket(&third_ack_frame); | 
| 4445 } | 4445 } | 
| 4446 | 4446 | 
| 4447 TEST_P(QuicConnectionTest, AckNotifierFECTriggerCallback) { |  | 
| 4448   EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |  | 
| 4449 |  | 
| 4450   // Create a listener which we expect to be called. |  | 
| 4451   scoped_refptr<MockAckListener> listener(new MockAckListener); |  | 
| 4452   EXPECT_CALL(*listener, OnPacketAcked(_, _)).Times(1); |  | 
| 4453   // Send some data, which will register the listener to be notified. |  | 
| 4454   connection_.SendStreamDataWithString(1, "foo", 0, !kFin, listener.get()); |  | 
| 4455   connection_.SendStreamDataWithString(2, "bar", 0, !kFin, nullptr); |  | 
| 4456 |  | 
| 4457   // Process an ACK from the server with a revived packet, which should trigger |  | 
| 4458   // the callback. |  | 
| 4459   EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |  | 
| 4460   QuicAckFrame frame = InitAckFrame(2); |  | 
| 4461   NackPacket(1, &frame); |  | 
| 4462   frame.latest_revived_packet = 1; |  | 
| 4463   ProcessAckPacket(&frame); |  | 
| 4464   // If the ack is processed again, the notifier should not be called again. |  | 
| 4465   ProcessAckPacket(&frame); |  | 
| 4466 } |  | 
| 4467 |  | 
| 4468 TEST_P(QuicConnectionTest, OnPacketHeaderDebugVisitor) { | 4447 TEST_P(QuicConnectionTest, OnPacketHeaderDebugVisitor) { | 
| 4469   QuicPacketHeader header; | 4448   QuicPacketHeader header; | 
| 4470 | 4449 | 
| 4471   scoped_ptr<MockQuicConnectionDebugVisitor> debug_visitor( | 4450   scoped_ptr<MockQuicConnectionDebugVisitor> debug_visitor( | 
| 4472       new MockQuicConnectionDebugVisitor()); | 4451       new MockQuicConnectionDebugVisitor()); | 
| 4473   connection_.set_debug_visitor(debug_visitor.get()); | 4452   connection_.set_debug_visitor(debug_visitor.get()); | 
| 4474   EXPECT_CALL(*debug_visitor, OnPacketHeader(Ref(header))).Times(1); | 4453   EXPECT_CALL(*debug_visitor, OnPacketHeader(Ref(header))).Times(1); | 
| 4475   EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)).Times(1); | 4454   EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)).Times(1); | 
| 4476   EXPECT_CALL(*debug_visitor, OnSuccessfulVersionNegotiation(_)).Times(1); | 4455   EXPECT_CALL(*debug_visitor, OnSuccessfulVersionNegotiation(_)).Times(1); | 
| 4477   connection_.OnPacketHeader(header); | 4456   connection_.OnPacketHeader(header); | 
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4662   // result in multiple attempts to close the connection - it will be marked as | 4641   // result in multiple attempts to close the connection - it will be marked as | 
| 4663   // disconnected after the first call. | 4642   // disconnected after the first call. | 
| 4664   EXPECT_CALL(visitor_, OnConnectionClosed(_, _)).Times(1); | 4643   EXPECT_CALL(visitor_, OnConnectionClosed(_, _)).Times(1); | 
| 4665   connection_.SendConnectionCloseWithDetails(QUIC_NO_ERROR, "no reason"); | 4644   connection_.SendConnectionCloseWithDetails(QUIC_NO_ERROR, "no reason"); | 
| 4666   connection_.SendConnectionCloseWithDetails(QUIC_NO_ERROR, "no reason"); | 4645   connection_.SendConnectionCloseWithDetails(QUIC_NO_ERROR, "no reason"); | 
| 4667 } | 4646 } | 
| 4668 | 4647 | 
| 4669 }  // namespace | 4648 }  // namespace | 
| 4670 }  // namespace test | 4649 }  // namespace test | 
| 4671 }  // namespace net | 4650 }  // namespace net | 
| OLD | NEW | 
|---|