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

Side by Side Diff: net/quic/quic_ack_notifier_test.cc

Issue 872403007: Remove an unneeded hash_set from QuicAckNotifierManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Minor_cleanup_84624803
Patch Set: Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « net/quic/quic_ack_notifier_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_ack_notifier.h" 5 #include "net/quic/quic_ack_notifier.h"
6 6
7 #include "net/quic/test_tools/quic_test_utils.h" 7 #include "net/quic/test_tools/quic_test_utils.h"
8 #include "testing/gmock/include/gmock/gmock.h" 8 #include "testing/gmock/include/gmock/gmock.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 30 matching lines...) Expand all
41 } 41 }
42 42
43 // Should not trigger callback if we never provide all the seqnums. 43 // Should not trigger callback if we never provide all the seqnums.
44 TEST_F(QuicAckNotifierTest, DoesNotTrigger) { 44 TEST_F(QuicAckNotifierTest, DoesNotTrigger) {
45 // Should not trigger callback as not all packets have been seen. 45 // Should not trigger callback as not all packets have been seen.
46 EXPECT_CALL(*delegate_, OnAckNotification(_, _, _)).Times(0); 46 EXPECT_CALL(*delegate_, OnAckNotification(_, _, _)).Times(0);
47 EXPECT_FALSE(notifier_->OnAck(26, zero_)); 47 EXPECT_FALSE(notifier_->OnAck(26, zero_));
48 EXPECT_FALSE(notifier_->OnAck(99, zero_)); 48 EXPECT_FALSE(notifier_->OnAck(99, zero_));
49 } 49 }
50 50
51 // Should not trigger callback if we abandon all three packets.
52 TEST_F(QuicAckNotifierTest, AbandonDoesNotTrigger) {
53 // Should not trigger callback as not all packets have been seen.
54 EXPECT_CALL(*delegate_, OnAckNotification(_, _, _)).Times(0);
55 EXPECT_FALSE(notifier_->OnPacketAbandoned());
56 EXPECT_FALSE(notifier_->OnPacketAbandoned());
57 EXPECT_TRUE(notifier_->OnPacketAbandoned());
58 }
59
51 // Should trigger even after updating sequence numbers and receiving ACKs for 60 // Should trigger even after updating sequence numbers and receiving ACKs for
52 // new sequeunce numbers. 61 // new sequeunce numbers.
53 TEST_F(QuicAckNotifierTest, UpdateSeqNums) { 62 TEST_F(QuicAckNotifierTest, UpdateSeqNums) {
54 // Update a couple of the sequence numbers (i.e. retransmitted packets) 63 // Update a couple of the sequence numbers (i.e. retransmitted packets)
55 notifier_->OnPacketRetransmitted(20); 64 notifier_->OnPacketRetransmitted(20);
56 notifier_->OnPacketRetransmitted(3); 65 notifier_->OnPacketRetransmitted(3);
57 66
58 EXPECT_CALL(*delegate_, OnAckNotification(2, 20 + 3, _)).Times(1); 67 EXPECT_CALL(*delegate_, OnAckNotification(2, 20 + 3, _)).Times(1);
59 EXPECT_FALSE(notifier_->OnAck(26, zero_)); // original 68 EXPECT_FALSE(notifier_->OnAck(26, zero_)); // original
60 EXPECT_FALSE(notifier_->OnAck(3000, zero_)); // updated 69 EXPECT_FALSE(notifier_->OnAck(3000, zero_)); // updated
61 EXPECT_TRUE(notifier_->OnAck(3001, zero_)); // updated 70 EXPECT_TRUE(notifier_->OnAck(3001, zero_)); // updated
62 } 71 }
63 72
64 // Make sure the delegate is called with the delta time from the last ACK. 73 // Make sure the delegate is called with the delta time from the last ACK.
65 TEST_F(QuicAckNotifierTest, DeltaTime) { 74 TEST_F(QuicAckNotifierTest, DeltaTime) {
66 const QuicTime::Delta first_delta = QuicTime::Delta::FromSeconds(5); 75 const QuicTime::Delta first_delta = QuicTime::Delta::FromSeconds(5);
67 const QuicTime::Delta second_delta = QuicTime::Delta::FromSeconds(33); 76 const QuicTime::Delta second_delta = QuicTime::Delta::FromSeconds(33);
68 const QuicTime::Delta third_delta = QuicTime::Delta::FromSeconds(10); 77 const QuicTime::Delta third_delta = QuicTime::Delta::FromSeconds(10);
69 78
70 EXPECT_CALL(*delegate_, OnAckNotification(0, 0, third_delta)).Times(1); 79 EXPECT_CALL(*delegate_, OnAckNotification(0, 0, third_delta)).Times(1);
71 EXPECT_FALSE(notifier_->OnAck(26, first_delta)); 80 EXPECT_FALSE(notifier_->OnAck(26, first_delta));
72 EXPECT_FALSE(notifier_->OnAck(99, second_delta)); 81 EXPECT_FALSE(notifier_->OnAck(99, second_delta));
73 EXPECT_TRUE(notifier_->OnAck(1234, third_delta)); 82 EXPECT_TRUE(notifier_->OnAck(1234, third_delta));
74 } 83 }
75 84
76 } // namespace 85 } // namespace
77 } // namespace test 86 } // namespace test
78 } // namespace net 87 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_ack_notifier_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698