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

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

Issue 2322233004: Landing Recent QUIC changes until Sun Sep 4 03:41:00 (Closed)
Patch Set: Remove simulation files from the build. Created 4 years, 3 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/core/quic_protocol.cc ('k') | net/quic/core/quic_sent_packet_manager.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/core/quic_protocol.h" 5 #include "net/quic/core/quic_protocol.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "net/quic/core/quic_flags.h" 10 #include "net/quic/core/quic_flags.h"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 EXPECT_EQ("{ path_id: 1 }\n", stream.str()); 284 EXPECT_EQ("{ path_id: 1 }\n", stream.str());
285 } 285 }
286 286
287 TEST(QuicProtocolTest, FilterSupportedVersions) { 287 TEST(QuicProtocolTest, FilterSupportedVersions) {
288 QuicFlagSaver flags; 288 QuicFlagSaver flags;
289 QuicVersionVector all_versions = { 289 QuicVersionVector all_versions = {
290 QUIC_VERSION_30, QUIC_VERSION_31, QUIC_VERSION_32, QUIC_VERSION_33, 290 QUIC_VERSION_30, QUIC_VERSION_31, QUIC_VERSION_32, QUIC_VERSION_33,
291 QUIC_VERSION_34, QUIC_VERSION_35, QUIC_VERSION_36}; 291 QUIC_VERSION_34, QUIC_VERSION_35, QUIC_VERSION_36};
292 292
293 FLAGS_quic_disable_pre_32 = true; 293 FLAGS_quic_disable_pre_32 = true;
294 FLAGS_quic_disable_pre_34 = true;
294 FLAGS_quic_enable_version_35 = false; 295 FLAGS_quic_enable_version_35 = false;
295 FLAGS_quic_enable_version_36_v2 = false; 296 FLAGS_quic_enable_version_36_v2 = false;
296 297
297 QuicVersionVector filtered_versions = FilterSupportedVersions(all_versions); 298 QuicVersionVector filtered_versions = FilterSupportedVersions(all_versions);
298 ASSERT_EQ(3u, filtered_versions.size()); 299 ASSERT_EQ(1u, filtered_versions.size());
299 EXPECT_EQ(QUIC_VERSION_32, filtered_versions[0]); 300 EXPECT_EQ(QUIC_VERSION_34, filtered_versions[0]);
300 EXPECT_EQ(QUIC_VERSION_33, filtered_versions[1]); 301 }
301 EXPECT_EQ(QUIC_VERSION_34, filtered_versions[2]); 302
303 TEST(QuicProtocolTest, FilterSupportedVersionsAllVersions) {
304 QuicFlagSaver flags;
305 QuicVersionVector all_versions = {
306 QUIC_VERSION_30, QUIC_VERSION_31, QUIC_VERSION_32, QUIC_VERSION_33,
307 QUIC_VERSION_34, QUIC_VERSION_35, QUIC_VERSION_36};
308
309 FLAGS_quic_disable_pre_32 = false;
310 FLAGS_quic_disable_pre_34 = false;
311 FLAGS_quic_enable_version_35 = true;
312 FLAGS_quic_enable_version_36_v2 = true;
313
314 QuicVersionVector filtered_versions = FilterSupportedVersions(all_versions);
315 ASSERT_EQ(all_versions, filtered_versions);
316 }
317
318 TEST(QuicProtocolTest, FilterSupportedVersionsNo36) {
319 QuicFlagSaver flags;
320 QuicVersionVector all_versions = {
321 QUIC_VERSION_30, QUIC_VERSION_31, QUIC_VERSION_32, QUIC_VERSION_33,
322 QUIC_VERSION_34, QUIC_VERSION_35, QUIC_VERSION_36};
323
324 FLAGS_quic_disable_pre_32 = false;
325 FLAGS_quic_disable_pre_34 = false;
326 FLAGS_quic_enable_version_35 = true;
327 FLAGS_quic_enable_version_36_v2 = false;
328
329 all_versions.pop_back(); // Remove 36
330
331 ASSERT_EQ(all_versions, FilterSupportedVersions(all_versions));
332 }
333
334 TEST(QuicProtocolTest, FilterSupportedVersionsNo35) {
335 QuicFlagSaver flags;
336 QuicVersionVector all_versions = {
337 QUIC_VERSION_30, QUIC_VERSION_31, QUIC_VERSION_32, QUIC_VERSION_33,
338 QUIC_VERSION_34, QUIC_VERSION_35, QUIC_VERSION_36};
339
340 FLAGS_quic_disable_pre_32 = false;
341 FLAGS_quic_disable_pre_34 = false;
342 FLAGS_quic_enable_version_35 = true;
343 FLAGS_quic_enable_version_36_v2 = true;
344
345 all_versions.pop_back(); // Remove 36
346 all_versions.pop_back(); // Remove 35
347
348 ASSERT_EQ(all_versions, FilterSupportedVersions(all_versions));
349 }
350
351 TEST(QuicProtocolTest, FilterSupportedVersionsNoPre32) {
352 QuicFlagSaver flags;
353 QuicVersionVector all_versions = {
354 QUIC_VERSION_30, QUIC_VERSION_31, QUIC_VERSION_32, QUIC_VERSION_33,
355 QUIC_VERSION_34, QUIC_VERSION_35, QUIC_VERSION_36};
356
357 FLAGS_quic_disable_pre_32 = true;
358 FLAGS_quic_disable_pre_34 = false;
359 FLAGS_quic_enable_version_35 = true;
360 FLAGS_quic_enable_version_36_v2 = true;
361
362 all_versions.erase(all_versions.begin()); // Remove 30
363 all_versions.erase(all_versions.begin()); // Remove 31
364
365 ASSERT_EQ(all_versions, FilterSupportedVersions(all_versions));
366 }
367
368 TEST(QuicProtocolTest, FilterSupportedVersionsNoPre34) {
369 QuicFlagSaver flags;
370 QuicVersionVector all_versions = {
371 QUIC_VERSION_30, QUIC_VERSION_31, QUIC_VERSION_32, QUIC_VERSION_33,
372 QUIC_VERSION_34, QUIC_VERSION_35, QUIC_VERSION_36};
373
374 FLAGS_quic_disable_pre_32 = false;
375 FLAGS_quic_disable_pre_34 = true;
376 FLAGS_quic_enable_version_35 = true;
377 FLAGS_quic_enable_version_36_v2 = true;
378
379 all_versions.erase(all_versions.begin()); // Remove 30
380 all_versions.erase(all_versions.begin()); // Remove 31
381 all_versions.erase(all_versions.begin()); // Remove 32
382 all_versions.erase(all_versions.begin()); // Remove 33
383
384 ASSERT_EQ(all_versions, FilterSupportedVersions(all_versions));
302 } 385 }
303 386
304 TEST(QuicProtocolTest, QuicVersionManager) { 387 TEST(QuicProtocolTest, QuicVersionManager) {
305 QuicFlagSaver flags; 388 QuicFlagSaver flags;
306 FLAGS_quic_enable_version_35 = false; 389 FLAGS_quic_enable_version_35 = false;
307 FLAGS_quic_enable_version_36_v2 = false; 390 FLAGS_quic_enable_version_36_v2 = false;
308 QuicVersionManager manager(AllSupportedVersions()); 391 QuicVersionManager manager(AllSupportedVersions());
309 EXPECT_EQ(FilterSupportedVersions(AllSupportedVersions()), 392 EXPECT_EQ(FilterSupportedVersions(AllSupportedVersions()),
310 manager.GetSupportedVersions()); 393 manager.GetSupportedVersions());
311 FLAGS_quic_enable_version_35 = true; 394 FLAGS_quic_enable_version_35 = true;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 EXPECT_EQ(2u, queue.NumIntervals()); 544 EXPECT_EQ(2u, queue.NumIntervals());
462 EXPECT_TRUE(queue.Contains(10)); 545 EXPECT_TRUE(queue.Contains(10));
463 EXPECT_TRUE(queue.Contains(11)); 546 EXPECT_TRUE(queue.Contains(11));
464 EXPECT_TRUE(queue.Contains(20)); 547 EXPECT_TRUE(queue.Contains(20));
465 EXPECT_TRUE(queue.Contains(21)); 548 EXPECT_TRUE(queue.Contains(21));
466 } 549 }
467 550
468 } // namespace 551 } // namespace
469 } // namespace test 552 } // namespace test
470 } // namespace net 553 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_protocol.cc ('k') | net/quic/core/quic_sent_packet_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698