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

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

Issue 2323933003: Disable QUIC versions 33 and earlier, protected by FLAGS_quic_disable_pre_34. (Closed)
Patch Set: 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') | 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 (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) {
Ryan Hamilton 2016/09/08 22:39:25 Oh, actually, you need a QuicFlagSaver in these ne
304 QuicVersionVector all_versions = {
305 QUIC_VERSION_30, QUIC_VERSION_31, QUIC_VERSION_32, QUIC_VERSION_33,
306 QUIC_VERSION_34, QUIC_VERSION_35, QUIC_VERSION_36};
307
308 FLAGS_quic_disable_pre_32 = false;
309 FLAGS_quic_disable_pre_34 = false;
310 FLAGS_quic_enable_version_35 = true;
311 FLAGS_quic_enable_version_36_v2 = true;
312
313 QuicVersionVector filtered_versions = FilterSupportedVersions(all_versions);
314 ASSERT_EQ(all_versions, filtered_versions);
315 }
316
317 TEST(QuicProtocolTest, FilterSupportedVersionsNo36) {
318 QuicVersionVector all_versions = {
319 QUIC_VERSION_30, QUIC_VERSION_31, QUIC_VERSION_32, QUIC_VERSION_33,
320 QUIC_VERSION_34, QUIC_VERSION_35, QUIC_VERSION_36};
321
322 FLAGS_quic_disable_pre_32 = false;
323 FLAGS_quic_disable_pre_34 = false;
324 FLAGS_quic_enable_version_35 = true;
325 FLAGS_quic_enable_version_36_v2 = false;
326
327 all_versions.pop_back(); // Remove 36
328
329 ASSERT_EQ(all_versions, FilterSupportedVersions(all_versions));
330 }
331
332 TEST(QuicProtocolTest, FilterSupportedVersionsNo35) {
333 QuicVersionVector all_versions = {
334 QUIC_VERSION_30, QUIC_VERSION_31, QUIC_VERSION_32, QUIC_VERSION_33,
335 QUIC_VERSION_34, QUIC_VERSION_35, QUIC_VERSION_36};
336
337 FLAGS_quic_disable_pre_32 = false;
338 FLAGS_quic_disable_pre_34 = false;
339 FLAGS_quic_enable_version_35 = true;
340 FLAGS_quic_enable_version_36_v2 = true;
341
342 all_versions.pop_back(); // Remove 36
343 all_versions.pop_back(); // Remove 35
344
345 ASSERT_EQ(all_versions, FilterSupportedVersions(all_versions));
346 }
347
348 TEST(QuicProtocolTest, FilterSupportedVersionsNoPre32) {
349 QuicVersionVector all_versions = {
350 QUIC_VERSION_30, QUIC_VERSION_31, QUIC_VERSION_32, QUIC_VERSION_33,
351 QUIC_VERSION_34, QUIC_VERSION_35, QUIC_VERSION_36};
352
353 FLAGS_quic_disable_pre_32 = true;
354 FLAGS_quic_disable_pre_34 = false;
355 FLAGS_quic_enable_version_35 = true;
356 FLAGS_quic_enable_version_36_v2 = true;
357
358 all_versions.erase(all_versions.begin()); // Remove 30
359 all_versions.erase(all_versions.begin()); // Remove 31
360
361 ASSERT_EQ(all_versions, FilterSupportedVersions(all_versions));
362 }
363
364 TEST(QuicProtocolTest, FilterSupportedVersionsNoPre34) {
365 QuicVersionVector all_versions = {
366 QUIC_VERSION_30, QUIC_VERSION_31, QUIC_VERSION_32, QUIC_VERSION_33,
367 QUIC_VERSION_34, QUIC_VERSION_35, QUIC_VERSION_36};
368
369 FLAGS_quic_disable_pre_32 = false;
370 FLAGS_quic_disable_pre_34 = true;
371 FLAGS_quic_enable_version_35 = true;
372 FLAGS_quic_enable_version_36_v2 = true;
373
374 all_versions.erase(all_versions.begin()); // Remove 30
375 all_versions.erase(all_versions.begin()); // Remove 31
376 all_versions.erase(all_versions.begin()); // Remove 32
377 all_versions.erase(all_versions.begin()); // Remove 33
378
379 ASSERT_EQ(all_versions, FilterSupportedVersions(all_versions));
302 } 380 }
303 381
304 TEST(QuicProtocolTest, QuicVersionManager) { 382 TEST(QuicProtocolTest, QuicVersionManager) {
305 QuicFlagSaver flags; 383 QuicFlagSaver flags;
306 FLAGS_quic_enable_version_35 = false; 384 FLAGS_quic_enable_version_35 = false;
307 FLAGS_quic_enable_version_36_v2 = false; 385 FLAGS_quic_enable_version_36_v2 = false;
308 QuicVersionManager manager(AllSupportedVersions()); 386 QuicVersionManager manager(AllSupportedVersions());
309 EXPECT_EQ(FilterSupportedVersions(AllSupportedVersions()), 387 EXPECT_EQ(FilterSupportedVersions(AllSupportedVersions()),
310 manager.GetSupportedVersions()); 388 manager.GetSupportedVersions());
311 FLAGS_quic_enable_version_35 = true; 389 FLAGS_quic_enable_version_35 = true;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 EXPECT_EQ(2u, queue.NumIntervals()); 539 EXPECT_EQ(2u, queue.NumIntervals());
462 EXPECT_TRUE(queue.Contains(10)); 540 EXPECT_TRUE(queue.Contains(10));
463 EXPECT_TRUE(queue.Contains(11)); 541 EXPECT_TRUE(queue.Contains(11));
464 EXPECT_TRUE(queue.Contains(20)); 542 EXPECT_TRUE(queue.Contains(20));
465 EXPECT_TRUE(queue.Contains(21)); 543 EXPECT_TRUE(queue.Contains(21));
466 } 544 }
467 545
468 } // namespace 546 } // namespace
469 } // namespace test 547 } // namespace test
470 } // namespace net 548 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_protocol.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698