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/quic_protocol_test.cc

Issue 185203003: Killing off QUICv12, including cleaning out all of the code for handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Deleted unused StripUint32 Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_protocol.cc ('k') | net/quic/quic_reliable_client_stream_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/quic_protocol.h" 5 #include "net/quic/quic_protocol.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace net { 10 namespace net {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 // TODO(rtenneti): Enable checking of Log(ERROR) messages. 50 // TODO(rtenneti): Enable checking of Log(ERROR) messages.
51 #if 0 51 #if 0
52 // Any logs would indicate an unsupported version which we don't expect. 52 // Any logs would indicate an unsupported version which we don't expect.
53 ScopedMockLog log(kDoNotCaptureLogsYet); 53 ScopedMockLog log(kDoNotCaptureLogsYet);
54 EXPECT_CALL(log, Log(_, _, _)).Times(0); 54 EXPECT_CALL(log, Log(_, _, _)).Times(0);
55 log.StartCapturingLogs(); 55 log.StartCapturingLogs();
56 #endif 56 #endif
57 57
58 // Explicitly test a specific version. 58 // Explicitly test a specific version.
59 EXPECT_EQ(MakeQuicTag('Q', '0', '1', '2'), 59 EXPECT_EQ(MakeQuicTag('Q', '0', '1', '6'),
60 QuicVersionToQuicTag(QUIC_VERSION_12)); 60 QuicVersionToQuicTag(QUIC_VERSION_16));
61 61
62 // Loop over all supported versions and make sure that we never hit the 62 // Loop over all supported versions and make sure that we never hit the
63 // default case (i.e. all supported versions should be successfully converted 63 // default case (i.e. all supported versions should be successfully converted
64 // to valid QuicTags). 64 // to valid QuicTags).
65 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) { 65 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) {
66 QuicVersion version = kSupportedQuicVersions[i]; 66 QuicVersion version = kSupportedQuicVersions[i];
67 EXPECT_LT(0u, QuicVersionToQuicTag(version)); 67 EXPECT_LT(0u, QuicVersionToQuicTag(version));
68 } 68 }
69 } 69 }
70 70
(...skipping 17 matching lines...) Expand all
88 88
89 // TODO(rtenneti): Enable checking of Log(ERROR) messages. 89 // TODO(rtenneti): Enable checking of Log(ERROR) messages.
90 #if 0 90 #if 0
91 // Any logs would indicate an unsupported version which we don't expect. 91 // Any logs would indicate an unsupported version which we don't expect.
92 ScopedMockLog log(kDoNotCaptureLogsYet); 92 ScopedMockLog log(kDoNotCaptureLogsYet);
93 EXPECT_CALL(log, Log(_, _, _)).Times(0); 93 EXPECT_CALL(log, Log(_, _, _)).Times(0);
94 log.StartCapturingLogs(); 94 log.StartCapturingLogs();
95 #endif 95 #endif
96 96
97 // Explicitly test specific versions. 97 // Explicitly test specific versions.
98 EXPECT_EQ(QUIC_VERSION_12, 98 EXPECT_EQ(QUIC_VERSION_16,
99 QuicTagToQuicVersion(MakeQuicTag('Q', '0', '1', '2'))); 99 QuicTagToQuicVersion(MakeQuicTag('Q', '0', '1', '6')));
100 100
101 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) { 101 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) {
102 QuicVersion version = kSupportedQuicVersions[i]; 102 QuicVersion version = kSupportedQuicVersions[i];
103 103
104 // Get the tag from the version (we can loop over QuicVersions easily). 104 // Get the tag from the version (we can loop over QuicVersions easily).
105 QuicTag tag = QuicVersionToQuicTag(version); 105 QuicTag tag = QuicVersionToQuicTag(version);
106 EXPECT_LT(0u, tag); 106 EXPECT_LT(0u, tag);
107 107
108 // Now try converting back. 108 // Now try converting back.
109 QuicVersion tag_to_quic_version = QuicTagToQuicVersion(tag); 109 QuicVersion tag_to_quic_version = QuicTagToQuicVersion(tag);
(...skipping 10 matching lines...) Expand all
120 EXPECT_CALL(log, Log(INFO, _, "Unsupported QuicTag version: FAKE")).Times(1); 120 EXPECT_CALL(log, Log(INFO, _, "Unsupported QuicTag version: FAKE")).Times(1);
121 #endif 121 #endif
122 log.StartCapturingLogs(); 122 log.StartCapturingLogs();
123 #endif 123 #endif
124 124
125 EXPECT_EQ(QUIC_VERSION_UNSUPPORTED, 125 EXPECT_EQ(QUIC_VERSION_UNSUPPORTED,
126 QuicTagToQuicVersion(MakeQuicTag('F', 'A', 'K', 'E'))); 126 QuicTagToQuicVersion(MakeQuicTag('F', 'A', 'K', 'E')));
127 } 127 }
128 128
129 TEST(QuicProtocolTest, QuicVersionToString) { 129 TEST(QuicProtocolTest, QuicVersionToString) {
130 EXPECT_EQ("QUIC_VERSION_12", QuicVersionToString(QUIC_VERSION_12)); 130 EXPECT_EQ("QUIC_VERSION_16", QuicVersionToString(QUIC_VERSION_16));
131 EXPECT_EQ("QUIC_VERSION_UNSUPPORTED", 131 EXPECT_EQ("QUIC_VERSION_UNSUPPORTED",
132 QuicVersionToString(QUIC_VERSION_UNSUPPORTED)); 132 QuicVersionToString(QUIC_VERSION_UNSUPPORTED));
133 133
134 QuicVersion single_version[] = {QUIC_VERSION_12}; 134 QuicVersion single_version[] = {QUIC_VERSION_16};
135 QuicVersionVector versions_vector; 135 QuicVersionVector versions_vector;
136 for (size_t i = 0; i < arraysize(single_version); ++i) { 136 for (size_t i = 0; i < arraysize(single_version); ++i) {
137 versions_vector.push_back(single_version[i]); 137 versions_vector.push_back(single_version[i]);
138 } 138 }
139 EXPECT_EQ("QUIC_VERSION_12", QuicVersionVectorToString(versions_vector)); 139 EXPECT_EQ("QUIC_VERSION_16", QuicVersionVectorToString(versions_vector));
140 140
141 QuicVersion multiple_versions[] = {QUIC_VERSION_UNSUPPORTED, QUIC_VERSION_12}; 141 QuicVersion multiple_versions[] = {QUIC_VERSION_UNSUPPORTED, QUIC_VERSION_16};
142 versions_vector.clear(); 142 versions_vector.clear();
143 for (size_t i = 0; i < arraysize(multiple_versions); ++i) { 143 for (size_t i = 0; i < arraysize(multiple_versions); ++i) {
144 versions_vector.push_back(multiple_versions[i]); 144 versions_vector.push_back(multiple_versions[i]);
145 } 145 }
146 EXPECT_EQ("QUIC_VERSION_UNSUPPORTED,QUIC_VERSION_12", 146 EXPECT_EQ("QUIC_VERSION_UNSUPPORTED,QUIC_VERSION_16",
147 QuicVersionVectorToString(versions_vector)); 147 QuicVersionVectorToString(versions_vector));
148 148
149 // Make sure that all supported versions are present in QuicVersionToString. 149 // Make sure that all supported versions are present in QuicVersionToString.
150 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) { 150 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) {
151 QuicVersion version = kSupportedQuicVersions[i]; 151 QuicVersion version = kSupportedQuicVersions[i];
152 EXPECT_NE("QUIC_VERSION_UNSUPPORTED", QuicVersionToString(version)); 152 EXPECT_NE("QUIC_VERSION_UNSUPPORTED", QuicVersionToString(version));
153 } 153 }
154 } 154 }
155 155
156 } // namespace 156 } // namespace
157 } // namespace test 157 } // namespace test
158 } // namespace net 158 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_protocol.cc ('k') | net/quic/quic_reliable_client_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698