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

Side by Side Diff: net/http/http_server_properties_impl_unittest.cc

Issue 1824903002: Change the AlternativeServiceMap with SchemeOriginPair key. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/http/http_server_properties_impl.cc ('k') | net/http/http_server_properties_manager.h » ('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/http/http_server_properties_impl.h" 5 #include "net/http/http_server_properties_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 const SpdySettingsIds kSpdySettingsId = SETTINGS_UPLOAD_BANDWIDTH; 48 const SpdySettingsIds kSpdySettingsId = SETTINGS_UPLOAD_BANDWIDTH;
49 const SpdySettingsFlags kSpdySettingsFlags = SETTINGS_FLAG_PERSISTED; 49 const SpdySettingsFlags kSpdySettingsFlags = SETTINGS_FLAG_PERSISTED;
50 50
51 struct SpdySettingsDataToVerify { 51 struct SpdySettingsDataToVerify {
52 HostPortPair spdy_server; 52 HostPortPair spdy_server;
53 uint32_t value; 53 uint32_t value;
54 }; 54 };
55 55
56 class HttpServerPropertiesImplTest : public testing::Test { 56 class HttpServerPropertiesImplTest : public testing::Test {
57 protected: 57 protected:
58 bool HasAlternativeService(const HostPortPair& origin) { 58 bool HasAlternativeService(const url::SchemeHostPort& origin) {
59 const AlternativeServiceVector alternative_service_vector = 59 const AlternativeServiceVector alternative_service_vector =
60 impl_.GetAlternativeServices(origin); 60 impl_.GetAlternativeServices(origin);
61 return !alternative_service_vector.empty(); 61 return !alternative_service_vector.empty();
62 } 62 }
63 63
64 bool SetAlternativeService(const HostPortPair& origin, 64 bool SetAlternativeService(const url::SchemeHostPort& origin,
65 const AlternativeService& alternative_service) { 65 const AlternativeService& alternative_service) {
66 const base::Time expiration = 66 const base::Time expiration =
67 base::Time::Now() + base::TimeDelta::FromDays(1); 67 base::Time::Now() + base::TimeDelta::FromDays(1);
68 return impl_.SetAlternativeService(origin, alternative_service, expiration); 68 return impl_.SetAlternativeService(origin, alternative_service, expiration);
69 } 69 }
70 70
71 void InitializeSpdySettingsUploadBandwidth(SpdySettingsMap* spdy_settings_map, 71 void InitializeSpdySettingsUploadBandwidth(SpdySettingsMap* spdy_settings_map,
72 const HostPortPair& spdy_server, 72 const HostPortPair& spdy_server,
73 uint32_t value) { 73 uint32_t value) {
74 SettingsMap settings_map; 74 SettingsMap settings_map;
(...skipping 22 matching lines...) Expand all
97 } 97 }
98 } 98 }
99 99
100 HttpServerPropertiesImpl impl_; 100 HttpServerPropertiesImpl impl_;
101 }; 101 };
102 102
103 typedef HttpServerPropertiesImplTest SpdyServerPropertiesTest; 103 typedef HttpServerPropertiesImplTest SpdyServerPropertiesTest;
104 104
105 TEST_F(SpdyServerPropertiesTest, Initialize) { 105 TEST_F(SpdyServerPropertiesTest, Initialize) {
106 HostPortPair spdy_server_google("www.google.com", 443); 106 HostPortPair spdy_server_google("www.google.com", 443);
107 url::SchemeHostPort google_server("https", "www.google.com", 443);
107 std::string spdy_server_g = spdy_server_google.ToString(); 108 std::string spdy_server_g = spdy_server_google.ToString();
108 109
109 HostPortPair spdy_server_photos("photos.google.com", 443); 110 HostPortPair spdy_server_photos("photos.google.com", 443);
111 url::SchemeHostPort photos_server("https", "photos.google.com", 443);
110 std::string spdy_server_p = spdy_server_photos.ToString(); 112 std::string spdy_server_p = spdy_server_photos.ToString();
111 113
112 HostPortPair spdy_server_docs("docs.google.com", 443); 114 HostPortPair spdy_server_docs("docs.google.com", 443);
115 url::SchemeHostPort docs_server("https", "docs.google.com", 443);
113 std::string spdy_server_d = spdy_server_docs.ToString(); 116 std::string spdy_server_d = spdy_server_docs.ToString();
114 117
115 HostPortPair spdy_server_mail("mail.google.com", 443); 118 HostPortPair spdy_server_mail("mail.google.com", 443);
119 url::SchemeHostPort mail_server("https", "mail.google.com", 443);
116 std::string spdy_server_m = spdy_server_mail.ToString(); 120 std::string spdy_server_m = spdy_server_mail.ToString();
117 121
118 // Check by initializing NULL spdy servers. 122 // Check by initializing NULL spdy servers.
119 impl_.InitializeSpdyServers(NULL, true); 123 impl_.InitializeSpdyServers(NULL, true);
120 EXPECT_FALSE(impl_.SupportsRequestPriority(spdy_server_google)); 124 EXPECT_FALSE(impl_.SupportsRequestPriority(google_server));
121 125
122 // Check by initializing empty spdy servers. 126 // Check by initializing empty spdy servers.
123 std::vector<std::string> spdy_servers; 127 std::vector<std::string> spdy_servers;
124 impl_.InitializeSpdyServers(&spdy_servers, true); 128 impl_.InitializeSpdyServers(&spdy_servers, true);
125 EXPECT_FALSE(impl_.SupportsRequestPriority(spdy_server_google)); 129 EXPECT_FALSE(impl_.SupportsRequestPriority(google_server));
126 130
127 // Check by initializing www.google.com:443 and photos.google.com:443 as spdy 131 // Check by initializing www.google.com:443 and photos.google.com:443 as spdy
128 // servers. 132 // servers.
129 std::vector<std::string> spdy_servers1; 133 std::vector<std::string> spdy_servers1;
130 spdy_servers1.push_back(spdy_server_g); // Will be 0th index. 134 spdy_servers1.push_back(spdy_server_g); // Will be 0th index.
131 spdy_servers1.push_back(spdy_server_p); // Will be 1st index. 135 spdy_servers1.push_back(spdy_server_p); // Will be 1st index.
132 impl_.InitializeSpdyServers(&spdy_servers1, true); 136 impl_.InitializeSpdyServers(&spdy_servers1, true);
133 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_photos)); 137 EXPECT_TRUE(impl_.SupportsRequestPriority(photos_server));
134 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_google)); 138 EXPECT_TRUE(impl_.SupportsRequestPriority(google_server));
135 139
136 // Verify spdy_server_g and spdy_server_d are in the list in the same order. 140 // Verify spdy_server_g and spdy_server_d are in the list in the same order.
137 base::ListValue spdy_server_list; 141 base::ListValue spdy_server_list;
138 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts); 142 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts);
139 EXPECT_EQ(2U, spdy_server_list.GetSize()); 143 EXPECT_EQ(2U, spdy_server_list.GetSize());
140 std::string string_value_g; 144 std::string string_value_g;
141 ASSERT_TRUE(spdy_server_list.GetString(0, &string_value_g)); // 0th index. 145 ASSERT_TRUE(spdy_server_list.GetString(0, &string_value_g)); // 0th index.
142 ASSERT_EQ(spdy_server_g, string_value_g); 146 ASSERT_EQ(spdy_server_g, string_value_g);
143 std::string string_value_p; 147 std::string string_value_p;
144 ASSERT_TRUE(spdy_server_list.GetString(1, &string_value_p)); // 1st index. 148 ASSERT_TRUE(spdy_server_list.GetString(1, &string_value_p)); // 1st index.
(...skipping 15 matching lines...) Expand all
160 ASSERT_EQ(spdy_server_g, string_value_g); 164 ASSERT_EQ(spdy_server_g, string_value_g);
161 ASSERT_TRUE(spdy_server_list.GetString(1, &string_value_p)); 165 ASSERT_TRUE(spdy_server_list.GetString(1, &string_value_p));
162 ASSERT_EQ(spdy_server_p, string_value_p); 166 ASSERT_EQ(spdy_server_p, string_value_p);
163 std::string string_value_m; 167 std::string string_value_m;
164 ASSERT_TRUE(spdy_server_list.GetString(2, &string_value_m)); 168 ASSERT_TRUE(spdy_server_list.GetString(2, &string_value_m));
165 ASSERT_EQ(spdy_server_m, string_value_m); 169 ASSERT_EQ(spdy_server_m, string_value_m);
166 std::string string_value_d; 170 std::string string_value_d;
167 ASSERT_TRUE(spdy_server_list.GetString(3, &string_value_d)); 171 ASSERT_TRUE(spdy_server_list.GetString(3, &string_value_d));
168 ASSERT_EQ(spdy_server_d, string_value_d); 172 ASSERT_EQ(spdy_server_d, string_value_d);
169 173
170 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_docs)); 174 EXPECT_TRUE(impl_.SupportsRequestPriority(docs_server));
171 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_mail)); 175 EXPECT_TRUE(impl_.SupportsRequestPriority(mail_server));
172 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_photos)); 176 EXPECT_TRUE(impl_.SupportsRequestPriority(photos_server));
173 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_google)); 177 EXPECT_TRUE(impl_.SupportsRequestPriority(google_server));
174 178
175 // Verify new data that is being initialized overwrites what is already in the 179 // Verify new data that is being initialized overwrites what is already in the
176 // memory and also verify the recency list order. 180 // memory and also verify the recency list order.
177 // 181 //
178 // Change supports SPDY value for photos and mails servers and order of 182 // Change supports SPDY value for photos and mails servers and order of
179 // initalization shouldn't matter. 183 // initalization shouldn't matter.
180 std::vector<std::string> spdy_servers3; 184 std::vector<std::string> spdy_servers3;
181 spdy_servers3.push_back(spdy_server_m); 185 spdy_servers3.push_back(spdy_server_m);
182 spdy_servers3.push_back(spdy_server_p); 186 spdy_servers3.push_back(spdy_server_p);
183 impl_.InitializeSpdyServers(&spdy_servers3, false); 187 impl_.InitializeSpdyServers(&spdy_servers3, false);
184 188
185 // Verify the entries are in the same order. 189 // Verify the entries are in the same order.
186 ASSERT_TRUE(spdy_server_list.GetString(0, &string_value_g)); 190 ASSERT_TRUE(spdy_server_list.GetString(0, &string_value_g));
187 ASSERT_EQ(spdy_server_g, string_value_g); 191 ASSERT_EQ(spdy_server_g, string_value_g);
188 ASSERT_TRUE(spdy_server_list.GetString(1, &string_value_p)); 192 ASSERT_TRUE(spdy_server_list.GetString(1, &string_value_p));
189 ASSERT_EQ(spdy_server_p, string_value_p); 193 ASSERT_EQ(spdy_server_p, string_value_p);
190 ASSERT_TRUE(spdy_server_list.GetString(2, &string_value_m)); 194 ASSERT_TRUE(spdy_server_list.GetString(2, &string_value_m));
191 ASSERT_EQ(spdy_server_m, string_value_m); 195 ASSERT_EQ(spdy_server_m, string_value_m);
192 ASSERT_TRUE(spdy_server_list.GetString(3, &string_value_d)); 196 ASSERT_TRUE(spdy_server_list.GetString(3, &string_value_d));
193 ASSERT_EQ(spdy_server_d, string_value_d); 197 ASSERT_EQ(spdy_server_d, string_value_d);
194 198
195 // Verify photos and mail servers don't support SPDY and other servers support 199 // Verify photos and mail servers don't support SPDY and other servers support
196 // SPDY. 200 // SPDY.
197 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_docs)); 201 EXPECT_TRUE(impl_.SupportsRequestPriority(docs_server));
198 EXPECT_FALSE(impl_.SupportsRequestPriority(spdy_server_mail)); 202 EXPECT_FALSE(impl_.SupportsRequestPriority(mail_server));
199 EXPECT_FALSE(impl_.SupportsRequestPriority(spdy_server_photos)); 203 EXPECT_FALSE(impl_.SupportsRequestPriority(photos_server));
200 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_google)); 204 EXPECT_TRUE(impl_.SupportsRequestPriority(google_server));
201 } 205 }
202 206
203 TEST_F(SpdyServerPropertiesTest, SupportsRequestPriorityTest) { 207 TEST_F(SpdyServerPropertiesTest, SupportsRequestPriorityTest) {
204 HostPortPair spdy_server_empty(std::string(), 443); 208 url::SchemeHostPort spdy_server_empty("https", std::string(), 443);
209
205 EXPECT_FALSE(impl_.SupportsRequestPriority(spdy_server_empty)); 210 EXPECT_FALSE(impl_.SupportsRequestPriority(spdy_server_empty));
206 211
207 // Add www.google.com:443 as supporting SPDY. 212 // Add www.google.com:443 as supporting SPDY.
208 HostPortPair spdy_server_google("www.google.com", 443); 213 HostPortPair spdy_server_google("www.google.com", 443);
214 url::SchemeHostPort google_server("https", "www.google.com", 443);
209 impl_.SetSupportsSpdy(spdy_server_google, true); 215 impl_.SetSupportsSpdy(spdy_server_google, true);
210 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_google)); 216 EXPECT_TRUE(impl_.SupportsRequestPriority(google_server));
211 217
212 // Add mail.google.com:443 as not supporting SPDY. 218 // Add mail.google.com:443 as not supporting SPDY.
213 HostPortPair spdy_server_mail("mail.google.com", 443); 219 url::SchemeHostPort spdy_server_mail("https", "mail.google.com", 443);
214 EXPECT_FALSE(impl_.SupportsRequestPriority(spdy_server_mail)); 220 EXPECT_FALSE(impl_.SupportsRequestPriority(spdy_server_mail));
215 221
216 // Add docs.google.com:443 as supporting SPDY. 222 // Add docs.google.com:443 as supporting SPDY.
217 HostPortPair spdy_server_docs("docs.google.com", 443); 223 HostPortPair spdy_server_docs("docs.google.com", 443);
224 url::SchemeHostPort docs_server("https", "docs.google.com", 443);
218 impl_.SetSupportsSpdy(spdy_server_docs, true); 225 impl_.SetSupportsSpdy(spdy_server_docs, true);
219 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_docs)); 226 EXPECT_TRUE(impl_.SupportsRequestPriority(docs_server));
220 227
221 // Add www.youtube.com:443 as supporting QUIC. 228 // Add www.youtube.com:443 as supporting QUIC.
222 HostPortPair quic_server_youtube("www.youtube.com", 443); 229 url::SchemeHostPort quic_server_youtube("https", "www.youtube.com", 443);
223 const AlternativeService alternative_service1(QUIC, "www.youtube.com", 443); 230 const AlternativeService alternative_service1(QUIC, "www.youtube.com", 443);
224 SetAlternativeService(quic_server_youtube, alternative_service1); 231 SetAlternativeService(quic_server_youtube, alternative_service1);
225 EXPECT_TRUE(impl_.SupportsRequestPriority(quic_server_youtube)); 232 EXPECT_TRUE(impl_.SupportsRequestPriority(quic_server_youtube));
226 233
227 // Add www.example.com:443 with two alternative services, one supporting QUIC. 234 // Add www.example.com:443 with two alternative services, one supporting QUIC.
228 HostPortPair quic_server_example("www.example.com", 443); 235 url::SchemeHostPort quic_server_example("https", "www.example.com", 443);
229 const AlternativeService alternative_service2(NPN_HTTP_2, "", 443); 236 const AlternativeService alternative_service2(NPN_HTTP_2, "", 443);
230 SetAlternativeService(quic_server_example, alternative_service2); 237 SetAlternativeService(quic_server_example, alternative_service2);
231 SetAlternativeService(quic_server_example, alternative_service1); 238 SetAlternativeService(quic_server_example, alternative_service1);
232 EXPECT_TRUE(impl_.SupportsRequestPriority(quic_server_example)); 239 EXPECT_TRUE(impl_.SupportsRequestPriority(quic_server_example));
233 240
234 // Verify all the entries are the same after additions. 241 // Verify all the entries are the same after additions.
235 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_google)); 242 EXPECT_TRUE(impl_.SupportsRequestPriority(google_server));
236 EXPECT_FALSE(impl_.SupportsRequestPriority(spdy_server_mail)); 243 EXPECT_FALSE(impl_.SupportsRequestPriority(spdy_server_mail));
237 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_docs)); 244 EXPECT_TRUE(impl_.SupportsRequestPriority(docs_server));
238 EXPECT_TRUE(impl_.SupportsRequestPriority(quic_server_youtube)); 245 EXPECT_TRUE(impl_.SupportsRequestPriority(quic_server_youtube));
239 EXPECT_TRUE(impl_.SupportsRequestPriority(quic_server_example)); 246 EXPECT_TRUE(impl_.SupportsRequestPriority(quic_server_example));
240 } 247 }
241 248
242 TEST_F(SpdyServerPropertiesTest, Clear) { 249 TEST_F(SpdyServerPropertiesTest, Clear) {
243 // Add www.google.com:443 and mail.google.com:443 as supporting SPDY. 250 // Add www.google.com:443 and mail.google.com:443 as supporting SPDY.
244 HostPortPair spdy_server_google("www.google.com", 443); 251 HostPortPair spdy_server_google("www.google.com", 443);
252 url::SchemeHostPort google_server("https", "www.google.com", 443);
245 impl_.SetSupportsSpdy(spdy_server_google, true); 253 impl_.SetSupportsSpdy(spdy_server_google, true);
246 HostPortPair spdy_server_mail("mail.google.com", 443); 254 HostPortPair spdy_server_mail("mail.google.com", 443);
255 url::SchemeHostPort mail_server("https", "mail.google.com", 443);
247 impl_.SetSupportsSpdy(spdy_server_mail, true); 256 impl_.SetSupportsSpdy(spdy_server_mail, true);
248 257
249 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_google)); 258 EXPECT_TRUE(impl_.SupportsRequestPriority(google_server));
250 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_mail)); 259 EXPECT_TRUE(impl_.SupportsRequestPriority(mail_server));
251 260
252 impl_.Clear(); 261 impl_.Clear();
253 EXPECT_FALSE(impl_.SupportsRequestPriority(spdy_server_google)); 262 EXPECT_FALSE(impl_.SupportsRequestPriority(google_server));
254 EXPECT_FALSE(impl_.SupportsRequestPriority(spdy_server_mail)); 263 EXPECT_FALSE(impl_.SupportsRequestPriority(mail_server));
255 } 264 }
256 265
257 TEST_F(SpdyServerPropertiesTest, GetSpdyServerList) { 266 TEST_F(SpdyServerPropertiesTest, GetSpdyServerList) {
258 base::ListValue spdy_server_list; 267 base::ListValue spdy_server_list;
259 268
260 // Check there are no spdy_servers. 269 // Check there are no spdy_servers.
261 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts); 270 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts);
262 EXPECT_EQ(0U, spdy_server_list.GetSize()); 271 EXPECT_EQ(0U, spdy_server_list.GetSize());
263 272
264 // Check empty server is not added. 273 // Check empty server is not added.
265 HostPortPair spdy_server_empty(std::string(), 443); 274 HostPortPair spdy_server_empty(std::string(), 443);
275 url::SchemeHostPort empty_server("https", std::string(), 443);
266 impl_.SetSupportsSpdy(spdy_server_empty, true); 276 impl_.SetSupportsSpdy(spdy_server_empty, true);
267 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts); 277 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts);
268 EXPECT_EQ(0U, spdy_server_list.GetSize()); 278 EXPECT_EQ(0U, spdy_server_list.GetSize());
269 279
270 std::string string_value_g; 280 std::string string_value_g;
271 std::string string_value_m; 281 std::string string_value_m;
272 HostPortPair spdy_server_google("www.google.com", 443); 282 HostPortPair spdy_server_google("www.google.com", 443);
283 url::SchemeHostPort google_server("https", "www.google.com", 443);
273 std::string spdy_server_g = spdy_server_google.ToString(); 284 std::string spdy_server_g = spdy_server_google.ToString();
274 HostPortPair spdy_server_mail("mail.google.com", 443); 285 HostPortPair spdy_server_mail("mail.google.com", 443);
286 url::SchemeHostPort mail_server("https", "mail.google.com", 443);
275 std::string spdy_server_m = spdy_server_mail.ToString(); 287 std::string spdy_server_m = spdy_server_mail.ToString();
276 288
277 // Add www.google.com:443 as not supporting SPDY. 289 // Add www.google.com:443 as not supporting SPDY.
278 impl_.SetSupportsSpdy(spdy_server_google, false); 290 impl_.SetSupportsSpdy(spdy_server_google, false);
279 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts); 291 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts);
280 EXPECT_EQ(0U, spdy_server_list.GetSize()); 292 EXPECT_EQ(0U, spdy_server_list.GetSize());
281 293
282 // Add www.google.com:443 as supporting SPDY. 294 // Add www.google.com:443 as supporting SPDY.
283 impl_.SetSupportsSpdy(spdy_server_google, true); 295 impl_.SetSupportsSpdy(spdy_server_google, true);
284 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts); 296 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts);
(...skipping 25 matching lines...) Expand all
310 ASSERT_TRUE(spdy_server_list.GetString(0, &string_value_m)); 322 ASSERT_TRUE(spdy_server_list.GetString(0, &string_value_m));
311 ASSERT_EQ(spdy_server_m, string_value_m); 323 ASSERT_EQ(spdy_server_m, string_value_m);
312 } 324 }
313 325
314 TEST_F(SpdyServerPropertiesTest, MRUOfGetSpdyServerList) { 326 TEST_F(SpdyServerPropertiesTest, MRUOfGetSpdyServerList) {
315 base::ListValue spdy_server_list; 327 base::ListValue spdy_server_list;
316 328
317 std::string string_value_g; 329 std::string string_value_g;
318 std::string string_value_m; 330 std::string string_value_m;
319 HostPortPair spdy_server_google("www.google.com", 443); 331 HostPortPair spdy_server_google("www.google.com", 443);
332 url::SchemeHostPort google_server("https", "www.google.com", 443);
320 std::string spdy_server_g = spdy_server_google.ToString(); 333 std::string spdy_server_g = spdy_server_google.ToString();
321 HostPortPair spdy_server_mail("mail.google.com", 443); 334 HostPortPair spdy_server_mail("mail.google.com", 443);
335 url::SchemeHostPort mail_server("https", "mail.google.com", 443);
322 std::string spdy_server_m = spdy_server_mail.ToString(); 336 std::string spdy_server_m = spdy_server_mail.ToString();
323 337
324 // Add www.google.com:443 as supporting SPDY. 338 // Add www.google.com:443 as supporting SPDY.
325 impl_.SetSupportsSpdy(spdy_server_google, true); 339 impl_.SetSupportsSpdy(spdy_server_google, true);
326 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts); 340 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts);
327 ASSERT_EQ(1U, spdy_server_list.GetSize()); 341 ASSERT_EQ(1U, spdy_server_list.GetSize());
328 ASSERT_TRUE(spdy_server_list.GetString(0, &string_value_g)); 342 ASSERT_TRUE(spdy_server_list.GetString(0, &string_value_g));
329 ASSERT_EQ(spdy_server_g, string_value_g); 343 ASSERT_EQ(spdy_server_g, string_value_g);
330 344
331 // Add mail.google.com:443 as supporting SPDY. Verify mail.google.com:443 and 345 // Add mail.google.com:443 as supporting SPDY. Verify mail.google.com:443 and
332 // www.google.com:443 are in the list. 346 // www.google.com:443 are in the list.
333 impl_.SetSupportsSpdy(spdy_server_mail, true); 347 impl_.SetSupportsSpdy(spdy_server_mail, true);
334 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts); 348 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts);
335 ASSERT_EQ(2U, spdy_server_list.GetSize()); 349 ASSERT_EQ(2U, spdy_server_list.GetSize());
336 ASSERT_TRUE(spdy_server_list.GetString(0, &string_value_m)); 350 ASSERT_TRUE(spdy_server_list.GetString(0, &string_value_m));
337 ASSERT_EQ(spdy_server_m, string_value_m); 351 ASSERT_EQ(spdy_server_m, string_value_m);
338 ASSERT_TRUE(spdy_server_list.GetString(1, &string_value_g)); 352 ASSERT_TRUE(spdy_server_list.GetString(1, &string_value_g));
339 ASSERT_EQ(spdy_server_g, string_value_g); 353 ASSERT_EQ(spdy_server_g, string_value_g);
340 354
341 // Get www.google.com:443 should reorder SpdyServerHostPortMap. Verify that it 355 // Get www.google.com:443 should reorder SpdyServerHostPortMap. Verify that it
342 // is www.google.com:443 is the MRU server. 356 // is www.google.com:443 is the MRU server.
343 EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_google)); 357 EXPECT_TRUE(impl_.SupportsRequestPriority(google_server));
344 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts); 358 impl_.GetSpdyServerList(&spdy_server_list, kMaxSupportsSpdyServerHosts);
345 ASSERT_EQ(2U, spdy_server_list.GetSize()); 359 ASSERT_EQ(2U, spdy_server_list.GetSize());
346 ASSERT_TRUE(spdy_server_list.GetString(0, &string_value_g)); 360 ASSERT_TRUE(spdy_server_list.GetString(0, &string_value_g));
347 ASSERT_EQ(spdy_server_g, string_value_g); 361 ASSERT_EQ(spdy_server_g, string_value_g);
348 ASSERT_TRUE(spdy_server_list.GetString(1, &string_value_m)); 362 ASSERT_TRUE(spdy_server_list.GetString(1, &string_value_m));
349 ASSERT_EQ(spdy_server_m, string_value_m); 363 ASSERT_EQ(spdy_server_m, string_value_m);
350 } 364 }
351 365
352 typedef HttpServerPropertiesImplTest AlternateProtocolServerPropertiesTest; 366 typedef HttpServerPropertiesImplTest AlternateProtocolServerPropertiesTest;
353 367
354 TEST_F(AlternateProtocolServerPropertiesTest, Basic) { 368 TEST_F(AlternateProtocolServerPropertiesTest, Basic) {
355 HostPortPair test_host_port_pair("foo", 80); 369 url::SchemeHostPort scheme_origin("http", "foo", 80);
356 EXPECT_FALSE(HasAlternativeService(test_host_port_pair)); 370 EXPECT_FALSE(HasAlternativeService(scheme_origin));
357 371
358 AlternativeService alternative_service(NPN_HTTP_2, "foo", 443); 372 AlternativeService alternative_service(NPN_HTTP_2, "foo", 443);
359 SetAlternativeService(test_host_port_pair, alternative_service); 373 SetAlternativeService(scheme_origin, alternative_service);
360 const AlternativeServiceVector alternative_service_vector = 374 const AlternativeServiceVector alternative_service_vector =
361 impl_.GetAlternativeServices(test_host_port_pair); 375 impl_.GetAlternativeServices(scheme_origin);
362 ASSERT_EQ(1u, alternative_service_vector.size()); 376 ASSERT_EQ(1u, alternative_service_vector.size());
363 EXPECT_EQ(alternative_service, alternative_service_vector[0]); 377 EXPECT_EQ(alternative_service, alternative_service_vector[0]);
364 378
365 impl_.Clear(); 379 impl_.Clear();
366 EXPECT_FALSE(HasAlternativeService(test_host_port_pair)); 380 EXPECT_FALSE(HasAlternativeService(scheme_origin));
367 } 381 }
368 382
369 TEST_F(AlternateProtocolServerPropertiesTest, ExcludeOrigin) { 383 TEST_F(AlternateProtocolServerPropertiesTest, ExcludeOrigin) {
370 AlternativeServiceInfoVector alternative_service_info_vector; 384 AlternativeServiceInfoVector alternative_service_info_vector;
371 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); 385 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
372 // Same hostname, same port, TCP: should be ignored. 386 // Same hostname, same port, TCP: should be ignored.
373 AlternativeService alternative_service1(NPN_HTTP_2, "foo", 443); 387 AlternativeService alternative_service1(NPN_HTTP_2, "foo", 443);
374 alternative_service_info_vector.push_back( 388 alternative_service_info_vector.push_back(
375 AlternativeServiceInfo(alternative_service1, expiration)); 389 AlternativeServiceInfo(alternative_service1, expiration));
376 // Different hostname: GetAlternativeServices should return this one. 390 // Different hostname: GetAlternativeServices should return this one.
377 AlternativeService alternative_service2(NPN_HTTP_2, "bar", 443); 391 AlternativeService alternative_service2(NPN_HTTP_2, "bar", 443);
378 alternative_service_info_vector.push_back( 392 alternative_service_info_vector.push_back(
379 AlternativeServiceInfo(alternative_service2, expiration)); 393 AlternativeServiceInfo(alternative_service2, expiration));
380 // Different port: GetAlternativeServices should return this one too. 394 // Different port: GetAlternativeServices should return this one too.
381 AlternativeService alternative_service3(NPN_HTTP_2, "foo", 80); 395 AlternativeService alternative_service3(NPN_HTTP_2, "foo", 80);
382 alternative_service_info_vector.push_back( 396 alternative_service_info_vector.push_back(
383 AlternativeServiceInfo(alternative_service3, expiration)); 397 AlternativeServiceInfo(alternative_service3, expiration));
384 // QUIC: GetAlternativeServices should return this one too. 398 // QUIC: GetAlternativeServices should return this one too.
385 AlternativeService alternative_service4(QUIC, "foo", 443); 399 AlternativeService alternative_service4(QUIC, "foo", 443);
386 alternative_service_info_vector.push_back( 400 alternative_service_info_vector.push_back(
387 AlternativeServiceInfo(alternative_service4, expiration)); 401 AlternativeServiceInfo(alternative_service4, expiration));
388 402
389 HostPortPair test_host_port_pair("foo", 443); 403 url::SchemeHostPort scheme_origin("https", "foo", 443);
390 impl_.SetAlternativeServices(test_host_port_pair, 404 impl_.SetAlternativeServices(scheme_origin, alternative_service_info_vector);
391 alternative_service_info_vector);
392 405
393 const AlternativeServiceVector alternative_service_vector = 406 const AlternativeServiceVector alternative_service_vector =
394 impl_.GetAlternativeServices(test_host_port_pair); 407 impl_.GetAlternativeServices(scheme_origin);
395 ASSERT_EQ(3u, alternative_service_vector.size()); 408 ASSERT_EQ(3u, alternative_service_vector.size());
396 EXPECT_EQ(alternative_service2, alternative_service_vector[0]); 409 EXPECT_EQ(alternative_service2, alternative_service_vector[0]);
397 EXPECT_EQ(alternative_service3, alternative_service_vector[1]); 410 EXPECT_EQ(alternative_service3, alternative_service_vector[1]);
398 EXPECT_EQ(alternative_service4, alternative_service_vector[2]); 411 EXPECT_EQ(alternative_service4, alternative_service_vector[2]);
399 } 412 }
400 413
401 TEST_F(AlternateProtocolServerPropertiesTest, Initialize) { 414 TEST_F(AlternateProtocolServerPropertiesTest, Initialize) {
402 // |test_host_port_pair1| has an alternative service, which will not be 415 // |test_host_port_pair1| has an alternative service, which will not be
403 // affected by InitializeAlternativeServiceServers(), because 416 // affected by InitializeAlternativeServiceServers(), because
404 // |alternative_service_map| does not have an entry for 417 // |alternative_service_map| does not have an entry for
405 // |test_host_port_pair1|. 418 // |test_host_port_pair1|.
406 HostPortPair test_host_port_pair1("foo1", 80); 419 HostPortPair test_host_port_pair1("foo1", 80);
420 url::SchemeHostPort scheme_origin1("http", "foo1", 80);
407 const AlternativeService alternative_service1(NPN_HTTP_2, "bar1", 443); 421 const AlternativeService alternative_service1(NPN_HTTP_2, "bar1", 443);
408 const base::Time now = base::Time::Now(); 422 const base::Time now = base::Time::Now();
409 base::Time expiration1 = now + base::TimeDelta::FromDays(1); 423 base::Time expiration1 = now + base::TimeDelta::FromDays(1);
410 // 1st entry in the memory. 424 // 1st entry in the memory.
411 impl_.SetAlternativeService(test_host_port_pair1, alternative_service1, 425 impl_.SetAlternativeService(scheme_origin1, alternative_service1,
412 expiration1); 426 expiration1);
413 427
414 // |test_host_port_pair2| has an alternative service, which will be 428 // |test_host_port_pair2| has an alternative service, which will be
415 // overwritten by InitializeAlternativeServiceServers(), because 429 // overwritten by InitializeAlternativeServiceServers(), because
416 // |alternative_service_map| has an entry for 430 // |alternative_service_map| has an entry for
417 // |test_host_port_pair2|. 431 // |test_host_port_pair2|.
418 AlternativeServiceInfoVector alternative_service_info_vector; 432 AlternativeServiceInfoVector alternative_service_info_vector;
419 const AlternativeService alternative_service2(NPN_SPDY_3_1, "bar2", 443); 433 const AlternativeService alternative_service2(NPN_SPDY_3_1, "bar2", 443);
420 base::Time expiration2 = now + base::TimeDelta::FromDays(2); 434 base::Time expiration2 = now + base::TimeDelta::FromDays(2);
421 alternative_service_info_vector.push_back( 435 alternative_service_info_vector.push_back(
422 AlternativeServiceInfo(alternative_service2, expiration2)); 436 AlternativeServiceInfo(alternative_service2, expiration2));
423 HostPortPair test_host_port_pair2("foo2", 80); 437 HostPortPair test_host_port_pair2("foo2", 80);
438 url::SchemeHostPort scheme_origin2("http", "foo2", 80);
424 // 0th entry in the memory. 439 // 0th entry in the memory.
425 impl_.SetAlternativeServices(test_host_port_pair2, 440 impl_.SetAlternativeServices(scheme_origin2, alternative_service_info_vector);
426 alternative_service_info_vector);
427 441
428 // Prepare |alternative_service_map| to be loaded by 442 // Prepare |alternative_service_map| to be loaded by
429 // InitializeAlternativeServiceServers(). 443 // InitializeAlternativeServiceServers().
430 AlternativeServiceMap alternative_service_map( 444 AlternativeServiceMap alternative_service_map(
431 AlternativeServiceMap::NO_AUTO_EVICT); 445 AlternativeServiceMap::NO_AUTO_EVICT);
432 const AlternativeService alternative_service3(NPN_HTTP_2, "bar3", 123); 446 const AlternativeService alternative_service3(NPN_HTTP_2, "bar3", 123);
433 base::Time expiration3 = now + base::TimeDelta::FromDays(3); 447 base::Time expiration3 = now + base::TimeDelta::FromDays(3);
434 const AlternativeServiceInfo alternative_service_info1(alternative_service3, 448 const AlternativeServiceInfo alternative_service_info1(alternative_service3,
435 expiration3); 449 expiration3);
436 // Simulate updating data for 0th entry with data from Preferences. 450 // Simulate updating data for 0th entry with data from Preferences.
437 alternative_service_map.Put( 451 alternative_service_map.Put(
438 test_host_port_pair2, 452 scheme_origin2,
439 AlternativeServiceInfoVector(/*size=*/1, alternative_service_info1)); 453 AlternativeServiceInfoVector(/*size=*/1, alternative_service_info1));
440 454
441 HostPortPair test_host_port_pair3("foo3", 80); 455 HostPortPair test_host_port_pair3("foo3", 80);
456 url::SchemeHostPort scheme_origin3("http", "foo3", 80);
442 const AlternativeService alternative_service4(NPN_HTTP_2, "bar4", 1234); 457 const AlternativeService alternative_service4(NPN_HTTP_2, "bar4", 1234);
443 base::Time expiration4 = now + base::TimeDelta::FromDays(4); 458 base::Time expiration4 = now + base::TimeDelta::FromDays(4);
444 const AlternativeServiceInfo alternative_service_info2(alternative_service4, 459 const AlternativeServiceInfo alternative_service_info2(alternative_service4,
445 expiration4); 460 expiration4);
446 // Add an old entry from Preferences, this will be added to end of recency 461 // Add an old entry from Preferences, this will be added to end of recency
447 // list. 462 // list.
448 alternative_service_map.Put( 463 alternative_service_map.Put(
449 test_host_port_pair3, 464 scheme_origin3,
450 AlternativeServiceInfoVector(/*size=*/1, alternative_service_info2)); 465 AlternativeServiceInfoVector(/*size=*/1, alternative_service_info2));
451 466
452 // MRU list will be test_host_port_pair2, test_host_port_pair1, 467 // MRU list will be test_host_port_pair2, test_host_port_pair1,
453 // test_host_port_pair3. 468 // test_host_port_pair3.
454 impl_.InitializeAlternativeServiceServers(&alternative_service_map); 469 impl_.InitializeAlternativeServiceServers(&alternative_service_map);
455 470
456 // Verify alternative_service_map. 471 // Verify alternative_service_map.
457 const AlternativeServiceMap& map = impl_.alternative_service_map(); 472 const AlternativeServiceMap& map = impl_.alternative_service_map();
458 ASSERT_EQ(3u, map.size()); 473 ASSERT_EQ(3u, map.size());
459 AlternativeServiceMap::const_iterator map_it = map.begin(); 474 AlternativeServiceMap::const_iterator map_it = map.begin();
460 475
461 EXPECT_TRUE(map_it->first.Equals(test_host_port_pair2)); 476 EXPECT_TRUE(HostPortPair::FromSchemeHostPort(map_it->first)
477 .Equals(test_host_port_pair2));
462 ASSERT_EQ(1u, map_it->second.size()); 478 ASSERT_EQ(1u, map_it->second.size());
463 EXPECT_EQ(alternative_service3, map_it->second[0].alternative_service); 479 EXPECT_EQ(alternative_service3, map_it->second[0].alternative_service);
464 EXPECT_EQ(expiration3, map_it->second[0].expiration); 480 EXPECT_EQ(expiration3, map_it->second[0].expiration);
465 ++map_it; 481 ++map_it;
466 EXPECT_TRUE(map_it->first.Equals(test_host_port_pair1)); 482 EXPECT_TRUE(HostPortPair::FromSchemeHostPort(map_it->first)
483 .Equals(test_host_port_pair1));
467 ASSERT_EQ(1u, map_it->second.size()); 484 ASSERT_EQ(1u, map_it->second.size());
468 EXPECT_EQ(alternative_service1, map_it->second[0].alternative_service); 485 EXPECT_EQ(alternative_service1, map_it->second[0].alternative_service);
469 EXPECT_EQ(expiration1, map_it->second[0].expiration); 486 EXPECT_EQ(expiration1, map_it->second[0].expiration);
470 ++map_it; 487 ++map_it;
471 EXPECT_TRUE(map_it->first.Equals(test_host_port_pair3)); 488 EXPECT_TRUE(HostPortPair::FromSchemeHostPort(map_it->first)
489 .Equals(test_host_port_pair3));
472 ASSERT_EQ(1u, map_it->second.size()); 490 ASSERT_EQ(1u, map_it->second.size());
473 EXPECT_EQ(alternative_service4, map_it->second[0].alternative_service); 491 EXPECT_EQ(alternative_service4, map_it->second[0].alternative_service);
474 EXPECT_EQ(expiration4, map_it->second[0].expiration); 492 EXPECT_EQ(expiration4, map_it->second[0].expiration);
475 } 493 }
476 494
477 // Regression test for https://crbug.com/504032: 495 // Regression test for https://crbug.com/504032:
478 // InitializeAlternativeServiceServers() should not crash if there is an empty 496 // InitializeAlternativeServiceServers() should not crash if there is an empty
479 // hostname is the mapping. 497 // hostname is the mapping.
480 TEST_F(AlternateProtocolServerPropertiesTest, InitializeWithEmptyHostname) { 498 TEST_F(AlternateProtocolServerPropertiesTest, InitializeWithEmptyHostname) {
481 const HostPortPair host_port_pair("foo", 443); 499 url::SchemeHostPort scheme_origin("https", "foo", 443);
482 const AlternativeService alternative_service_with_empty_hostname(NPN_HTTP_2, 500 const AlternativeService alternative_service_with_empty_hostname(NPN_HTTP_2,
483 "", 1234); 501 "", 1234);
484 const AlternativeService alternative_service_with_foo_hostname(NPN_HTTP_2, 502 const AlternativeService alternative_service_with_foo_hostname(NPN_HTTP_2,
485 "foo", 1234); 503 "foo", 1234);
486 SetAlternativeService(host_port_pair, 504 SetAlternativeService(scheme_origin, alternative_service_with_empty_hostname);
487 alternative_service_with_empty_hostname);
488 impl_.MarkAlternativeServiceBroken(alternative_service_with_foo_hostname); 505 impl_.MarkAlternativeServiceBroken(alternative_service_with_foo_hostname);
489 506
490 AlternativeServiceMap alternative_service_map( 507 AlternativeServiceMap alternative_service_map(
491 AlternativeServiceMap::NO_AUTO_EVICT); 508 AlternativeServiceMap::NO_AUTO_EVICT);
492 impl_.InitializeAlternativeServiceServers(&alternative_service_map); 509 impl_.InitializeAlternativeServiceServers(&alternative_service_map);
493 510
494 EXPECT_TRUE( 511 EXPECT_TRUE(
495 impl_.IsAlternativeServiceBroken(alternative_service_with_foo_hostname)); 512 impl_.IsAlternativeServiceBroken(alternative_service_with_foo_hostname));
496 const AlternativeServiceVector alternative_service_vector = 513 const AlternativeServiceVector alternative_service_vector =
497 impl_.GetAlternativeServices(host_port_pair); 514 impl_.GetAlternativeServices(scheme_origin);
498 ASSERT_EQ(1u, alternative_service_vector.size()); 515 ASSERT_EQ(1u, alternative_service_vector.size());
499 EXPECT_EQ(alternative_service_with_foo_hostname, 516 EXPECT_EQ(alternative_service_with_foo_hostname,
500 alternative_service_vector[0]); 517 alternative_service_vector[0]);
501 } 518 }
502 519
503 // Regression test for https://crbug.com/516486: 520 // Regression test for https://crbug.com/516486:
504 // GetAlternativeServices() should remove |alternative_service_map_| elements 521 // GetAlternativeServices() should remove |alternative_service_map_| elements
505 // with empty value. 522 // with empty value.
506 TEST_F(AlternateProtocolServerPropertiesTest, EmptyVector) { 523 TEST_F(AlternateProtocolServerPropertiesTest, EmptyVector) {
507 HostPortPair host_port_pair("foo", 443); 524 HostPortPair host_port_pair("foo", 443);
525 url::SchemeHostPort scheme_origin("https", "foo", 443);
508 const AlternativeService alternative_service(NPN_HTTP_2, "bar", 443); 526 const AlternativeService alternative_service(NPN_HTTP_2, "bar", 443);
509 base::Time expiration = base::Time::Now() - base::TimeDelta::FromDays(1); 527 base::Time expiration = base::Time::Now() - base::TimeDelta::FromDays(1);
510 const AlternativeServiceInfo alternative_service_info(alternative_service, 528 const AlternativeServiceInfo alternative_service_info(alternative_service,
511 expiration); 529 expiration);
512 AlternativeServiceMap alternative_service_map( 530 AlternativeServiceMap alternative_service_map(
513 AlternativeServiceMap::NO_AUTO_EVICT); 531 AlternativeServiceMap::NO_AUTO_EVICT);
514 alternative_service_map.Put( 532 alternative_service_map.Put(
515 host_port_pair, 533 scheme_origin,
516 AlternativeServiceInfoVector(/*size=*/1, alternative_service_info)); 534 AlternativeServiceInfoVector(/*size=*/1, alternative_service_info));
517 535
518 // Prepare |alternative_service_map_| with a single key that has a single 536 // Prepare |alternative_service_map_| with a single key that has a single
519 // AlternativeServiceInfo with identical hostname and port. 537 // AlternativeServiceInfo with identical hostname and port.
520 impl_.InitializeAlternativeServiceServers(&alternative_service_map); 538 impl_.InitializeAlternativeServiceServers(&alternative_service_map);
521 539
522 // GetAlternativeServices() should remove such AlternativeServiceInfo from 540 // GetAlternativeServices() should remove such AlternativeServiceInfo from
523 // |alternative_service_map_|, emptying the AlternativeServiceInfoVector 541 // |alternative_service_map_|, emptying the AlternativeServiceInfoVector
524 // corresponding to |host_port_pair|. 542 // corresponding to |host_port_pair|.
525 AlternativeServiceVector alternative_service_vector = 543 AlternativeServiceVector alternative_service_vector =
526 impl_.GetAlternativeServices(host_port_pair); 544 impl_.GetAlternativeServices(scheme_origin);
527 ASSERT_TRUE(alternative_service_vector.empty()); 545 ASSERT_TRUE(alternative_service_vector.empty());
528 546
529 // GetAlternativeServices() should remove this key from 547 // GetAlternativeServices() should remove this key from
530 // |alternative_service_map_|, and SetAlternativeServices() should not crash. 548 // |alternative_service_map_|, and SetAlternativeServices() should not crash.
531 impl_.SetAlternativeServices( 549 impl_.SetAlternativeServices(
532 host_port_pair, 550 scheme_origin,
533 AlternativeServiceInfoVector(/*size=*/1, alternative_service_info)); 551 AlternativeServiceInfoVector(/*size=*/1, alternative_service_info));
534 552
535 // There should still be no alternative service assigned to |host_port_pair|. 553 // There should still be no alternative service assigned to |host_port_pair|.
536 alternative_service_vector = impl_.GetAlternativeServices(host_port_pair); 554 alternative_service_vector = impl_.GetAlternativeServices(scheme_origin);
537 ASSERT_TRUE(alternative_service_vector.empty()); 555 ASSERT_TRUE(alternative_service_vector.empty());
538 } 556 }
539 557
540 // Regression test for https://crbug.com/516486 for the canonical host case. 558 // Regression test for https://crbug.com/516486 for the canonical host case.
541 TEST_F(AlternateProtocolServerPropertiesTest, EmptyVectorForCanonical) { 559 TEST_F(AlternateProtocolServerPropertiesTest, EmptyVectorForCanonical) {
542 HostPortPair host_port_pair("foo.c.youtube.com", 443); 560 HostPortPair host_port_pair("foo.c.youtube.com", 443);
561 url::SchemeHostPort scheme_origin("https", "foo.c.youtube.com", 443);
543 HostPortPair canonical_host_port_pair("bar.c.youtube.com", 443); 562 HostPortPair canonical_host_port_pair("bar.c.youtube.com", 443);
563 url::SchemeHostPort canonical_scheme_origin("https", "bar.c.youtube.com",
564 443);
544 const AlternativeService alternative_service(NPN_HTTP_2, "", 443); 565 const AlternativeService alternative_service(NPN_HTTP_2, "", 443);
545 base::Time expiration = base::Time::Now() - base::TimeDelta::FromDays(1); 566 base::Time expiration = base::Time::Now() - base::TimeDelta::FromDays(1);
546 const AlternativeServiceInfo alternative_service_info(alternative_service, 567 const AlternativeServiceInfo alternative_service_info(alternative_service,
547 expiration); 568 expiration);
548 AlternativeServiceMap alternative_service_map( 569 AlternativeServiceMap alternative_service_map(
549 AlternativeServiceMap::NO_AUTO_EVICT); 570 AlternativeServiceMap::NO_AUTO_EVICT);
550 alternative_service_map.Put( 571 alternative_service_map.Put(
551 canonical_host_port_pair, 572 canonical_scheme_origin,
552 AlternativeServiceInfoVector(/*size=*/1, alternative_service_info)); 573 AlternativeServiceInfoVector(/*size=*/1, alternative_service_info));
553 574
554 // Prepare |alternative_service_map_| with a single key that has a single 575 // Prepare |alternative_service_map_| with a single key that has a single
555 // AlternativeServiceInfo with identical hostname and port. 576 // AlternativeServiceInfo with identical hostname and port.
556 impl_.InitializeAlternativeServiceServers(&alternative_service_map); 577 impl_.InitializeAlternativeServiceServers(&alternative_service_map);
557 578
558 // GetAlternativeServices() should remove such AlternativeServiceInfo from 579 // GetAlternativeServices() should remove such AlternativeServiceInfo from
559 // |alternative_service_map_|, emptying the AlternativeServiceInfoVector 580 // |alternative_service_map_|, emptying the AlternativeServiceInfoVector
560 // corresponding to |canonical_host_port_pair|, even when looking up 581 // corresponding to |canonical_host_port_pair|, even when looking up
561 // alternative services for |host_port_pair|. 582 // alternative services for |host_port_pair|.
562 AlternativeServiceVector alternative_service_vector = 583 AlternativeServiceVector alternative_service_vector =
563 impl_.GetAlternativeServices(host_port_pair); 584 impl_.GetAlternativeServices(scheme_origin);
564 ASSERT_TRUE(alternative_service_vector.empty()); 585 ASSERT_TRUE(alternative_service_vector.empty());
565 586
566 // GetAlternativeServices() should remove this key from 587 // GetAlternativeServices() should remove this key from
567 // |alternative_service_map_|, and SetAlternativeServices() should not crash. 588 // |alternative_service_map_|, and SetAlternativeServices() should not crash.
568 impl_.SetAlternativeServices( 589 impl_.SetAlternativeServices(
569 canonical_host_port_pair, 590 canonical_scheme_origin,
570 AlternativeServiceInfoVector(/*size=*/1, alternative_service_info)); 591 AlternativeServiceInfoVector(/*size=*/1, alternative_service_info));
571 592
572 // There should still be no alternative service assigned to 593 // There should still be no alternative service assigned to
573 // |canonical_host_port_pair|. 594 // |canonical_host_port_pair|.
574 alternative_service_vector = 595 alternative_service_vector =
575 impl_.GetAlternativeServices(canonical_host_port_pair); 596 impl_.GetAlternativeServices(canonical_scheme_origin);
576 ASSERT_TRUE(alternative_service_vector.empty()); 597 ASSERT_TRUE(alternative_service_vector.empty());
577 } 598 }
578 599
579 TEST_F(AlternateProtocolServerPropertiesTest, MRUOfGetAlternativeServices) { 600 TEST_F(AlternateProtocolServerPropertiesTest, MRUOfGetAlternativeServices) {
580 HostPortPair test_host_port_pair1("foo1", 80); 601 HostPortPair test_host_port_pair1("foo1", 80);
602 url::SchemeHostPort scheme_origin1("http", "foo1", 80);
581 const AlternativeService alternative_service1(NPN_SPDY_3_1, "foo1", 443); 603 const AlternativeService alternative_service1(NPN_SPDY_3_1, "foo1", 443);
582 SetAlternativeService(test_host_port_pair1, alternative_service1); 604 SetAlternativeService(scheme_origin1, alternative_service1);
583 HostPortPair test_host_port_pair2("foo2", 80); 605 HostPortPair test_host_port_pair2("foo2", 80);
606 url::SchemeHostPort scheme_origin2("http", "foo2", 80);
584 const AlternativeService alternative_service2(NPN_HTTP_2, "foo2", 1234); 607 const AlternativeService alternative_service2(NPN_HTTP_2, "foo2", 1234);
585 SetAlternativeService(test_host_port_pair2, alternative_service2); 608 SetAlternativeService(scheme_origin2, alternative_service2);
586
587 const AlternativeServiceMap& map = impl_.alternative_service_map(); 609 const AlternativeServiceMap& map = impl_.alternative_service_map();
588 AlternativeServiceMap::const_iterator it = map.begin(); 610 AlternativeServiceMap::const_iterator it = map.begin();
589 EXPECT_TRUE(it->first.Equals(test_host_port_pair2)); 611 EXPECT_TRUE(
612 HostPortPair::FromSchemeHostPort(it->first).Equals(test_host_port_pair2));
590 ASSERT_EQ(1u, it->second.size()); 613 ASSERT_EQ(1u, it->second.size());
591 EXPECT_EQ(alternative_service2, it->second[0].alternative_service); 614 EXPECT_EQ(alternative_service2, it->second[0].alternative_service);
592 615
593 const AlternativeServiceVector alternative_service_vector = 616 const AlternativeServiceVector alternative_service_vector =
594 impl_.GetAlternativeServices(test_host_port_pair1); 617 impl_.GetAlternativeServices(scheme_origin1);
595 ASSERT_EQ(1u, alternative_service_vector.size()); 618 ASSERT_EQ(1u, alternative_service_vector.size());
596 EXPECT_EQ(alternative_service1, alternative_service_vector[0]); 619 EXPECT_EQ(alternative_service1, alternative_service_vector[0]);
597 620
598 // GetAlternativeServices should reorder the AlternateProtocol map. 621 // GetAlternativeServices should reorder the AlternateProtocol map.
599 it = map.begin(); 622 it = map.begin();
600 EXPECT_TRUE(it->first.Equals(test_host_port_pair1)); 623 EXPECT_TRUE(
624 HostPortPair::FromSchemeHostPort(it->first).Equals(test_host_port_pair1));
601 ASSERT_EQ(1u, it->second.size()); 625 ASSERT_EQ(1u, it->second.size());
602 EXPECT_EQ(alternative_service1, it->second[0].alternative_service); 626 EXPECT_EQ(alternative_service1, it->second[0].alternative_service);
603 } 627 }
604 628
605 TEST_F(AlternateProtocolServerPropertiesTest, SetBroken) { 629 TEST_F(AlternateProtocolServerPropertiesTest, SetBroken) {
606 HostPortPair test_host_port_pair("foo", 80); 630 url::SchemeHostPort scheme_origin("http", "foo", 80);
607 const AlternativeService alternative_service1(NPN_HTTP_2, "foo", 443); 631 const AlternativeService alternative_service1(NPN_HTTP_2, "foo", 443);
608 SetAlternativeService(test_host_port_pair, alternative_service1); 632 SetAlternativeService(scheme_origin, alternative_service1);
609 AlternativeServiceVector alternative_service_vector = 633 AlternativeServiceVector alternative_service_vector =
610 impl_.GetAlternativeServices(test_host_port_pair); 634 impl_.GetAlternativeServices(scheme_origin);
611 ASSERT_EQ(1u, alternative_service_vector.size()); 635 ASSERT_EQ(1u, alternative_service_vector.size());
612 EXPECT_EQ(alternative_service1, alternative_service_vector[0]); 636 EXPECT_EQ(alternative_service1, alternative_service_vector[0]);
613 EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service1)); 637 EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service1));
614 638
615 // GetAlternativeServices should return the broken alternative service. 639 // GetAlternativeServices should return the broken alternative service.
616 impl_.MarkAlternativeServiceBroken(alternative_service1); 640 impl_.MarkAlternativeServiceBroken(alternative_service1);
617 alternative_service_vector = 641 alternative_service_vector = impl_.GetAlternativeServices(scheme_origin);
618 impl_.GetAlternativeServices(test_host_port_pair);
619 ASSERT_EQ(1u, alternative_service_vector.size()); 642 ASSERT_EQ(1u, alternative_service_vector.size());
620 EXPECT_EQ(alternative_service1, alternative_service_vector[0]); 643 EXPECT_EQ(alternative_service1, alternative_service_vector[0]);
621 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(alternative_service1)); 644 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(alternative_service1));
622 645
623 // SetAlternativeServices should add a broken alternative service to the map. 646 // SetAlternativeServices should add a broken alternative service to the map.
624 AlternativeServiceInfoVector alternative_service_info_vector; 647 AlternativeServiceInfoVector alternative_service_info_vector;
625 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); 648 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
626 alternative_service_info_vector.push_back( 649 alternative_service_info_vector.push_back(
627 AlternativeServiceInfo(alternative_service1, expiration)); 650 AlternativeServiceInfo(alternative_service1, expiration));
628 const AlternativeService alternative_service2(NPN_HTTP_2, "foo", 1234); 651 const AlternativeService alternative_service2(NPN_HTTP_2, "foo", 1234);
629 alternative_service_info_vector.push_back( 652 alternative_service_info_vector.push_back(
630 AlternativeServiceInfo(alternative_service2, expiration)); 653 AlternativeServiceInfo(alternative_service2, expiration));
631 impl_.SetAlternativeServices(test_host_port_pair, 654 impl_.SetAlternativeServices(scheme_origin, alternative_service_info_vector);
632 alternative_service_info_vector); 655 alternative_service_vector = impl_.GetAlternativeServices(scheme_origin);
633 alternative_service_vector =
634 impl_.GetAlternativeServices(test_host_port_pair);
635 ASSERT_EQ(2u, alternative_service_vector.size()); 656 ASSERT_EQ(2u, alternative_service_vector.size());
636 EXPECT_EQ(alternative_service1, alternative_service_vector[0]); 657 EXPECT_EQ(alternative_service1, alternative_service_vector[0]);
637 EXPECT_EQ(alternative_service2, alternative_service_vector[1]); 658 EXPECT_EQ(alternative_service2, alternative_service_vector[1]);
638 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(alternative_service_vector[0])); 659 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(alternative_service_vector[0]));
639 EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service_vector[1])); 660 EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service_vector[1]));
640 661
641 // SetAlternativeService should add a broken alternative service to the map. 662 // SetAlternativeService should add a broken alternative service to the map.
642 SetAlternativeService(test_host_port_pair, alternative_service1); 663 SetAlternativeService(scheme_origin, alternative_service1);
643 alternative_service_vector = 664 alternative_service_vector = impl_.GetAlternativeServices(scheme_origin);
644 impl_.GetAlternativeServices(test_host_port_pair);
645 ASSERT_EQ(1u, alternative_service_vector.size()); 665 ASSERT_EQ(1u, alternative_service_vector.size());
646 EXPECT_EQ(alternative_service1, alternative_service_vector[0]); 666 EXPECT_EQ(alternative_service1, alternative_service_vector[0]);
647 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(alternative_service_vector[0])); 667 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(alternative_service_vector[0]));
648 } 668 }
649 669
650 TEST_F(AlternateProtocolServerPropertiesTest, MaxAge) { 670 TEST_F(AlternateProtocolServerPropertiesTest, MaxAge) {
651 AlternativeServiceInfoVector alternative_service_info_vector; 671 AlternativeServiceInfoVector alternative_service_info_vector;
652 base::Time now = base::Time::Now(); 672 base::Time now = base::Time::Now();
653 base::TimeDelta one_day = base::TimeDelta::FromDays(1); 673 base::TimeDelta one_day = base::TimeDelta::FromDays(1);
654 674
655 // First alternative service expired one day ago, should not be returned by 675 // First alternative service expired one day ago, should not be returned by
656 // GetAlternativeServices(). 676 // GetAlternativeServices().
657 const AlternativeService alternative_service1(NPN_SPDY_3_1, "foo", 443); 677 const AlternativeService alternative_service1(NPN_SPDY_3_1, "foo", 443);
658 alternative_service_info_vector.push_back( 678 alternative_service_info_vector.push_back(
659 AlternativeServiceInfo(alternative_service1, now - one_day)); 679 AlternativeServiceInfo(alternative_service1, now - one_day));
660 680
661 // Second alterrnative service will expire one day from now, should be 681 // Second alterrnative service will expire one day from now, should be
662 // returned by GetAlternativeSerices(). 682 // returned by GetAlternativeSerices().
663 const AlternativeService alternative_service2(NPN_HTTP_2, "bar", 1234); 683 const AlternativeService alternative_service2(NPN_HTTP_2, "bar", 1234);
664 alternative_service_info_vector.push_back( 684 alternative_service_info_vector.push_back(
665 AlternativeServiceInfo(alternative_service2, now + one_day)); 685 AlternativeServiceInfo(alternative_service2, now + one_day));
666 686
667 HostPortPair test_host_port_pair("foo", 80); 687 url::SchemeHostPort scheme_origin("http", "foo", 80);
668 impl_.SetAlternativeServices(test_host_port_pair, 688 impl_.SetAlternativeServices(scheme_origin, alternative_service_info_vector);
669 alternative_service_info_vector);
670 689
671 AlternativeServiceVector alternative_service_vector = 690 AlternativeServiceVector alternative_service_vector =
672 impl_.GetAlternativeServices(test_host_port_pair); 691 impl_.GetAlternativeServices(scheme_origin);
673 ASSERT_EQ(1u, alternative_service_vector.size()); 692 ASSERT_EQ(1u, alternative_service_vector.size());
674 EXPECT_EQ(alternative_service2, alternative_service_vector[0]); 693 EXPECT_EQ(alternative_service2, alternative_service_vector[0]);
675 } 694 }
676 695
677 TEST_F(AlternateProtocolServerPropertiesTest, MaxAgeCanonical) { 696 TEST_F(AlternateProtocolServerPropertiesTest, MaxAgeCanonical) {
678 AlternativeServiceInfoVector alternative_service_info_vector; 697 AlternativeServiceInfoVector alternative_service_info_vector;
679 base::Time now = base::Time::Now(); 698 base::Time now = base::Time::Now();
680 base::TimeDelta one_day = base::TimeDelta::FromDays(1); 699 base::TimeDelta one_day = base::TimeDelta::FromDays(1);
681 700
682 // First alternative service expired one day ago, should not be returned by 701 // First alternative service expired one day ago, should not be returned by
683 // GetAlternativeServices(). 702 // GetAlternativeServices().
684 const AlternativeService alternative_service1(NPN_SPDY_3_1, "foo", 443); 703 const AlternativeService alternative_service1(NPN_SPDY_3_1, "foo", 443);
685 alternative_service_info_vector.push_back( 704 alternative_service_info_vector.push_back(
686 AlternativeServiceInfo(alternative_service1, now - one_day)); 705 AlternativeServiceInfo(alternative_service1, now - one_day));
687 706
688 // Second alterrnative service will expire one day from now, should be 707 // Second alternative service will expire one day from now, should be
689 // returned by GetAlternativeSerices(). 708 // returned by GetAlternativeSerices().
690 const AlternativeService alternative_service2(NPN_HTTP_2, "bar", 1234); 709 const AlternativeService alternative_service2(NPN_HTTP_2, "bar", 1234);
691 alternative_service_info_vector.push_back( 710 alternative_service_info_vector.push_back(
692 AlternativeServiceInfo(alternative_service2, now + one_day)); 711 AlternativeServiceInfo(alternative_service2, now + one_day));
693 712
694 HostPortPair canonical_host_port_pair("bar.c.youtube.com", 80); 713 url::SchemeHostPort canonical_scheme_origin("https", "bar.c.youtube.com", 80);
695 impl_.SetAlternativeServices(canonical_host_port_pair, 714 impl_.SetAlternativeServices(canonical_scheme_origin,
696 alternative_service_info_vector); 715 alternative_service_info_vector);
697 716
698 HostPortPair test_host_port_pair("foo.c.youtube.com", 80); 717 url::SchemeHostPort scheme_origin("https", "foo.c.youtube.com", 80);
699 AlternativeServiceVector alternative_service_vector = 718 AlternativeServiceVector alternative_service_vector =
700 impl_.GetAlternativeServices(test_host_port_pair); 719 impl_.GetAlternativeServices(scheme_origin);
701 ASSERT_EQ(1u, alternative_service_vector.size()); 720 ASSERT_EQ(1u, alternative_service_vector.size());
702 EXPECT_EQ(alternative_service2, alternative_service_vector[0]); 721 EXPECT_EQ(alternative_service2, alternative_service_vector[0]);
703 } 722 }
704 723
724 TEST_F(AlternateProtocolServerPropertiesTest,
725 SetAlternativeServicesWithScheme) {
726 AlternativeServiceInfoVector alternative_service_info_vector;
727 const AlternativeService alternative_service1(NPN_SPDY_3_1, "foo", 443);
728 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
729 alternative_service_info_vector.push_back(
730 AlternativeServiceInfo(alternative_service1, expiration));
731 const AlternativeService alternative_service2(NPN_HTTP_2, "bar", 1234);
732 alternative_service_info_vector.push_back(
733 AlternativeServiceInfo(alternative_service2, expiration));
734 url::SchemeHostPort http_origin("http", "foo", 80);
735 url::SchemeHostPort https_origin("https", "foo", 80);
736 impl_.SetAlternativeServices(http_origin, alternative_service_info_vector);
737
738 ASSERT_EQ(2u, impl_.GetAlternativeServices(http_origin).size());
739 ASSERT_EQ(0u, impl_.GetAlternativeServices(https_origin).size());
740 }
741
705 TEST_F(AlternateProtocolServerPropertiesTest, ClearAlternativeServices) { 742 TEST_F(AlternateProtocolServerPropertiesTest, ClearAlternativeServices) {
706 AlternativeServiceInfoVector alternative_service_info_vector; 743 AlternativeServiceInfoVector alternative_service_info_vector;
707 const AlternativeService alternative_service1(NPN_SPDY_3_1, "foo", 443); 744 const AlternativeService alternative_service1(NPN_SPDY_3_1, "foo", 443);
708 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); 745 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
709 alternative_service_info_vector.push_back( 746 alternative_service_info_vector.push_back(
710 AlternativeServiceInfo(alternative_service1, expiration)); 747 AlternativeServiceInfo(alternative_service1, expiration));
711 const AlternativeService alternative_service2(NPN_HTTP_2, "bar", 1234); 748 const AlternativeService alternative_service2(NPN_HTTP_2, "bar", 1234);
712 alternative_service_info_vector.push_back( 749 alternative_service_info_vector.push_back(
713 AlternativeServiceInfo(alternative_service2, expiration)); 750 AlternativeServiceInfo(alternative_service2, expiration));
714 HostPortPair test_host_port_pair("foo", 80); 751 HostPortPair test_host_port_pair("foo", 80);
715 impl_.SetAlternativeServices(test_host_port_pair, 752 url::SchemeHostPort scheme_origin("http", "foo", 80);
716 alternative_service_info_vector); 753 impl_.SetAlternativeServices(scheme_origin, alternative_service_info_vector);
717 754
718 const net::AlternativeServiceMap& map = impl_.alternative_service_map(); 755 const net::AlternativeServiceMap& map = impl_.alternative_service_map();
719 net::AlternativeServiceMap::const_iterator it = map.begin(); 756 net::AlternativeServiceMap::const_iterator it = map.begin();
720 EXPECT_TRUE(it->first.Equals(test_host_port_pair)); 757 EXPECT_TRUE(
758 HostPortPair::FromSchemeHostPort(it->first).Equals(test_host_port_pair));
721 ASSERT_EQ(2u, it->second.size()); 759 ASSERT_EQ(2u, it->second.size());
722 EXPECT_EQ(alternative_service1, it->second[0].alternative_service); 760 EXPECT_EQ(alternative_service1, it->second[0].alternative_service);
723 EXPECT_EQ(alternative_service2, it->second[1].alternative_service); 761 EXPECT_EQ(alternative_service2, it->second[1].alternative_service);
724 762
725 impl_.ClearAlternativeServices(test_host_port_pair); 763 impl_.ClearAlternativeServices(scheme_origin);
726 EXPECT_TRUE(map.empty()); 764 EXPECT_TRUE(map.empty());
727 } 765 }
728 766
729 // A broken alternative service in the mapping carries meaningful information, 767 // A broken alternative service in the mapping carries meaningful information,
730 // therefore it should not be ignored by SetAlternativeService(). In 768 // therefore it should not be ignored by SetAlternativeService(). In
731 // particular, an alternative service mapped to an origin shadows alternative 769 // particular, an alternative service mapped to an origin shadows alternative
732 // services of canonical hosts. 770 // services of canonical hosts.
733 TEST_F(AlternateProtocolServerPropertiesTest, BrokenShadowsCanonical) { 771 TEST_F(AlternateProtocolServerPropertiesTest, BrokenShadowsCanonical) {
734 HostPortPair test_host_port_pair("foo.c.youtube.com", 80); 772 url::SchemeHostPort scheme_origin("https", "foo.c.youtube.com", 80);
735 HostPortPair canonical_host_port_pair("bar.c.youtube.com", 80); 773 url::SchemeHostPort canonical_scheme_origin("https", "bar.c.youtube.com", 80);
736 AlternativeService canonical_alternative_service(QUIC, "bar.c.youtube.com", 774 AlternativeService canonical_alternative_service(QUIC, "bar.c.youtube.com",
737 1234); 775 1234);
738 SetAlternativeService(canonical_host_port_pair, 776 SetAlternativeService(canonical_scheme_origin, canonical_alternative_service);
739 canonical_alternative_service);
740 AlternativeServiceVector alternative_service_vector = 777 AlternativeServiceVector alternative_service_vector =
741 impl_.GetAlternativeServices(test_host_port_pair); 778 impl_.GetAlternativeServices(scheme_origin);
742 ASSERT_EQ(1u, alternative_service_vector.size()); 779 ASSERT_EQ(1u, alternative_service_vector.size());
743 EXPECT_EQ(canonical_alternative_service, alternative_service_vector[0]); 780 EXPECT_EQ(canonical_alternative_service, alternative_service_vector[0]);
744 781
745 const AlternativeService broken_alternative_service(NPN_HTTP_2, "foo", 443); 782 const AlternativeService broken_alternative_service(NPN_HTTP_2, "foo", 443);
746 impl_.MarkAlternativeServiceBroken(broken_alternative_service); 783 impl_.MarkAlternativeServiceBroken(broken_alternative_service);
747 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(broken_alternative_service)); 784 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(broken_alternative_service));
748 785
749 SetAlternativeService(test_host_port_pair, broken_alternative_service); 786 SetAlternativeService(scheme_origin, broken_alternative_service);
750 alternative_service_vector = 787 alternative_service_vector = impl_.GetAlternativeServices(scheme_origin);
751 impl_.GetAlternativeServices(test_host_port_pair);
752 ASSERT_EQ(1u, alternative_service_vector.size()); 788 ASSERT_EQ(1u, alternative_service_vector.size());
753 EXPECT_EQ(broken_alternative_service, alternative_service_vector[0]); 789 EXPECT_EQ(broken_alternative_service, alternative_service_vector[0]);
754 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(broken_alternative_service)); 790 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(broken_alternative_service));
755 } 791 }
756 792
757 TEST_F(AlternateProtocolServerPropertiesTest, ClearBroken) { 793 TEST_F(AlternateProtocolServerPropertiesTest, ClearBroken) {
758 HostPortPair test_host_port_pair("foo", 80); 794 url::SchemeHostPort scheme_origin("http", "foo", 80);
759 const AlternativeService alternative_service(NPN_HTTP_2, "foo", 443); 795 const AlternativeService alternative_service(NPN_HTTP_2, "foo", 443);
760 SetAlternativeService(test_host_port_pair, alternative_service); 796 SetAlternativeService(scheme_origin, alternative_service);
761 impl_.MarkAlternativeServiceBroken(alternative_service); 797 impl_.MarkAlternativeServiceBroken(alternative_service);
762 ASSERT_TRUE(HasAlternativeService(test_host_port_pair)); 798 ASSERT_TRUE(HasAlternativeService(scheme_origin));
763 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(alternative_service)); 799 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(alternative_service));
764 // ClearAlternativeServices should leave a broken alternative service marked 800 // ClearAlternativeServices should leave a broken alternative service marked
765 // as such. 801 // as such.
766 impl_.ClearAlternativeServices(test_host_port_pair); 802 impl_.ClearAlternativeServices(scheme_origin);
767 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(alternative_service)); 803 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(alternative_service));
768 } 804 }
769 805
770 TEST_F(AlternateProtocolServerPropertiesTest, MarkRecentlyBroken) { 806 TEST_F(AlternateProtocolServerPropertiesTest, MarkRecentlyBroken) {
771 HostPortPair host_port_pair("foo", 80); 807 url::SchemeHostPort scheme_origin("http", "foo", 80);
772 const AlternativeService alternative_service(NPN_HTTP_2, "foo", 443); 808 const AlternativeService alternative_service(NPN_HTTP_2, "foo", 443);
773 SetAlternativeService(host_port_pair, alternative_service); 809 SetAlternativeService(scheme_origin, alternative_service);
774 810
775 EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service)); 811 EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service));
776 EXPECT_FALSE(impl_.WasAlternativeServiceRecentlyBroken(alternative_service)); 812 EXPECT_FALSE(impl_.WasAlternativeServiceRecentlyBroken(alternative_service));
777 813
778 impl_.MarkAlternativeServiceRecentlyBroken(alternative_service); 814 impl_.MarkAlternativeServiceRecentlyBroken(alternative_service);
779 EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service)); 815 EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service));
780 EXPECT_TRUE(impl_.WasAlternativeServiceRecentlyBroken(alternative_service)); 816 EXPECT_TRUE(impl_.WasAlternativeServiceRecentlyBroken(alternative_service));
781 817
782 impl_.ConfirmAlternativeService(alternative_service); 818 impl_.ConfirmAlternativeService(alternative_service);
783 EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service)); 819 EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service));
784 EXPECT_FALSE(impl_.WasAlternativeServiceRecentlyBroken(alternative_service)); 820 EXPECT_FALSE(impl_.WasAlternativeServiceRecentlyBroken(alternative_service));
785 } 821 }
786 822
787 TEST_F(AlternateProtocolServerPropertiesTest, Canonical) { 823 TEST_F(AlternateProtocolServerPropertiesTest, Canonical) {
788 HostPortPair test_host_port_pair("foo.c.youtube.com", 80); 824 HostPortPair test_host_port_pair("foo.c.youtube.com", 80);
789 EXPECT_FALSE(HasAlternativeService(test_host_port_pair)); 825 url::SchemeHostPort scheme_origin("https", "foo.c.youtube.com", 80);
826 EXPECT_FALSE(HasAlternativeService(scheme_origin));
790 827
791 HostPortPair canonical_host_port_pair("bar.c.youtube.com", 80); 828 HostPortPair canonical_host_port_pair("bar.c.youtube.com", 80);
792 EXPECT_FALSE(HasAlternativeService(canonical_host_port_pair)); 829 url::SchemeHostPort canonical_scheme_origin("https", "bar.c.youtube.com", 80);
830 EXPECT_FALSE(HasAlternativeService(canonical_scheme_origin));
793 831
794 AlternativeServiceInfoVector alternative_service_info_vector; 832 AlternativeServiceInfoVector alternative_service_info_vector;
795 const AlternativeService canonical_alternative_service1( 833 const AlternativeService canonical_alternative_service1(
796 QUIC, "bar.c.youtube.com", 1234); 834 QUIC, "bar.c.youtube.com", 1234);
797 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); 835 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
798 alternative_service_info_vector.push_back( 836 alternative_service_info_vector.push_back(
799 AlternativeServiceInfo(canonical_alternative_service1, expiration)); 837 AlternativeServiceInfo(canonical_alternative_service1, expiration));
800 const AlternativeService canonical_alternative_service2(NPN_HTTP_2, "", 443); 838 const AlternativeService canonical_alternative_service2(NPN_HTTP_2, "", 443);
801 alternative_service_info_vector.push_back( 839 alternative_service_info_vector.push_back(
802 AlternativeServiceInfo(canonical_alternative_service2, expiration)); 840 AlternativeServiceInfo(canonical_alternative_service2, expiration));
803 impl_.SetAlternativeServices(canonical_host_port_pair, 841 impl_.SetAlternativeServices(canonical_scheme_origin,
804 alternative_service_info_vector); 842 alternative_service_info_vector);
805 843
806 // Since |test_host_port_pair| does not have an alternative service itself, 844 // Since |test_host_port_pair| does not have an alternative service itself,
807 // GetAlternativeServices should return those of |canonical_host_port_pair|. 845 // GetAlternativeServices should return those of |canonical_host_port_pair|.
808 AlternativeServiceVector alternative_service_vector = 846 AlternativeServiceVector alternative_service_vector =
809 impl_.GetAlternativeServices(test_host_port_pair); 847 impl_.GetAlternativeServices(scheme_origin);
810 ASSERT_EQ(2u, alternative_service_vector.size()); 848 ASSERT_EQ(2u, alternative_service_vector.size());
811 EXPECT_EQ(canonical_alternative_service1, alternative_service_vector[0]); 849 EXPECT_EQ(canonical_alternative_service1, alternative_service_vector[0]);
812 850
813 // Since |canonical_alternative_service2| has an empty host, 851 // Since |canonical_alternative_service2| has an empty host,
814 // GetAlternativeServices should substitute the hostname of its |origin| 852 // GetAlternativeServices should substitute the hostname of its |origin|
815 // argument. 853 // argument.
816 EXPECT_EQ(test_host_port_pair.host(), alternative_service_vector[1].host); 854 EXPECT_EQ(test_host_port_pair.host(), alternative_service_vector[1].host);
817 EXPECT_EQ(canonical_alternative_service2.protocol, 855 EXPECT_EQ(canonical_alternative_service2.protocol,
818 alternative_service_vector[1].protocol); 856 alternative_service_vector[1].protocol);
819 EXPECT_EQ(canonical_alternative_service2.port, 857 EXPECT_EQ(canonical_alternative_service2.port,
820 alternative_service_vector[1].port); 858 alternative_service_vector[1].port);
821 859
822 // Verify the canonical suffix. 860 // Verify the canonical suffix.
823 EXPECT_EQ(".c.youtube.com", 861 EXPECT_EQ(".c.youtube.com",
824 impl_.GetCanonicalSuffix(test_host_port_pair.host())); 862 impl_.GetCanonicalSuffix(test_host_port_pair.host()));
825 EXPECT_EQ(".c.youtube.com", 863 EXPECT_EQ(".c.youtube.com",
826 impl_.GetCanonicalSuffix(canonical_host_port_pair.host())); 864 impl_.GetCanonicalSuffix(canonical_host_port_pair.host()));
827 } 865 }
828 866
867 TEST_F(AlternateProtocolServerPropertiesTest, NoCanonicalMappingForHttpOrigin) {
868 url::SchemeHostPort scheme_origin("http", "foo.c.youtube.com", 80);
869 url::SchemeHostPort canonical_scheme_origin("https", "bar.c.youtube.com", 80);
870 AlternativeService canonical_alternative_service(QUIC, "bar.c.youtube.com",
871 1234);
872 // Set alternative service for canonical_scheme_origin.
873 SetAlternativeService(canonical_scheme_origin, canonical_alternative_service);
874 EXPECT_TRUE(HasAlternativeService(canonical_scheme_origin));
875 EXPECT_FALSE(HasAlternativeService(scheme_origin));
876 }
877
878 TEST_F(AlternateProtocolServerPropertiesTest, CanonicalMappingForHttpsOrigin) {
879 url::SchemeHostPort scheme_origin("https", "foo.c.youtube.com", 80);
880 url::SchemeHostPort canonical_scheme_origin("https", "bar.c.youtube.com", 80);
881 AlternativeService canonical_alternative_service(QUIC, "bar.c.youtube.com",
882 1234);
883 // Set alternative service for canonical_scheme_origin.
884 SetAlternativeService(canonical_scheme_origin, canonical_alternative_service);
885 EXPECT_TRUE(HasAlternativeService(canonical_scheme_origin));
886 EXPECT_TRUE(HasAlternativeService(scheme_origin));
887 }
888
829 TEST_F(AlternateProtocolServerPropertiesTest, ClearCanonical) { 889 TEST_F(AlternateProtocolServerPropertiesTest, ClearCanonical) {
830 HostPortPair test_host_port_pair("foo.c.youtube.com", 80); 890 url::SchemeHostPort scheme_origin("https", "foo.c.youtube.com", 80);
831 HostPortPair canonical_host_port_pair("bar.c.youtube.com", 80); 891 url::SchemeHostPort canonical_scheme_origin("https", "bar.c.youtube.com", 80);
832 AlternativeService canonical_alternative_service(QUIC, "bar.c.youtube.com", 892 AlternativeService canonical_alternative_service(QUIC, "bar.c.youtube.com",
833 1234); 893 1234);
834 894
835 SetAlternativeService(canonical_host_port_pair, 895 SetAlternativeService(canonical_scheme_origin, canonical_alternative_service);
836 canonical_alternative_service); 896 impl_.ClearAlternativeServices(canonical_scheme_origin);
837 impl_.ClearAlternativeServices(canonical_host_port_pair); 897 EXPECT_FALSE(HasAlternativeService(scheme_origin));
838 EXPECT_FALSE(HasAlternativeService(test_host_port_pair));
839 } 898 }
840 899
841 TEST_F(AlternateProtocolServerPropertiesTest, CanonicalBroken) { 900 TEST_F(AlternateProtocolServerPropertiesTest, CanonicalBroken) {
842 HostPortPair test_host_port_pair("foo.c.youtube.com", 80); 901 url::SchemeHostPort scheme_origin("https", "foo.c.youtube.com", 80);
843 HostPortPair canonical_host_port_pair("bar.c.youtube.com", 80); 902 url::SchemeHostPort canonical_scheme_origin("https", "bar.c.youtube.com", 80);
844 AlternativeService canonical_alternative_service(QUIC, "bar.c.youtube.com", 903 AlternativeService canonical_alternative_service(QUIC, "bar.c.youtube.com",
845 1234); 904 1234);
846 905
847 SetAlternativeService(canonical_host_port_pair, 906 SetAlternativeService(canonical_scheme_origin, canonical_alternative_service);
848 canonical_alternative_service);
849 impl_.MarkAlternativeServiceBroken(canonical_alternative_service); 907 impl_.MarkAlternativeServiceBroken(canonical_alternative_service);
850 EXPECT_FALSE(HasAlternativeService(test_host_port_pair)); 908 EXPECT_FALSE(HasAlternativeService(scheme_origin));
851 } 909 }
852 910
853 // Adding an alternative service for a new host overrides canonical host. 911 // Adding an alternative service for a new host overrides canonical host.
854 TEST_F(AlternateProtocolServerPropertiesTest, CanonicalOverride) { 912 TEST_F(AlternateProtocolServerPropertiesTest, CanonicalOverride) {
855 HostPortPair test_host_port_pair("foo.c.youtube.com", 80); 913 url::SchemeHostPort scheme_origin("https", "foo.c.youtube.com", 80);
856 HostPortPair bar_host_port_pair("bar.c.youtube.com", 80); 914 url::SchemeHostPort bar_scheme_origin("https", "bar.c.youtube.com", 80);
857 AlternativeService bar_alternative_service(QUIC, "bar.c.youtube.com", 1234); 915 AlternativeService bar_alternative_service(QUIC, "bar.c.youtube.com", 1234);
858 SetAlternativeService(bar_host_port_pair, bar_alternative_service); 916 SetAlternativeService(bar_scheme_origin, bar_alternative_service);
859 AlternativeServiceVector alternative_service_vector = 917 AlternativeServiceVector alternative_service_vector =
860 impl_.GetAlternativeServices(test_host_port_pair); 918 impl_.GetAlternativeServices(scheme_origin);
861 ASSERT_EQ(1u, alternative_service_vector.size()); 919 ASSERT_EQ(1u, alternative_service_vector.size());
862 EXPECT_EQ(bar_alternative_service, alternative_service_vector[0]); 920 EXPECT_EQ(bar_alternative_service, alternative_service_vector[0]);
863 921
864 HostPortPair qux_host_port_pair("qux.c.youtube.com", 80); 922 url::SchemeHostPort qux_scheme_origin_pair("https", "qux.c.youtube.com", 80);
865 AlternativeService qux_alternative_service(QUIC, "qux.c.youtube.com", 443); 923 AlternativeService qux_alternative_service(QUIC, "qux.c.youtube.com", 443);
866 SetAlternativeService(qux_host_port_pair, qux_alternative_service); 924 SetAlternativeService(qux_scheme_origin_pair, qux_alternative_service);
867 alternative_service_vector = 925 alternative_service_vector = impl_.GetAlternativeServices(scheme_origin);
868 impl_.GetAlternativeServices(test_host_port_pair);
869 ASSERT_EQ(1u, alternative_service_vector.size()); 926 ASSERT_EQ(1u, alternative_service_vector.size());
870 EXPECT_EQ(qux_alternative_service, alternative_service_vector[0]); 927 EXPECT_EQ(qux_alternative_service, alternative_service_vector[0]);
871 } 928 }
872 929
873 TEST_F(AlternateProtocolServerPropertiesTest, ClearWithCanonical) { 930 TEST_F(AlternateProtocolServerPropertiesTest, ClearWithCanonical) {
874 HostPortPair test_host_port_pair("foo.c.youtube.com", 80); 931 url::SchemeHostPort scheme_origin("https", "foo.c.youtube.com", 80);
875 HostPortPair canonical_host_port_pair("bar.c.youtube.com", 80); 932 url::SchemeHostPort canonical_scheme_origin("https", "bar.c.youtube.com", 80);
876 AlternativeService canonical_alternative_service(QUIC, "bar.c.youtube.com", 933 AlternativeService canonical_alternative_service(QUIC, "bar.c.youtube.com",
877 1234); 934 1234);
878 935
879 SetAlternativeService(canonical_host_port_pair, 936 SetAlternativeService(canonical_scheme_origin, canonical_alternative_service);
880 canonical_alternative_service);
881 impl_.Clear(); 937 impl_.Clear();
882 EXPECT_FALSE(HasAlternativeService(test_host_port_pair)); 938 EXPECT_FALSE(HasAlternativeService(scheme_origin));
883 } 939 }
884 940
885 TEST_F(AlternateProtocolServerPropertiesTest, 941 TEST_F(AlternateProtocolServerPropertiesTest,
886 ExpireBrokenAlternateProtocolMappings) { 942 ExpireBrokenAlternateProtocolMappings) {
887 HostPortPair host_port_pair("foo", 443); 943 url::SchemeHostPort scheme_origin("https", "foo", 443);
888 AlternativeService alternative_service(QUIC, "foo", 443); 944 AlternativeService alternative_service(QUIC, "foo", 443);
889 SetAlternativeService(host_port_pair, alternative_service); 945 SetAlternativeService(scheme_origin, alternative_service);
890 EXPECT_TRUE(HasAlternativeService(host_port_pair)); 946 EXPECT_TRUE(HasAlternativeService(scheme_origin));
891 EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service)); 947 EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service));
892 EXPECT_FALSE(impl_.WasAlternativeServiceRecentlyBroken(alternative_service)); 948 EXPECT_FALSE(impl_.WasAlternativeServiceRecentlyBroken(alternative_service));
893 949
894 base::TimeTicks past = 950 base::TimeTicks past =
895 base::TimeTicks::Now() - base::TimeDelta::FromSeconds(42); 951 base::TimeTicks::Now() - base::TimeDelta::FromSeconds(42);
896 HttpServerPropertiesImplPeer::AddBrokenAlternativeServiceWithExpirationTime( 952 HttpServerPropertiesImplPeer::AddBrokenAlternativeServiceWithExpirationTime(
897 impl_, alternative_service, past); 953 impl_, alternative_service, past);
898 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(alternative_service)); 954 EXPECT_TRUE(impl_.IsAlternativeServiceBroken(alternative_service));
899 EXPECT_TRUE(impl_.WasAlternativeServiceRecentlyBroken(alternative_service)); 955 EXPECT_TRUE(impl_.WasAlternativeServiceRecentlyBroken(alternative_service));
900 956
901 HttpServerPropertiesImplPeer::ExpireBrokenAlternateProtocolMappings(impl_); 957 HttpServerPropertiesImplPeer::ExpireBrokenAlternateProtocolMappings(impl_);
902 EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service)); 958 EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service));
903 EXPECT_TRUE(impl_.WasAlternativeServiceRecentlyBroken(alternative_service)); 959 EXPECT_TRUE(impl_.WasAlternativeServiceRecentlyBroken(alternative_service));
904 } 960 }
905 961
906 // Regression test for https://crbug.com/505413. 962 // Regression test for https://crbug.com/505413.
907 TEST_F(AlternateProtocolServerPropertiesTest, RemoveExpiredBrokenAltSvc) { 963 TEST_F(AlternateProtocolServerPropertiesTest, RemoveExpiredBrokenAltSvc) {
908 HostPortPair foo_host_port_pair("foo", 443); 964 url::SchemeHostPort foo_scheme_origin("https", "foo", 443);
909 AlternativeService bar_alternative_service(QUIC, "bar", 443); 965 AlternativeService bar_alternative_service(QUIC, "bar", 443);
910 SetAlternativeService(foo_host_port_pair, bar_alternative_service); 966 SetAlternativeService(foo_scheme_origin, bar_alternative_service);
911 EXPECT_TRUE(HasAlternativeService(foo_host_port_pair)); 967 EXPECT_TRUE(HasAlternativeService(foo_scheme_origin));
912 968
913 HostPortPair bar_host_port_pair1("bar", 80); 969 url::SchemeHostPort bar_scheme_origin1("http", "bar", 80);
914 AlternativeService nohost_alternative_service(QUIC, "", 443); 970 AlternativeService nohost_alternative_service(QUIC, "", 443);
915 SetAlternativeService(bar_host_port_pair1, nohost_alternative_service); 971 SetAlternativeService(bar_scheme_origin1, nohost_alternative_service);
916 EXPECT_TRUE(HasAlternativeService(bar_host_port_pair1)); 972 EXPECT_TRUE(HasAlternativeService(bar_scheme_origin1));
917 973
918 HostPortPair bar_host_port_pair2("bar", 443); 974 url::SchemeHostPort bar_scheme_origin2("https", "bar", 443);
919 AlternativeService baz_alternative_service(QUIC, "baz", 1234); 975 AlternativeService baz_alternative_service(QUIC, "baz", 1234);
920 SetAlternativeService(bar_host_port_pair2, baz_alternative_service); 976 SetAlternativeService(bar_scheme_origin2, baz_alternative_service);
921 EXPECT_TRUE(HasAlternativeService(bar_host_port_pair2)); 977 EXPECT_TRUE(HasAlternativeService(bar_scheme_origin2));
922 978
923 // Mark "bar:443" as broken. 979 // Mark "bar:443" as broken.
924 base::TimeTicks past = 980 base::TimeTicks past =
925 base::TimeTicks::Now() - base::TimeDelta::FromSeconds(42); 981 base::TimeTicks::Now() - base::TimeDelta::FromSeconds(42);
926 HttpServerPropertiesImplPeer::AddBrokenAlternativeServiceWithExpirationTime( 982 HttpServerPropertiesImplPeer::AddBrokenAlternativeServiceWithExpirationTime(
927 impl_, bar_alternative_service, past); 983 impl_, bar_alternative_service, past);
928 984
929 // Expire brokenness of "bar:443". 985 // Expire brokenness of "bar:443".
930 HttpServerPropertiesImplPeer::ExpireBrokenAlternateProtocolMappings(impl_); 986 HttpServerPropertiesImplPeer::ExpireBrokenAlternateProtocolMappings(impl_);
931 987
932 // "foo:443" should have no alternative service now. 988 // "foo:443" should have no alternative service now.
933 EXPECT_FALSE(HasAlternativeService(foo_host_port_pair)); 989 EXPECT_FALSE(HasAlternativeService(foo_scheme_origin));
934 // "bar:80" should have no alternative service now. 990 // "bar:80" should have no alternative service now.
935 EXPECT_FALSE(HasAlternativeService(bar_host_port_pair1)); 991 EXPECT_FALSE(HasAlternativeService(bar_scheme_origin1));
936 // The alternative service of "bar:443" should be unaffected. 992 // The alternative service of "bar:443" should be unaffected.
937 EXPECT_TRUE(HasAlternativeService(bar_host_port_pair2)); 993 EXPECT_TRUE(HasAlternativeService(bar_scheme_origin2));
938 994
939 EXPECT_TRUE( 995 EXPECT_TRUE(
940 impl_.WasAlternativeServiceRecentlyBroken(bar_alternative_service)); 996 impl_.WasAlternativeServiceRecentlyBroken(bar_alternative_service));
941 EXPECT_FALSE( 997 EXPECT_FALSE(
942 impl_.WasAlternativeServiceRecentlyBroken(baz_alternative_service)); 998 impl_.WasAlternativeServiceRecentlyBroken(baz_alternative_service));
943 } 999 }
944 1000
945 typedef HttpServerPropertiesImplTest SpdySettingsServerPropertiesTest; 1001 typedef HttpServerPropertiesImplTest SpdySettingsServerPropertiesTest;
946 1002
947 TEST_F(SpdySettingsServerPropertiesTest, Initialize) { 1003 TEST_F(SpdySettingsServerPropertiesTest, Initialize) {
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 EXPECT_EQ(quic_server_info1, *(impl_.GetQuicServerInfo(quic_server_id))); 1449 EXPECT_EQ(quic_server_info1, *(impl_.GetQuicServerInfo(quic_server_id)));
1394 1450
1395 impl_.Clear(); 1451 impl_.Clear();
1396 EXPECT_EQ(0u, impl_.quic_server_info_map().size()); 1452 EXPECT_EQ(0u, impl_.quic_server_info_map().size());
1397 EXPECT_EQ(nullptr, impl_.GetQuicServerInfo(quic_server_id)); 1453 EXPECT_EQ(nullptr, impl_.GetQuicServerInfo(quic_server_id));
1398 } 1454 }
1399 1455
1400 } // namespace 1456 } // namespace
1401 1457
1402 } // namespace net 1458 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_server_properties_impl.cc ('k') | net/http/http_server_properties_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698