Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(749)

Unified Diff: net/quic/quic_connection_test.cc

Issue 126543005: Fix QUIC faster stats reporting memory leaks and crashes by changing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_ack_notifier_test.cc ('k') | net/quic/quic_packet_creator_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_connection_test.cc
diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc
index a827bda89047145edb0bc7dfd7b7a9e3f78493ce..3487cd0c9a117d54c529d2c46483885656db7348 100644
--- a/net/quic/quic_connection_test.cc
+++ b/net/quic/quic_connection_test.cc
@@ -3178,11 +3178,11 @@ TEST_F(QuicConnectionTest, AckNotifierTriggerCallback) {
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
// Create a delegate which we expect to be called.
- MockAckNotifierDelegate delegate;
- EXPECT_CALL(delegate, OnAckNotification()).Times(1);;
+ scoped_refptr<MockAckNotifierDelegate> delegate(new MockAckNotifierDelegate);
+ EXPECT_CALL(*delegate, OnAckNotification()).Times(1);;
// Send some data, which will register the delegate to be notified.
- connection_.SendStreamDataWithString(1, "foo", 0, !kFin, &delegate);
+ connection_.SendStreamDataWithString(1, "foo", 0, !kFin, delegate.get());
// Process an ACK from the server which should trigger the callback.
EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(1);
@@ -3194,14 +3194,14 @@ TEST_F(QuicConnectionTest, AckNotifierFailToTriggerCallback) {
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
// Create a delegate which we don't expect to be called.
- MockAckNotifierDelegate delegate;
- EXPECT_CALL(delegate, OnAckNotification()).Times(0);;
+ scoped_refptr<MockAckNotifierDelegate> delegate(new MockAckNotifierDelegate);
+ EXPECT_CALL(*delegate, OnAckNotification()).Times(0);;
EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(2);
// Send some data, which will register the delegate to be notified. This will
// not be ACKed and so the delegate should never be called.
- connection_.SendStreamDataWithString(1, "foo", 0, !kFin, &delegate);
+ connection_.SendStreamDataWithString(1, "foo", 0, !kFin, delegate.get());
// Send some other data which we will ACK.
connection_.SendStreamDataWithString(1, "foo", 0, !kFin, NULL);
@@ -3220,15 +3220,15 @@ TEST_F(QuicConnectionTest, AckNotifierCallbackAfterRetransmission) {
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
// Create a delegate which we expect to be called.
- MockAckNotifierDelegate delegate;
- EXPECT_CALL(delegate, OnAckNotification()).Times(1);;
+ scoped_refptr<MockAckNotifierDelegate> delegate(new MockAckNotifierDelegate);
+ EXPECT_CALL(*delegate, OnAckNotification()).Times(1);;
// In total expect ACKs for all 4 packets.
EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(4);
// Send four packets, and register to be notified on ACK of packet 2.
connection_.SendStreamDataWithString(1, "foo", 0, !kFin, NULL);
- connection_.SendStreamDataWithString(1, "bar", 0, !kFin, &delegate);
+ connection_.SendStreamDataWithString(1, "bar", 0, !kFin, delegate.get());
connection_.SendStreamDataWithString(1, "baz", 0, !kFin, NULL);
connection_.SendStreamDataWithString(1, "qux", 0, !kFin, NULL);
@@ -3253,14 +3253,14 @@ TEST_F(QuicConnectionTest, AckNotifierCallbackAfterFECRecovery) {
EXPECT_CALL(visitor_, OnCanWrite()).Times(1).WillOnce(Return(true));
// Create a delegate which we expect to be called.
- MockAckNotifierDelegate delegate;
- EXPECT_CALL(delegate, OnAckNotification()).Times(1);;
+ scoped_refptr<MockAckNotifierDelegate> delegate(new MockAckNotifierDelegate);
+ EXPECT_CALL(*delegate, OnAckNotification()).Times(1);;
// Expect ACKs for 1 packet.
EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _, _)).Times(1);
// Send one packet, and register to be notified on ACK.
- connection_.SendStreamDataWithString(1, "foo", 0, !kFin, &delegate);
+ connection_.SendStreamDataWithString(1, "foo", 0, !kFin, delegate.get());
// Ack packet gets dropped, but we receive an FEC packet that covers it.
// Should recover the Ack packet and trigger the notification callback.
« no previous file with comments | « net/quic/quic_ack_notifier_test.cc ('k') | net/quic/quic_packet_creator_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698