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

Side by Side Diff: net/quic/quic_server_id_test.cc

Issue 371213002: Fixes for re-enabling more MSVC level 4 warnings: net/quic/ edition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review comments Created 6 years, 5 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/crypto/strike_register.cc ('k') | net/quic/quic_spdy_server_stream.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_server_id.h" 5 #include "net/quic/quic_server_id.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 using std::string; 9 using std::string;
10 10
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 EXPECT_FALSE(a_10_http_private < a_10_http_private); 91 EXPECT_FALSE(a_10_http_private < a_10_http_private);
92 EXPECT_TRUE(a_10_http_private < a_10_https_private); 92 EXPECT_TRUE(a_10_http_private < a_10_https_private);
93 EXPECT_FALSE(a_10_https_private < a_10_http_private); 93 EXPECT_FALSE(a_10_https_private < a_10_http_private);
94 EXPECT_FALSE(a_10_https_private < a_10_https_private); 94 EXPECT_FALSE(a_10_https_private < a_10_https_private);
95 95
96 // Test with either host, port or https being different on left and right side 96 // Test with either host, port or https being different on left and right side
97 // of less than. 97 // of less than.
98 PrivacyMode left_privacy; 98 PrivacyMode left_privacy;
99 PrivacyMode right_privacy; 99 PrivacyMode right_privacy;
100 for (int i = 0; i < 4; i++) { 100 for (int i = 0; i < 4; i++) {
101 switch (i) { 101 left_privacy = static_cast<PrivacyMode>(i / 2);
102 case 0: 102 right_privacy = static_cast<PrivacyMode>(i % 2);
103 left_privacy = PRIVACY_MODE_DISABLED;
104 right_privacy = PRIVACY_MODE_DISABLED;
105 break;
106 case 1:
107 left_privacy = PRIVACY_MODE_DISABLED;
108 right_privacy = PRIVACY_MODE_ENABLED;
109 break;
110 case 2:
111 left_privacy = PRIVACY_MODE_ENABLED;
112 right_privacy = PRIVACY_MODE_DISABLED;
113 break;
114 case 3:
115 left_privacy = PRIVACY_MODE_ENABLED;
116 right_privacy = PRIVACY_MODE_ENABLED;
117 break;
118 }
119 QuicServerId a_10_http_left_private(HostPortPair("a.com", 10), false, 103 QuicServerId a_10_http_left_private(HostPortPair("a.com", 10), false,
120 left_privacy); 104 left_privacy);
121 QuicServerId a_10_http_right_private(HostPortPair("a.com", 10), false, 105 QuicServerId a_10_http_right_private(HostPortPair("a.com", 10), false,
122 right_privacy); 106 right_privacy);
123 QuicServerId a_10_https_left_private(HostPortPair("a.com", 10), true, 107 QuicServerId a_10_https_left_private(HostPortPair("a.com", 10), true,
124 left_privacy); 108 left_privacy);
125 QuicServerId a_10_https_right_private(HostPortPair("a.com", 10), true, 109 QuicServerId a_10_https_right_private(HostPortPair("a.com", 10), true,
126 right_privacy); 110 right_privacy);
127 QuicServerId a_11_http_left_private(HostPortPair("a.com", 11), false, 111 QuicServerId a_11_http_left_private(HostPortPair("a.com", 11), false,
128 left_privacy); 112 left_privacy);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 EXPECT_FALSE(b_11_http_left_private < b_10_https_right_private); 193 EXPECT_FALSE(b_11_http_left_private < b_10_https_right_private);
210 EXPECT_FALSE(b_11_https_left_private < b_10_http_right_private); 194 EXPECT_FALSE(b_11_https_left_private < b_10_http_right_private);
211 EXPECT_FALSE(b_11_https_left_private < b_10_https_right_private); 195 EXPECT_FALSE(b_11_https_left_private < b_10_https_right_private);
212 } 196 }
213 } 197 }
214 198
215 TEST(QuicServerIdTest, Equals) { 199 TEST(QuicServerIdTest, Equals) {
216 PrivacyMode left_privacy; 200 PrivacyMode left_privacy;
217 PrivacyMode right_privacy; 201 PrivacyMode right_privacy;
218 for (int i = 0; i < 2; i++) { 202 for (int i = 0; i < 2; i++) {
219 switch (i) { 203 left_privacy = right_privacy = static_cast<PrivacyMode>(i);
220 case 0:
221 left_privacy = PRIVACY_MODE_DISABLED;
222 right_privacy = PRIVACY_MODE_DISABLED;
223 break;
224 case 1:
225 left_privacy = PRIVACY_MODE_ENABLED;
226 right_privacy = PRIVACY_MODE_ENABLED;
227 break;
228 }
229 QuicServerId a_10_http_right_private(HostPortPair("a.com", 10), false, 204 QuicServerId a_10_http_right_private(HostPortPair("a.com", 10), false,
230 right_privacy); 205 right_privacy);
231 QuicServerId a_10_https_right_private(HostPortPair("a.com", 10), true, 206 QuicServerId a_10_https_right_private(HostPortPair("a.com", 10), true,
232 right_privacy); 207 right_privacy);
233 QuicServerId a_11_http_right_private(HostPortPair("a.com", 11), false, 208 QuicServerId a_11_http_right_private(HostPortPair("a.com", 11), false,
234 right_privacy); 209 right_privacy);
235 QuicServerId a_11_https_right_private(HostPortPair("a.com", 11), true, 210 QuicServerId a_11_https_right_private(HostPortPair("a.com", 11), true,
236 right_privacy); 211 right_privacy);
237 QuicServerId b_10_http_right_private(HostPortPair("b.com", 10), false, 212 QuicServerId b_10_http_right_private(HostPortPair("b.com", 10), false,
238 right_privacy); 213 right_privacy);
(...skipping 25 matching lines...) Expand all
264 EXPECT_EQ(new_a_10_https_left_private, a_10_https_right_private); 239 EXPECT_EQ(new_a_10_https_left_private, a_10_https_right_private);
265 EXPECT_EQ(new_a_11_http_left_private, a_11_http_right_private); 240 EXPECT_EQ(new_a_11_http_left_private, a_11_http_right_private);
266 EXPECT_EQ(new_a_11_https_left_private, a_11_https_right_private); 241 EXPECT_EQ(new_a_11_https_left_private, a_11_https_right_private);
267 EXPECT_EQ(new_b_10_http_left_private, b_10_http_right_private); 242 EXPECT_EQ(new_b_10_http_left_private, b_10_http_right_private);
268 EXPECT_EQ(new_b_10_https_left_private, b_10_https_right_private); 243 EXPECT_EQ(new_b_10_https_left_private, b_10_https_right_private);
269 EXPECT_EQ(new_b_11_http_left_private, b_11_http_right_private); 244 EXPECT_EQ(new_b_11_http_left_private, b_11_http_right_private);
270 EXPECT_EQ(new_b_11_https_left_private, b_11_https_right_private); 245 EXPECT_EQ(new_b_11_https_left_private, b_11_https_right_private);
271 } 246 }
272 247
273 for (int i = 0; i < 2; i++) { 248 for (int i = 0; i < 2; i++) {
274 switch (i) { 249 right_privacy = static_cast<PrivacyMode>(i);
275 case 0:
276 right_privacy = PRIVACY_MODE_DISABLED;
277 break;
278 case 1:
279 right_privacy = PRIVACY_MODE_ENABLED;
280 break;
281 }
282 QuicServerId a_10_http_right_private(HostPortPair("a.com", 10), false, 250 QuicServerId a_10_http_right_private(HostPortPair("a.com", 10), false,
283 right_privacy); 251 right_privacy);
284 QuicServerId a_10_https_right_private(HostPortPair("a.com", 10), true, 252 QuicServerId a_10_https_right_private(HostPortPair("a.com", 10), true,
285 right_privacy); 253 right_privacy);
286 QuicServerId a_11_http_right_private(HostPortPair("a.com", 11), false, 254 QuicServerId a_11_http_right_private(HostPortPair("a.com", 11), false,
287 right_privacy); 255 right_privacy);
288 QuicServerId a_11_https_right_private(HostPortPair("a.com", 11), true, 256 QuicServerId a_11_https_right_private(HostPortPair("a.com", 11), true,
289 right_privacy); 257 right_privacy);
290 QuicServerId b_10_http_right_private(HostPortPair("b.com", 10), false, 258 QuicServerId b_10_http_right_private(HostPortPair("b.com", 10), false,
291 right_privacy); 259 right_privacy);
(...skipping 18 matching lines...) Expand all
310 QuicServerId a_10_http_private(HostPortPair("a.com", 10), false, 278 QuicServerId a_10_http_private(HostPortPair("a.com", 10), false,
311 PRIVACY_MODE_ENABLED); 279 PRIVACY_MODE_ENABLED);
312 QuicServerId new_a_10_http_no_private(HostPortPair("a.com", 10), false, 280 QuicServerId new_a_10_http_no_private(HostPortPair("a.com", 10), false,
313 PRIVACY_MODE_DISABLED); 281 PRIVACY_MODE_DISABLED);
314 EXPECT_FALSE(new_a_10_http_no_private == a_10_http_private); 282 EXPECT_FALSE(new_a_10_http_no_private == a_10_http_private);
315 } 283 }
316 284
317 } // namespace 285 } // namespace
318 286
319 } // namespace net 287 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/strike_register.cc ('k') | net/quic/quic_spdy_server_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698