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

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

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
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
11 namespace net { 11 namespace net {
12 12
13 namespace { 13 namespace {
14 14
15 TEST(QuicServerIdTest, ToString) { 15 TEST(QuicServerIdTest, ToString) {
16 HostPortPair google_host_port_pair("google.com", 10); 16 HostPortPair google_host_port_pair("google.com", 10);
17 17
18 QuicServerId google_http_server_id(google_host_port_pair, false, 18 QuicServerId google_http_server_id(
19 PRIVACY_MODE_DISABLED); 19 google_host_port_pair, false, PRIVACY_MODE_DISABLED);
20 string google_http_server_id_str = google_http_server_id.ToString(); 20 string google_http_server_id_str = google_http_server_id.ToString();
21 EXPECT_EQ("http://google.com:10", google_http_server_id_str); 21 EXPECT_EQ("http://google.com:10", google_http_server_id_str);
22 22
23 QuicServerId google_https_server_id(google_host_port_pair, true, 23 QuicServerId google_https_server_id(
24 PRIVACY_MODE_DISABLED); 24 google_host_port_pair, true, PRIVACY_MODE_DISABLED);
25 string google_https_server_id_str = google_https_server_id.ToString(); 25 string google_https_server_id_str = google_https_server_id.ToString();
26 EXPECT_EQ("https://google.com:10", google_https_server_id_str); 26 EXPECT_EQ("https://google.com:10", google_https_server_id_str);
27 27
28 QuicServerId private_http_server_id(google_host_port_pair, false, 28 QuicServerId private_http_server_id(
29 PRIVACY_MODE_ENABLED); 29 google_host_port_pair, false, PRIVACY_MODE_ENABLED);
30 string private_http_server_id_str = private_http_server_id.ToString(); 30 string private_http_server_id_str = private_http_server_id.ToString();
31 EXPECT_EQ("http://google.com:10/private", private_http_server_id_str); 31 EXPECT_EQ("http://google.com:10/private", private_http_server_id_str);
32 32
33 QuicServerId private_https_server_id(google_host_port_pair, true, 33 QuicServerId private_https_server_id(
34 PRIVACY_MODE_ENABLED); 34 google_host_port_pair, true, PRIVACY_MODE_ENABLED);
35 string private_https_server_id_str = private_https_server_id.ToString(); 35 string private_https_server_id_str = private_https_server_id.ToString();
36 EXPECT_EQ("https://google.com:10/private", private_https_server_id_str); 36 EXPECT_EQ("https://google.com:10/private", private_https_server_id_str);
37 } 37 }
38 38
39 TEST(QuicServerIdTest, LessThan) { 39 TEST(QuicServerIdTest, LessThan) {
40 QuicServerId a_10_http(HostPortPair("a.com", 10), false, 40 QuicServerId a_10_http(
41 PRIVACY_MODE_DISABLED); 41 HostPortPair("a.com", 10), false, PRIVACY_MODE_DISABLED);
42 QuicServerId a_10_https(HostPortPair("a.com", 10), true, 42 QuicServerId a_10_https(
43 PRIVACY_MODE_DISABLED); 43 HostPortPair("a.com", 10), true, PRIVACY_MODE_DISABLED);
44 QuicServerId a_11_http(HostPortPair("a.com", 11), false, 44 QuicServerId a_11_http(
45 PRIVACY_MODE_DISABLED); 45 HostPortPair("a.com", 11), false, PRIVACY_MODE_DISABLED);
46 QuicServerId a_11_https(HostPortPair("a.com", 11), true, 46 QuicServerId a_11_https(
47 PRIVACY_MODE_DISABLED); 47 HostPortPair("a.com", 11), true, PRIVACY_MODE_DISABLED);
48 QuicServerId b_10_http(HostPortPair("b.com", 10), false, 48 QuicServerId b_10_http(
49 PRIVACY_MODE_DISABLED); 49 HostPortPair("b.com", 10), false, PRIVACY_MODE_DISABLED);
50 QuicServerId b_10_https(HostPortPair("b.com", 10), true, 50 QuicServerId b_10_https(
51 PRIVACY_MODE_DISABLED); 51 HostPortPair("b.com", 10), true, PRIVACY_MODE_DISABLED);
52 QuicServerId b_11_http(HostPortPair("b.com", 11), false, 52 QuicServerId b_11_http(
53 PRIVACY_MODE_DISABLED); 53 HostPortPair("b.com", 11), false, PRIVACY_MODE_DISABLED);
54 QuicServerId b_11_https(HostPortPair("b.com", 11), true, 54 QuicServerId b_11_https(
55 PRIVACY_MODE_DISABLED); 55 HostPortPair("b.com", 11), true, PRIVACY_MODE_DISABLED);
56 56
57 QuicServerId a_10_http_private(HostPortPair("a.com", 10), false, 57 QuicServerId a_10_http_private(
58 PRIVACY_MODE_ENABLED); 58 HostPortPair("a.com", 10), false, PRIVACY_MODE_ENABLED);
59 QuicServerId a_10_https_private(HostPortPair("a.com", 10), true, 59 QuicServerId a_10_https_private(
60 PRIVACY_MODE_ENABLED); 60 HostPortPair("a.com", 10), true, PRIVACY_MODE_ENABLED);
61 QuicServerId a_11_http_private(HostPortPair("a.com", 11), false, 61 QuicServerId a_11_http_private(
62 PRIVACY_MODE_ENABLED); 62 HostPortPair("a.com", 11), false, PRIVACY_MODE_ENABLED);
63 QuicServerId a_11_https_private(HostPortPair("a.com", 11), true, 63 QuicServerId a_11_https_private(
64 PRIVACY_MODE_ENABLED); 64 HostPortPair("a.com", 11), true, PRIVACY_MODE_ENABLED);
65 QuicServerId b_10_http_private(HostPortPair("b.com", 10), false, 65 QuicServerId b_10_http_private(
66 PRIVACY_MODE_ENABLED); 66 HostPortPair("b.com", 10), false, PRIVACY_MODE_ENABLED);
67 QuicServerId b_10_https_private(HostPortPair("b.com", 10), true, 67 QuicServerId b_10_https_private(
68 PRIVACY_MODE_ENABLED); 68 HostPortPair("b.com", 10), true, PRIVACY_MODE_ENABLED);
69 QuicServerId b_11_http_private(HostPortPair("b.com", 11), false, 69 QuicServerId b_11_http_private(
70 PRIVACY_MODE_ENABLED); 70 HostPortPair("b.com", 11), false, PRIVACY_MODE_ENABLED);
71 QuicServerId b_11_https_private(HostPortPair("b.com", 11), true, 71 QuicServerId b_11_https_private(
72 PRIVACY_MODE_ENABLED); 72 HostPortPair("b.com", 11), true, PRIVACY_MODE_ENABLED);
73 73
74 // Test combinations of host, port, https and privacy being same on left and 74 // Test combinations of host, port, https and privacy being same on left and
75 // right side of less than. 75 // right side of less than.
76 EXPECT_FALSE(a_10_http < a_10_http); 76 EXPECT_FALSE(a_10_http < a_10_http);
77 EXPECT_TRUE(a_10_http < a_10_https); 77 EXPECT_TRUE(a_10_http < a_10_https);
78 EXPECT_FALSE(a_10_https < a_10_http); 78 EXPECT_FALSE(a_10_https < a_10_http);
79 EXPECT_FALSE(a_10_https < a_10_https); 79 EXPECT_FALSE(a_10_https < a_10_https);
80 80
81 EXPECT_TRUE(a_10_http < a_10_http_private); 81 EXPECT_TRUE(a_10_http < a_10_http_private);
82 EXPECT_TRUE(a_10_http < a_10_https_private); 82 EXPECT_TRUE(a_10_http < a_10_https_private);
83 EXPECT_FALSE(a_10_https < a_10_http_private); 83 EXPECT_FALSE(a_10_https < a_10_http_private);
84 EXPECT_TRUE(a_10_https < a_10_https_private); 84 EXPECT_TRUE(a_10_https < a_10_https_private);
85 85
86 EXPECT_FALSE(a_10_http_private < a_10_http); 86 EXPECT_FALSE(a_10_http_private < a_10_http);
87 EXPECT_TRUE(a_10_http_private < a_10_https); 87 EXPECT_TRUE(a_10_http_private < a_10_https);
88 EXPECT_FALSE(a_10_https_private < a_10_http); 88 EXPECT_FALSE(a_10_https_private < a_10_http);
89 EXPECT_FALSE(a_10_https_private < a_10_https); 89 EXPECT_FALSE(a_10_https_private < a_10_https);
90 90
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 switch (i) {
102 case 0: 102 case 0:
103 left_privacy = PRIVACY_MODE_DISABLED; 103 left_privacy = PRIVACY_MODE_DISABLED;
104 right_privacy = PRIVACY_MODE_DISABLED; 104 right_privacy = PRIVACY_MODE_DISABLED;
105 break; 105 break;
106 case 1: 106 case 1:
107 left_privacy = PRIVACY_MODE_DISABLED; 107 left_privacy = PRIVACY_MODE_DISABLED;
108 right_privacy = PRIVACY_MODE_ENABLED; 108 right_privacy = PRIVACY_MODE_ENABLED;
109 break; 109 break;
110 case 2: 110 case 2:
111 left_privacy = PRIVACY_MODE_ENABLED; 111 left_privacy = PRIVACY_MODE_ENABLED;
112 right_privacy = PRIVACY_MODE_DISABLED; 112 right_privacy = PRIVACY_MODE_DISABLED;
113 break; 113 break;
114 case 3: 114 case 3:
115 left_privacy = PRIVACY_MODE_ENABLED; 115 left_privacy = PRIVACY_MODE_ENABLED;
116 right_privacy = PRIVACY_MODE_ENABLED; 116 right_privacy = PRIVACY_MODE_ENABLED;
117 break; 117 break;
118 } 118 }
119 QuicServerId a_10_http_left_private(HostPortPair("a.com", 10), false, 119 QuicServerId a_10_http_left_private(
120 left_privacy); 120 HostPortPair("a.com", 10), false, left_privacy);
121 QuicServerId a_10_http_right_private(HostPortPair("a.com", 10), false, 121 QuicServerId a_10_http_right_private(
122 right_privacy); 122 HostPortPair("a.com", 10), false, right_privacy);
123 QuicServerId a_10_https_left_private(HostPortPair("a.com", 10), true, 123 QuicServerId a_10_https_left_private(
124 left_privacy); 124 HostPortPair("a.com", 10), true, left_privacy);
125 QuicServerId a_10_https_right_private(HostPortPair("a.com", 10), true, 125 QuicServerId a_10_https_right_private(
126 right_privacy); 126 HostPortPair("a.com", 10), true, right_privacy);
127 QuicServerId a_11_http_left_private(HostPortPair("a.com", 11), false, 127 QuicServerId a_11_http_left_private(
128 left_privacy); 128 HostPortPair("a.com", 11), false, left_privacy);
129 QuicServerId a_11_http_right_private(HostPortPair("a.com", 11), false, 129 QuicServerId a_11_http_right_private(
130 right_privacy); 130 HostPortPair("a.com", 11), false, right_privacy);
131 QuicServerId a_11_https_left_private(HostPortPair("a.com", 11), true, 131 QuicServerId a_11_https_left_private(
132 left_privacy); 132 HostPortPair("a.com", 11), true, left_privacy);
133 QuicServerId a_11_https_right_private(HostPortPair("a.com", 11), true, 133 QuicServerId a_11_https_right_private(
134 right_privacy); 134 HostPortPair("a.com", 11), true, right_privacy);
135 135
136 QuicServerId b_10_http_left_private(HostPortPair("b.com", 10), false, 136 QuicServerId b_10_http_left_private(
137 left_privacy); 137 HostPortPair("b.com", 10), false, left_privacy);
138 QuicServerId b_10_http_right_private(HostPortPair("b.com", 10), false, 138 QuicServerId b_10_http_right_private(
139 right_privacy); 139 HostPortPair("b.com", 10), false, right_privacy);
140 QuicServerId b_10_https_left_private(HostPortPair("b.com", 10), true, 140 QuicServerId b_10_https_left_private(
141 left_privacy); 141 HostPortPair("b.com", 10), true, left_privacy);
142 QuicServerId b_10_https_right_private(HostPortPair("b.com", 10), true, 142 QuicServerId b_10_https_right_private(
143 right_privacy); 143 HostPortPair("b.com", 10), true, right_privacy);
144 QuicServerId b_11_http_left_private(HostPortPair("b.com", 11), false, 144 QuicServerId b_11_http_left_private(
145 left_privacy); 145 HostPortPair("b.com", 11), false, left_privacy);
146 QuicServerId b_11_http_right_private(HostPortPair("b.com", 11), false, 146 QuicServerId b_11_http_right_private(
147 right_privacy); 147 HostPortPair("b.com", 11), false, right_privacy);
148 QuicServerId b_11_https_left_private(HostPortPair("b.com", 11), true, 148 QuicServerId b_11_https_left_private(
149 left_privacy); 149 HostPortPair("b.com", 11), true, left_privacy);
150 QuicServerId b_11_https_right_private(HostPortPair("b.com", 11), true, 150 QuicServerId b_11_https_right_private(
151 right_privacy); 151 HostPortPair("b.com", 11), true, right_privacy);
152 152
153 EXPECT_TRUE(a_10_http_left_private < a_11_http_right_private); 153 EXPECT_TRUE(a_10_http_left_private < a_11_http_right_private);
154 EXPECT_TRUE(a_10_http_left_private < a_11_https_right_private); 154 EXPECT_TRUE(a_10_http_left_private < a_11_https_right_private);
155 EXPECT_TRUE(a_10_https_left_private < a_11_http_right_private); 155 EXPECT_TRUE(a_10_https_left_private < a_11_http_right_private);
156 EXPECT_TRUE(a_10_https_left_private < a_11_https_right_private); 156 EXPECT_TRUE(a_10_https_left_private < a_11_https_right_private);
157 157
158 EXPECT_TRUE(a_10_http_left_private < b_10_http_right_private); 158 EXPECT_TRUE(a_10_http_left_private < b_10_http_right_private);
159 EXPECT_TRUE(a_10_http_left_private < b_10_https_right_private); 159 EXPECT_TRUE(a_10_http_left_private < b_10_https_right_private);
160 EXPECT_TRUE(a_10_https_left_private < b_10_http_right_private); 160 EXPECT_TRUE(a_10_https_left_private < b_10_http_right_private);
161 EXPECT_TRUE(a_10_https_left_private < b_10_https_right_private); 161 EXPECT_TRUE(a_10_https_left_private < b_10_https_right_private);
162 162
163 EXPECT_TRUE(a_10_http_left_private < b_11_http_right_private); 163 EXPECT_TRUE(a_10_http_left_private < b_11_http_right_private);
164 EXPECT_TRUE(a_10_http_left_private < b_11_https_right_private); 164 EXPECT_TRUE(a_10_http_left_private < b_11_https_right_private);
165 EXPECT_TRUE(a_10_https_left_private < b_11_http_right_private); 165 EXPECT_TRUE(a_10_https_left_private < b_11_http_right_private);
166 EXPECT_TRUE(a_10_https_left_private < b_11_https_right_private); 166 EXPECT_TRUE(a_10_https_left_private < b_11_https_right_private);
167 167
168 EXPECT_FALSE(a_11_http_left_private < a_10_http_right_private); 168 EXPECT_FALSE(a_11_http_left_private < a_10_http_right_private);
169 EXPECT_FALSE(a_11_http_left_private < a_10_https_right_private); 169 EXPECT_FALSE(a_11_http_left_private < a_10_https_right_private);
170 EXPECT_FALSE(a_11_https_left_private < a_10_http_right_private); 170 EXPECT_FALSE(a_11_https_left_private < a_10_http_right_private);
171 EXPECT_FALSE(a_11_https_left_private < a_10_https_right_private); 171 EXPECT_FALSE(a_11_https_left_private < a_10_https_right_private);
172 172
173 EXPECT_FALSE(a_11_http_left_private < b_10_http_right_private); 173 EXPECT_FALSE(a_11_http_left_private < b_10_http_right_private);
174 EXPECT_FALSE(a_11_http_left_private < b_10_https_right_private); 174 EXPECT_FALSE(a_11_http_left_private < b_10_https_right_private);
175 EXPECT_FALSE(a_11_https_left_private < b_10_http_right_private); 175 EXPECT_FALSE(a_11_https_left_private < b_10_http_right_private);
176 EXPECT_FALSE(a_11_https_left_private < b_10_https_right_private); 176 EXPECT_FALSE(a_11_https_left_private < b_10_https_right_private);
177 177
178 EXPECT_TRUE(a_11_http_left_private < b_11_http_right_private); 178 EXPECT_TRUE(a_11_http_left_private < b_11_http_right_private);
179 EXPECT_TRUE(a_11_http_left_private < b_11_https_right_private); 179 EXPECT_TRUE(a_11_http_left_private < b_11_https_right_private);
180 EXPECT_TRUE(a_11_https_left_private < b_11_http_right_private); 180 EXPECT_TRUE(a_11_https_left_private < b_11_http_right_private);
181 EXPECT_TRUE(a_11_https_left_private < b_11_https_right_private); 181 EXPECT_TRUE(a_11_https_left_private < b_11_https_right_private);
182 182
183 EXPECT_FALSE(b_10_http_left_private < a_10_http_right_private); 183 EXPECT_FALSE(b_10_http_left_private < a_10_http_right_private);
184 EXPECT_FALSE(b_10_http_left_private < a_10_https_right_private); 184 EXPECT_FALSE(b_10_http_left_private < a_10_https_right_private);
185 EXPECT_FALSE(b_10_https_left_private < a_10_http_right_private); 185 EXPECT_FALSE(b_10_https_left_private < a_10_http_right_private);
186 EXPECT_FALSE(b_10_https_left_private < a_10_https_right_private); 186 EXPECT_FALSE(b_10_https_left_private < a_10_https_right_private);
187 187
188 EXPECT_TRUE(b_10_http_left_private < a_11_http_right_private); 188 EXPECT_TRUE(b_10_http_left_private < a_11_http_right_private);
189 EXPECT_TRUE(b_10_http_left_private < a_11_https_right_private); 189 EXPECT_TRUE(b_10_http_left_private < a_11_https_right_private);
190 EXPECT_TRUE(b_10_https_left_private < a_11_http_right_private); 190 EXPECT_TRUE(b_10_https_left_private < a_11_http_right_private);
191 EXPECT_TRUE(b_10_https_left_private < a_11_https_right_private); 191 EXPECT_TRUE(b_10_https_left_private < a_11_https_right_private);
192 192
193 EXPECT_TRUE(b_10_http_left_private < b_11_http_right_private); 193 EXPECT_TRUE(b_10_http_left_private < b_11_http_right_private);
194 EXPECT_TRUE(b_10_http_left_private < b_11_https_right_private); 194 EXPECT_TRUE(b_10_http_left_private < b_11_https_right_private);
195 EXPECT_TRUE(b_10_https_left_private < b_11_http_right_private); 195 EXPECT_TRUE(b_10_https_left_private < b_11_http_right_private);
196 EXPECT_TRUE(b_10_https_left_private < b_11_https_right_private); 196 EXPECT_TRUE(b_10_https_left_private < b_11_https_right_private);
197 197
198 EXPECT_FALSE(b_11_http_left_private < a_10_http_right_private); 198 EXPECT_FALSE(b_11_http_left_private < a_10_http_right_private);
199 EXPECT_FALSE(b_11_http_left_private < a_10_https_right_private); 199 EXPECT_FALSE(b_11_http_left_private < a_10_https_right_private);
200 EXPECT_FALSE(b_11_https_left_private < a_10_http_right_private); 200 EXPECT_FALSE(b_11_https_left_private < a_10_http_right_private);
201 EXPECT_FALSE(b_11_https_left_private < a_10_https_right_private); 201 EXPECT_FALSE(b_11_https_left_private < a_10_https_right_private);
202 202
203 EXPECT_FALSE(b_11_http_left_private < a_11_http_right_private); 203 EXPECT_FALSE(b_11_http_left_private < a_11_http_right_private);
204 EXPECT_FALSE(b_11_http_left_private < a_11_https_right_private); 204 EXPECT_FALSE(b_11_http_left_private < a_11_https_right_private);
205 EXPECT_FALSE(b_11_https_left_private < a_11_http_right_private); 205 EXPECT_FALSE(b_11_https_left_private < a_11_http_right_private);
206 EXPECT_FALSE(b_11_https_left_private < a_11_https_right_private); 206 EXPECT_FALSE(b_11_https_left_private < a_11_https_right_private);
207 207
208 EXPECT_FALSE(b_11_http_left_private < b_10_http_right_private); 208 EXPECT_FALSE(b_11_http_left_private < b_10_http_right_private);
209 EXPECT_FALSE(b_11_http_left_private < b_10_https_right_private); 209 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); 210 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); 211 EXPECT_FALSE(b_11_https_left_private < b_10_https_right_private);
212 } 212 }
213 } 213 }
214 214
215 TEST(QuicServerIdTest, Equals) { 215 TEST(QuicServerIdTest, Equals) {
216 PrivacyMode left_privacy; 216 PrivacyMode left_privacy;
217 PrivacyMode right_privacy; 217 PrivacyMode right_privacy;
218 for (int i = 0; i < 2; i++) { 218 for (int i = 0; i < 2; i++) {
219 switch (i) { 219 switch (i) {
220 case 0: 220 case 0:
221 left_privacy = PRIVACY_MODE_DISABLED; 221 left_privacy = PRIVACY_MODE_DISABLED;
222 right_privacy = PRIVACY_MODE_DISABLED; 222 right_privacy = PRIVACY_MODE_DISABLED;
223 break; 223 break;
224 case 1: 224 case 1:
225 left_privacy = PRIVACY_MODE_ENABLED; 225 left_privacy = PRIVACY_MODE_ENABLED;
226 right_privacy = PRIVACY_MODE_ENABLED; 226 right_privacy = PRIVACY_MODE_ENABLED;
227 break; 227 break;
228 } 228 }
229 QuicServerId a_10_http_right_private(HostPortPair("a.com", 10), false, 229 QuicServerId a_10_http_right_private(
230 right_privacy); 230 HostPortPair("a.com", 10), false, right_privacy);
231 QuicServerId a_10_https_right_private(HostPortPair("a.com", 10), true, 231 QuicServerId a_10_https_right_private(
232 right_privacy); 232 HostPortPair("a.com", 10), true, right_privacy);
233 QuicServerId a_11_http_right_private(HostPortPair("a.com", 11), false, 233 QuicServerId a_11_http_right_private(
234 right_privacy); 234 HostPortPair("a.com", 11), false, right_privacy);
235 QuicServerId a_11_https_right_private(HostPortPair("a.com", 11), true, 235 QuicServerId a_11_https_right_private(
236 right_privacy); 236 HostPortPair("a.com", 11), true, right_privacy);
237 QuicServerId b_10_http_right_private(HostPortPair("b.com", 10), false, 237 QuicServerId b_10_http_right_private(
238 right_privacy); 238 HostPortPair("b.com", 10), false, right_privacy);
239 QuicServerId b_10_https_right_private(HostPortPair("b.com", 10), true, 239 QuicServerId b_10_https_right_private(
240 right_privacy); 240 HostPortPair("b.com", 10), true, right_privacy);
241 QuicServerId b_11_http_right_private(HostPortPair("b.com", 11), false, 241 QuicServerId b_11_http_right_private(
242 right_privacy); 242 HostPortPair("b.com", 11), false, right_privacy);
243 QuicServerId b_11_https_right_private(HostPortPair("b.com", 11), true, 243 QuicServerId b_11_https_right_private(
244 right_privacy); 244 HostPortPair("b.com", 11), true, right_privacy);
245 245
246 QuicServerId new_a_10_http_left_private(HostPortPair("a.com", 10), false, 246 QuicServerId new_a_10_http_left_private(
247 left_privacy); 247 HostPortPair("a.com", 10), false, left_privacy);
248 QuicServerId new_a_10_https_left_private(HostPortPair("a.com", 10), true, 248 QuicServerId new_a_10_https_left_private(
249 left_privacy); 249 HostPortPair("a.com", 10), true, left_privacy);
250 QuicServerId new_a_11_http_left_private(HostPortPair("a.com", 11), false, 250 QuicServerId new_a_11_http_left_private(
251 left_privacy); 251 HostPortPair("a.com", 11), false, left_privacy);
252 QuicServerId new_a_11_https_left_private(HostPortPair("a.com", 11), true, 252 QuicServerId new_a_11_https_left_private(
253 left_privacy); 253 HostPortPair("a.com", 11), true, left_privacy);
254 QuicServerId new_b_10_http_left_private(HostPortPair("b.com", 10), false, 254 QuicServerId new_b_10_http_left_private(
255 left_privacy); 255 HostPortPair("b.com", 10), false, left_privacy);
256 QuicServerId new_b_10_https_left_private(HostPortPair("b.com", 10), true, 256 QuicServerId new_b_10_https_left_private(
257 left_privacy); 257 HostPortPair("b.com", 10), true, left_privacy);
258 QuicServerId new_b_11_http_left_private(HostPortPair("b.com", 11), false, 258 QuicServerId new_b_11_http_left_private(
259 left_privacy); 259 HostPortPair("b.com", 11), false, left_privacy);
260 QuicServerId new_b_11_https_left_private(HostPortPair("b.com", 11), true, 260 QuicServerId new_b_11_https_left_private(
261 left_privacy); 261 HostPortPair("b.com", 11), true, left_privacy);
262 262
263 EXPECT_EQ(new_a_10_http_left_private, a_10_http_right_private); 263 EXPECT_EQ(new_a_10_http_left_private, a_10_http_right_private);
264 EXPECT_EQ(new_a_10_https_left_private, a_10_https_right_private); 264 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); 265 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); 266 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); 267 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); 268 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); 269 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); 270 EXPECT_EQ(new_b_11_https_left_private, b_11_https_right_private);
271 } 271 }
272 272
273 for (int i = 0; i < 2; i++) { 273 for (int i = 0; i < 2; i++) {
274 switch (i) { 274 switch (i) {
275 case 0: 275 case 0:
276 right_privacy = PRIVACY_MODE_DISABLED; 276 right_privacy = PRIVACY_MODE_DISABLED;
277 break; 277 break;
278 case 1: 278 case 1:
279 right_privacy = PRIVACY_MODE_ENABLED; 279 right_privacy = PRIVACY_MODE_ENABLED;
280 break; 280 break;
281 } 281 }
282 QuicServerId a_10_http_right_private(HostPortPair("a.com", 10), false, 282 QuicServerId a_10_http_right_private(
283 right_privacy); 283 HostPortPair("a.com", 10), false, right_privacy);
284 QuicServerId a_10_https_right_private(HostPortPair("a.com", 10), true, 284 QuicServerId a_10_https_right_private(
285 right_privacy); 285 HostPortPair("a.com", 10), true, right_privacy);
286 QuicServerId a_11_http_right_private(HostPortPair("a.com", 11), false, 286 QuicServerId a_11_http_right_private(
287 right_privacy); 287 HostPortPair("a.com", 11), false, right_privacy);
288 QuicServerId a_11_https_right_private(HostPortPair("a.com", 11), true, 288 QuicServerId a_11_https_right_private(
289 right_privacy); 289 HostPortPair("a.com", 11), true, right_privacy);
290 QuicServerId b_10_http_right_private(HostPortPair("b.com", 10), false, 290 QuicServerId b_10_http_right_private(
291 right_privacy); 291 HostPortPair("b.com", 10), false, right_privacy);
292 QuicServerId b_10_https_right_private(HostPortPair("b.com", 10), true, 292 QuicServerId b_10_https_right_private(
293 right_privacy); 293 HostPortPair("b.com", 10), true, right_privacy);
294 QuicServerId b_11_http_right_private(HostPortPair("b.com", 11), false, 294 QuicServerId b_11_http_right_private(
295 right_privacy); 295 HostPortPair("b.com", 11), false, right_privacy);
296 QuicServerId b_11_https_right_private(HostPortPair("b.com", 11), true, 296 QuicServerId b_11_https_right_private(
297 right_privacy); 297 HostPortPair("b.com", 11), true, right_privacy);
298 298
299 QuicServerId new_a_10_http_left_private(HostPortPair("a.com", 10), false, 299 QuicServerId new_a_10_http_left_private(
300 PRIVACY_MODE_DISABLED); 300 HostPortPair("a.com", 10), false, PRIVACY_MODE_DISABLED);
301 301
302 EXPECT_FALSE(new_a_10_http_left_private == a_10_https_right_private); 302 EXPECT_FALSE(new_a_10_http_left_private == a_10_https_right_private);
303 EXPECT_FALSE(new_a_10_http_left_private == a_11_http_right_private); 303 EXPECT_FALSE(new_a_10_http_left_private == a_11_http_right_private);
304 EXPECT_FALSE(new_a_10_http_left_private == b_10_http_right_private); 304 EXPECT_FALSE(new_a_10_http_left_private == b_10_http_right_private);
305 EXPECT_FALSE(new_a_10_http_left_private == a_11_https_right_private); 305 EXPECT_FALSE(new_a_10_http_left_private == a_11_https_right_private);
306 EXPECT_FALSE(new_a_10_http_left_private == b_10_https_right_private); 306 EXPECT_FALSE(new_a_10_http_left_private == b_10_https_right_private);
307 EXPECT_FALSE(new_a_10_http_left_private == b_11_http_right_private); 307 EXPECT_FALSE(new_a_10_http_left_private == b_11_http_right_private);
308 EXPECT_FALSE(new_a_10_http_left_private == b_11_https_right_private); 308 EXPECT_FALSE(new_a_10_http_left_private == b_11_https_right_private);
309 } 309 }
310 QuicServerId a_10_http_private(HostPortPair("a.com", 10), false, 310 QuicServerId a_10_http_private(
311 PRIVACY_MODE_ENABLED); 311 HostPortPair("a.com", 10), false, PRIVACY_MODE_ENABLED);
312 QuicServerId new_a_10_http_no_private(HostPortPair("a.com", 10), false, 312 QuicServerId new_a_10_http_no_private(
313 PRIVACY_MODE_DISABLED); 313 HostPortPair("a.com", 10), false, PRIVACY_MODE_DISABLED);
314 EXPECT_FALSE(new_a_10_http_no_private == a_10_http_private); 314 EXPECT_FALSE(new_a_10_http_no_private == a_10_http_private);
315 } 315 }
316 316
317 } // namespace 317 } // namespace
318 318
319 } // namespace net 319 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698