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

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

Issue 2295043004: Make QUIC tests restore flags to their default values (Closed)
Patch Set: remove the workaround 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/chromium/quic_network_transaction_unittest.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"
11 #include "net/quic/core/quic_utils.h" 11 #include "net/quic/core/quic_utils.h"
12 #include "net/quic/test_tools/quic_test_utils.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 14
14 namespace net { 15 namespace net {
15 namespace test { 16 namespace test {
16 namespace { 17 namespace {
17 18
18 TEST(QuicProtocolTest, AdjustErrorForVersion) { 19 TEST(QuicProtocolTest, AdjustErrorForVersion) {
19 ASSERT_EQ(14, QUIC_STREAM_LAST_ERROR) 20 ASSERT_EQ(14, QUIC_STREAM_LAST_ERROR)
20 << "Any additions to QuicRstStreamErrorCode require an addition to " 21 << "Any additions to QuicRstStreamErrorCode require an addition to "
21 << "AdjustErrorForVersion and this associated test."; 22 << "AdjustErrorForVersion and this associated test.";
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 278
278 TEST(QuicProtocolTest, PathCloseFrameToString) { 279 TEST(QuicProtocolTest, PathCloseFrameToString) {
279 QuicPathCloseFrame frame; 280 QuicPathCloseFrame frame;
280 frame.path_id = 1; 281 frame.path_id = 1;
281 std::ostringstream stream; 282 std::ostringstream stream;
282 stream << frame; 283 stream << frame;
283 EXPECT_EQ("{ path_id: 1 }\n", stream.str()); 284 EXPECT_EQ("{ path_id: 1 }\n", stream.str());
284 } 285 }
285 286
286 TEST(QuicProtocolTest, FilterSupportedVersions) { 287 TEST(QuicProtocolTest, FilterSupportedVersions) {
288 ValueRestore<bool> old_v35_flag(&FLAGS_quic_enable_version_35,
289 FLAGS_quic_enable_version_35);
290 ValueRestore<bool> old_v36_flag(&FLAGS_quic_enable_version_36,
291 FLAGS_quic_enable_version_36);
292 ValueRestore<bool> old_v36_2_flag(&FLAGS_quic_enable_version_36_v2,
293 FLAGS_quic_enable_version_36_v2);
287 QuicVersionVector all_versions = { 294 QuicVersionVector all_versions = {
288 QUIC_VERSION_30, QUIC_VERSION_31, QUIC_VERSION_32, QUIC_VERSION_33, 295 QUIC_VERSION_30, QUIC_VERSION_31, QUIC_VERSION_32, QUIC_VERSION_33,
289 QUIC_VERSION_34, QUIC_VERSION_35, QUIC_VERSION_36}; 296 QUIC_VERSION_34, QUIC_VERSION_35, QUIC_VERSION_36};
290 297
291 FLAGS_quic_disable_pre_32 = true; 298 FLAGS_quic_disable_pre_32 = true;
292 FLAGS_quic_enable_version_35 = false; 299 FLAGS_quic_enable_version_35 = false;
293 FLAGS_quic_enable_version_36_v2 = false; 300 FLAGS_quic_enable_version_36_v2 = false;
294 301
295 QuicVersionVector filtered_versions = FilterSupportedVersions(all_versions); 302 QuicVersionVector filtered_versions = FilterSupportedVersions(all_versions);
296 ASSERT_EQ(3u, filtered_versions.size()); 303 ASSERT_EQ(3u, filtered_versions.size());
297 EXPECT_EQ(QUIC_VERSION_32, filtered_versions[0]); 304 EXPECT_EQ(QUIC_VERSION_32, filtered_versions[0]);
298 EXPECT_EQ(QUIC_VERSION_33, filtered_versions[1]); 305 EXPECT_EQ(QUIC_VERSION_33, filtered_versions[1]);
299 EXPECT_EQ(QUIC_VERSION_34, filtered_versions[2]); 306 EXPECT_EQ(QUIC_VERSION_34, filtered_versions[2]);
300 } 307 }
301 308
302 TEST(QuicProtocolTest, QuicVersionManager) { 309 TEST(QuicProtocolTest, QuicVersionManager) {
310 ValueRestore<bool> old_v35_flag(&FLAGS_quic_enable_version_35,
311 FLAGS_quic_enable_version_35);
312 ValueRestore<bool> old_v36_2_flag(&FLAGS_quic_enable_version_36_v2,
313 FLAGS_quic_enable_version_36_v2);
303 FLAGS_quic_enable_version_35 = false; 314 FLAGS_quic_enable_version_35 = false;
304 FLAGS_quic_enable_version_36_v2 = false; 315 FLAGS_quic_enable_version_36_v2 = false;
305 QuicVersionManager manager(AllSupportedVersions()); 316 QuicVersionManager manager(AllSupportedVersions());
306 EXPECT_EQ(FilterSupportedVersions(AllSupportedVersions()), 317 EXPECT_EQ(FilterSupportedVersions(AllSupportedVersions()),
307 manager.GetSupportedVersions()); 318 manager.GetSupportedVersions());
308 FLAGS_quic_enable_version_35 = true; 319 FLAGS_quic_enable_version_35 = true;
309 FLAGS_quic_enable_version_36_v2 = true; 320 FLAGS_quic_enable_version_36_v2 = true;
310 EXPECT_EQ(FilterSupportedVersions(AllSupportedVersions()), 321 EXPECT_EQ(FilterSupportedVersions(AllSupportedVersions()),
311 manager.GetSupportedVersions()); 322 manager.GetSupportedVersions());
312 EXPECT_EQ(QUIC_VERSION_36, manager.GetSupportedVersions()[0]); 323 EXPECT_EQ(QUIC_VERSION_36, manager.GetSupportedVersions()[0]);
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 EXPECT_EQ(2u, queue.NumIntervals()); 469 EXPECT_EQ(2u, queue.NumIntervals());
459 EXPECT_TRUE(queue.Contains(10)); 470 EXPECT_TRUE(queue.Contains(10));
460 EXPECT_TRUE(queue.Contains(11)); 471 EXPECT_TRUE(queue.Contains(11));
461 EXPECT_TRUE(queue.Contains(20)); 472 EXPECT_TRUE(queue.Contains(20));
462 EXPECT_TRUE(queue.Contains(21)); 473 EXPECT_TRUE(queue.Contains(21));
463 } 474 }
464 475
465 } // namespace 476 } // namespace
466 } // namespace test 477 } // namespace test
467 } // namespace net 478 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/chromium/quic_network_transaction_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698