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

Side by Side Diff: net/quic/core/quic_multipath_received_packet_manager_test.cc

Issue 2249813002: Create EXPECT_QUIC_BUG macro, and modify QUIC tests to use it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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/core/quic_multipath_received_packet_manager.h" 5 #include "net/quic/core/quic_multipath_received_packet_manager.h"
6 6
7 #include "net/quic/core/quic_connection_stats.h" 7 #include "net/quic/core/quic_connection_stats.h"
8 #include "net/quic/core/quic_flags.h" 8 #include "net/quic/core/quic_flags.h"
9 #include "net/quic/test_tools/quic_test_utils.h" 9 #include "net/quic/test_tools/quic_test_utils.h"
10 #include "net/test/gtest_util.h" 10 #include "net/test/gtest_util.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 QuicPacketHeader header_; 60 QuicPacketHeader header_;
61 }; 61 };
62 62
63 TEST_F(QuicMultipathReceivedPacketManagerTest, OnPathCreatedAndClosed) { 63 TEST_F(QuicMultipathReceivedPacketManagerTest, OnPathCreatedAndClosed) {
64 EXPECT_TRUE( 64 EXPECT_TRUE(
65 QuicMultipathReceivedPacketManagerPeer::PathReceivedPacketManagerExists( 65 QuicMultipathReceivedPacketManagerPeer::PathReceivedPacketManagerExists(
66 &multipath_manager_, kDefaultPathId)); 66 &multipath_manager_, kDefaultPathId));
67 EXPECT_TRUE( 67 EXPECT_TRUE(
68 QuicMultipathReceivedPacketManagerPeer::PathReceivedPacketManagerExists( 68 QuicMultipathReceivedPacketManagerPeer::PathReceivedPacketManagerExists(
69 &multipath_manager_, kPathId1)); 69 &multipath_manager_, kPathId1));
70 EXPECT_DFATAL(multipath_manager_.OnPathCreated(kDefaultPathId, &stats_), 70 EXPECT_QUIC_BUG(multipath_manager_.OnPathCreated(kDefaultPathId, &stats_),
71 "Received packet manager of path already exists"); 71 "Received packet manager of path already exists");
72 // Path 2 created. 72 // Path 2 created.
73 multipath_manager_.OnPathCreated(kPathId2, &stats_); 73 multipath_manager_.OnPathCreated(kPathId2, &stats_);
74 EXPECT_TRUE( 74 EXPECT_TRUE(
75 QuicMultipathReceivedPacketManagerPeer::PathReceivedPacketManagerExists( 75 QuicMultipathReceivedPacketManagerPeer::PathReceivedPacketManagerExists(
76 &multipath_manager_, kPathId2)); 76 &multipath_manager_, kPathId2));
77 EXPECT_FALSE( 77 EXPECT_FALSE(
78 QuicMultipathReceivedPacketManagerPeer::PathReceivedPacketManagerExists( 78 QuicMultipathReceivedPacketManagerPeer::PathReceivedPacketManagerExists(
79 &multipath_manager_, kPathId3)); 79 &multipath_manager_, kPathId3));
80 // Path 3 created. 80 // Path 3 created.
81 multipath_manager_.OnPathCreated(kPathId3, &stats_); 81 multipath_manager_.OnPathCreated(kPathId3, &stats_);
82 EXPECT_TRUE( 82 EXPECT_TRUE(
83 QuicMultipathReceivedPacketManagerPeer::PathReceivedPacketManagerExists( 83 QuicMultipathReceivedPacketManagerPeer::PathReceivedPacketManagerExists(
84 &multipath_manager_, kPathId3)); 84 &multipath_manager_, kPathId3));
85 85
86 // Path 0 closed. 86 // Path 0 closed.
87 multipath_manager_.OnPathClosed(kDefaultPathId); 87 multipath_manager_.OnPathClosed(kDefaultPathId);
88 EXPECT_FALSE( 88 EXPECT_FALSE(
89 QuicMultipathReceivedPacketManagerPeer::PathReceivedPacketManagerExists( 89 QuicMultipathReceivedPacketManagerPeer::PathReceivedPacketManagerExists(
90 &multipath_manager_, kDefaultPathId)); 90 &multipath_manager_, kDefaultPathId));
91 EXPECT_DFATAL(multipath_manager_.OnPathClosed(kDefaultPathId), 91 EXPECT_QUIC_BUG(multipath_manager_.OnPathClosed(kDefaultPathId),
92 "Received packet manager of path does not exist"); 92 "Received packet manager of path does not exist");
93 } 93 }
94 94
95 TEST_F(QuicMultipathReceivedPacketManagerTest, RecordPacketReceived) { 95 TEST_F(QuicMultipathReceivedPacketManagerTest, RecordPacketReceived) {
96 EXPECT_CALL(*manager_0_, RecordPacketReceived(_, _, _)).Times(1); 96 EXPECT_CALL(*manager_0_, RecordPacketReceived(_, _, _)).Times(1);
97 multipath_manager_.RecordPacketReceived(kDefaultPathId, kBytes, header_, 97 multipath_manager_.RecordPacketReceived(kDefaultPathId, kBytes, header_,
98 QuicTime::Zero()); 98 QuicTime::Zero());
99 EXPECT_DFATAL(multipath_manager_.RecordPacketReceived( 99 EXPECT_QUIC_BUG(multipath_manager_.RecordPacketReceived(
100 kPathId2, kBytes, header_, QuicTime::Zero()), 100 kPathId2, kBytes, header_, QuicTime::Zero()),
101 "Received a packet on a non-existent path"); 101 "Received a packet on a non-existent path");
102 } 102 }
103 103
104 TEST_F(QuicMultipathReceivedPacketManagerTest, IsMissing) { 104 TEST_F(QuicMultipathReceivedPacketManagerTest, IsMissing) {
105 EXPECT_CALL(*manager_0_, IsMissing(header_.packet_number)) 105 EXPECT_CALL(*manager_0_, IsMissing(header_.packet_number))
106 .WillOnce(Return(true)); 106 .WillOnce(Return(true));
107 EXPECT_CALL(*manager_1_, IsMissing(header_.packet_number)) 107 EXPECT_CALL(*manager_1_, IsMissing(header_.packet_number))
108 .WillOnce(Return(false)); 108 .WillOnce(Return(false));
109 EXPECT_TRUE( 109 EXPECT_TRUE(
110 multipath_manager_.IsMissing(kDefaultPathId, header_.packet_number)); 110 multipath_manager_.IsMissing(kDefaultPathId, header_.packet_number));
111 EXPECT_FALSE(multipath_manager_.IsMissing(kPathId1, header_.packet_number)); 111 EXPECT_FALSE(multipath_manager_.IsMissing(kPathId1, header_.packet_number));
112 EXPECT_DFATAL(multipath_manager_.IsMissing(kPathId2, header_.packet_number), 112 EXPECT_QUIC_BUG(multipath_manager_.IsMissing(kPathId2, header_.packet_number),
113 "Check whether a packet is missing on a non-existent path"); 113 "Check whether a packet is missing on a non-existent path");
114 } 114 }
115 115
116 TEST_F(QuicMultipathReceivedPacketManagerTest, IsAwaitingPacket) { 116 TEST_F(QuicMultipathReceivedPacketManagerTest, IsAwaitingPacket) {
117 EXPECT_CALL(*manager_0_, IsAwaitingPacket(header_.packet_number)) 117 EXPECT_CALL(*manager_0_, IsAwaitingPacket(header_.packet_number))
118 .WillOnce(Return(true)); 118 .WillOnce(Return(true));
119 EXPECT_CALL(*manager_1_, IsAwaitingPacket(header_.packet_number)) 119 EXPECT_CALL(*manager_1_, IsAwaitingPacket(header_.packet_number))
120 .WillOnce(Return(false)); 120 .WillOnce(Return(false));
121 EXPECT_TRUE(multipath_manager_.IsAwaitingPacket(kDefaultPathId, 121 EXPECT_TRUE(multipath_manager_.IsAwaitingPacket(kDefaultPathId,
122 header_.packet_number)); 122 header_.packet_number));
123 EXPECT_FALSE( 123 EXPECT_FALSE(
124 multipath_manager_.IsAwaitingPacket(kPathId1, header_.packet_number)); 124 multipath_manager_.IsAwaitingPacket(kPathId1, header_.packet_number));
125 EXPECT_DFATAL( 125 EXPECT_QUIC_BUG(
126 multipath_manager_.IsAwaitingPacket(kPathId2, header_.packet_number), 126 multipath_manager_.IsAwaitingPacket(kPathId2, header_.packet_number),
127 "Check whether a packet is awaited on a non-existent path"); 127 "Check whether a packet is awaited on a non-existent path");
128 } 128 }
129 129
130 TEST_F(QuicMultipathReceivedPacketManagerTest, 130 TEST_F(QuicMultipathReceivedPacketManagerTest,
131 UpdatePacketInformationSentByPeer) { 131 UpdatePacketInformationSentByPeer) {
132 std::vector<QuicStopWaitingFrame> stop_waitings; 132 std::vector<QuicStopWaitingFrame> stop_waitings;
133 QuicStopWaitingFrame stop_waiting_0; 133 QuicStopWaitingFrame stop_waiting_0;
134 QuicStopWaitingFrame stop_waiting_1; 134 QuicStopWaitingFrame stop_waiting_1;
135 QuicStopWaitingFrame stop_waiting_2; 135 QuicStopWaitingFrame stop_waiting_2;
136 stop_waiting_0.path_id = kDefaultPathId; 136 stop_waiting_0.path_id = kDefaultPathId;
137 stop_waiting_1.path_id = kPathId1; 137 stop_waiting_1.path_id = kPathId1;
138 stop_waiting_2.path_id = kPathId2; 138 stop_waiting_2.path_id = kPathId2;
139 stop_waitings.push_back(stop_waiting_0); 139 stop_waitings.push_back(stop_waiting_0);
140 stop_waitings.push_back(stop_waiting_1); 140 stop_waitings.push_back(stop_waiting_1);
141 stop_waitings.push_back(stop_waiting_2); 141 stop_waitings.push_back(stop_waiting_2);
142 EXPECT_CALL(*manager_0_, UpdatePacketInformationSentByPeer(_)).Times(1); 142 EXPECT_CALL(*manager_0_, UpdatePacketInformationSentByPeer(_)).Times(1);
143 EXPECT_CALL(*manager_1_, UpdatePacketInformationSentByPeer(_)).Times(1); 143 EXPECT_CALL(*manager_1_, UpdatePacketInformationSentByPeer(_)).Times(1);
144 multipath_manager_.UpdatePacketInformationSentByPeer(stop_waitings); 144 multipath_manager_.UpdatePacketInformationSentByPeer(stop_waitings);
145 } 145 }
146 146
147 TEST_F(QuicMultipathReceivedPacketManagerTest, HasNewMissingPackets) { 147 TEST_F(QuicMultipathReceivedPacketManagerTest, HasNewMissingPackets) {
148 EXPECT_CALL(*manager_0_, HasNewMissingPackets()).WillOnce(Return(true)); 148 EXPECT_CALL(*manager_0_, HasNewMissingPackets()).WillOnce(Return(true));
149 EXPECT_CALL(*manager_1_, HasNewMissingPackets()).WillOnce(Return(false)); 149 EXPECT_CALL(*manager_1_, HasNewMissingPackets()).WillOnce(Return(false));
150 EXPECT_TRUE(multipath_manager_.HasNewMissingPackets(kDefaultPathId)); 150 EXPECT_TRUE(multipath_manager_.HasNewMissingPackets(kDefaultPathId));
151 EXPECT_FALSE(multipath_manager_.HasNewMissingPackets(kPathId1)); 151 EXPECT_FALSE(multipath_manager_.HasNewMissingPackets(kPathId1));
152 EXPECT_DFATAL(multipath_manager_.HasNewMissingPackets(kPathId2), 152 EXPECT_QUIC_BUG(
153 "Check whether has new missing packets on a non-existent path"); 153 multipath_manager_.HasNewMissingPackets(kPathId2),
154 "Check whether has new missing packets on a non-existent path");
154 } 155 }
155 156
156 } // namespace 157 } // namespace
157 } // namespace test 158 } // namespace test
158 } // namespace net 159 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_headers_stream_test.cc ('k') | net/quic/core/quic_multipath_sent_packet_manager_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698