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

Side by Side Diff: net/quic/test_tools/simulator/quic_endpoint_test.cc

Issue 2916033003: Landing Recent QUIC changes until 03:18 AM, May 28, UTC (Closed)
Patch Set: A few more EXPORTs. Created 3 years, 6 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/test_tools/quic_session_peer.cc ('k') | net/tools/quic/end_to_end_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/test_tools/simulator/quic_endpoint.h" 5 #include "net/quic/test_tools/simulator/quic_endpoint.h"
6 6
7 #include "net/quic/platform/api/quic_ptr_util.h" 7 #include "net/quic/platform/api/quic_ptr_util.h"
8 #include "net/quic/platform/api/quic_test.h" 8 #include "net/quic/platform/api/quic_test.h"
9 #include "net/quic/test_tools/quic_connection_peer.h" 9 #include "net/quic/test_tools/quic_connection_peer.h"
10 #include "net/quic/test_tools/quic_test_utils.h" 10 #include "net/quic/test_tools/quic_test_utils.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 EXPECT_EQ(1024u * 1024u, endpoint_a.bytes_transferred()); 140 EXPECT_EQ(1024u * 1024u, endpoint_a.bytes_transferred());
141 EXPECT_EQ(1024u * 1024u, endpoint_b.bytes_transferred()); 141 EXPECT_EQ(1024u * 1024u, endpoint_b.bytes_transferred());
142 EXPECT_EQ(1024u * 1024u, endpoint_a.bytes_received()); 142 EXPECT_EQ(1024u * 1024u, endpoint_a.bytes_received());
143 EXPECT_EQ(1024u * 1024u, endpoint_b.bytes_received()); 143 EXPECT_EQ(1024u * 1024u, endpoint_b.bytes_received());
144 EXPECT_FALSE(endpoint_a.wrong_data_received()); 144 EXPECT_FALSE(endpoint_a.wrong_data_received());
145 EXPECT_FALSE(endpoint_b.wrong_data_received()); 145 EXPECT_FALSE(endpoint_b.wrong_data_received());
146 } 146 }
147 147
148 // Simulate three hosts trying to send data to a fourth one simultaneously. 148 // Simulate three hosts trying to send data to a fourth one simultaneously.
149 TEST_F(QuicEndpointTest, Competition) { 149 TEST_F(QuicEndpointTest, Competition) {
150 simulator_.set_enable_random_delays(true);
151
152 auto endpoint_a = QuicMakeUnique<QuicEndpoint>( 150 auto endpoint_a = QuicMakeUnique<QuicEndpoint>(
153 &simulator_, "Endpoint A", "Endpoint D (A)", Perspective::IS_CLIENT, 42); 151 &simulator_, "Endpoint A", "Endpoint D (A)", Perspective::IS_CLIENT, 42);
154 auto endpoint_b = QuicMakeUnique<QuicEndpoint>( 152 auto endpoint_b = QuicMakeUnique<QuicEndpoint>(
155 &simulator_, "Endpoint B", "Endpoint D (B)", Perspective::IS_CLIENT, 43); 153 &simulator_, "Endpoint B", "Endpoint D (B)", Perspective::IS_CLIENT, 43);
156 auto endpoint_c = QuicMakeUnique<QuicEndpoint>( 154 auto endpoint_c = QuicMakeUnique<QuicEndpoint>(
157 &simulator_, "Endpoint C", "Endpoint D (C)", Perspective::IS_CLIENT, 44); 155 &simulator_, "Endpoint C", "Endpoint D (C)", Perspective::IS_CLIENT, 44);
158 auto endpoint_d_a = QuicMakeUnique<QuicEndpoint>( 156 auto endpoint_d_a = QuicMakeUnique<QuicEndpoint>(
159 &simulator_, "Endpoint D (A)", "Endpoint A", Perspective::IS_SERVER, 157 &simulator_, "Endpoint D (A)", "Endpoint A", Perspective::IS_SERVER,
160 GetPeerInMemoryConnectionId(42)); 158 GetPeerInMemoryConnectionId(42));
161 auto endpoint_d_b = QuicMakeUnique<QuicEndpoint>( 159 auto endpoint_d_b = QuicMakeUnique<QuicEndpoint>(
(...skipping 26 matching lines...) Expand all
188 } 186 }
189 for (QuicEndpoint* endpoint : 187 for (QuicEndpoint* endpoint :
190 {endpoint_d_a.get(), endpoint_d_b.get(), endpoint_d_c.get()}) { 188 {endpoint_d_a.get(), endpoint_d_b.get(), endpoint_d_c.get()}) {
191 EXPECT_EQ(2u * 1024u * 1024u, endpoint->bytes_received()); 189 EXPECT_EQ(2u * 1024u * 1024u, endpoint->bytes_received());
192 EXPECT_FALSE(endpoint->wrong_data_received()); 190 EXPECT_FALSE(endpoint->wrong_data_received());
193 } 191 }
194 } 192 }
195 193
196 } // namespace simulator 194 } // namespace simulator
197 } // namespace net 195 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_session_peer.cc ('k') | net/tools/quic/end_to_end_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698