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

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

Issue 1818393003: QUIC - Persist "Hash of the CHLO message" and "Signed timestamp of the (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Default chlo_hash to empty string for old disk cache data Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/quic/crypto/properties_based_quic_server_info_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 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/http/disk_cache_based_quic_server_info.h" 5 #include "net/http/disk_cache_based_quic_server_info.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 scoped_ptr<QuicServerInfo> quic_server_info( 109 scoped_ptr<QuicServerInfo> quic_server_info(
110 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); 110 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache()));
111 quic_server_info->Start(); 111 quic_server_info->Start();
112 int rv = quic_server_info->WaitForDataReady(callback.callback()); 112 int rv = quic_server_info->WaitForDataReady(callback.callback());
113 EXPECT_EQ(OK, callback.GetResult(rv)); 113 EXPECT_EQ(OK, callback.GetResult(rv));
114 114
115 QuicServerInfo::State* state = quic_server_info->mutable_state(); 115 QuicServerInfo::State* state = quic_server_info->mutable_state();
116 EXPECT_TRUE(state->certs.empty()); 116 EXPECT_TRUE(state->certs.empty());
117 const string server_config_a = "server_config_a"; 117 const string server_config_a = "server_config_a";
118 const string source_address_token_a = "source_address_token_a"; 118 const string source_address_token_a = "source_address_token_a";
119 const string cert_sct_a = "cert_sct_a";
120 const string chlo_hash_a = "chlo_hash_a";
119 const string server_config_sig_a = "server_config_sig_a"; 121 const string server_config_sig_a = "server_config_sig_a";
120 const string cert_a = "cert_a"; 122 const string cert_a = "cert_a";
121 const string cert_b = "cert_b"; 123 const string cert_b = "cert_b";
122 124
123 state->server_config = server_config_a; 125 state->server_config = server_config_a;
124 state->source_address_token = source_address_token_a; 126 state->source_address_token = source_address_token_a;
127 state->cert_sct = cert_sct_a;
128 state->chlo_hash = chlo_hash_a;
125 state->server_config_sig = server_config_sig_a; 129 state->server_config_sig = server_config_sig_a;
126 state->certs.push_back(cert_a); 130 state->certs.push_back(cert_a);
127 quic_server_info->Persist(); 131 quic_server_info->Persist();
128 132
129 // Wait until Persist() does the work. 133 // Wait until Persist() does the work.
130 base::MessageLoop::current()->RunUntilIdle(); 134 base::MessageLoop::current()->RunUntilIdle();
131 135
132 // Open the stored QuicServerInfo. 136 // Open the stored QuicServerInfo.
133 quic_server_info.reset( 137 quic_server_info.reset(
134 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); 138 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache()));
(...skipping 14 matching lines...) Expand all
149 quic_server_info.reset( 153 quic_server_info.reset(
150 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); 154 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache()));
151 quic_server_info->Start(); 155 quic_server_info->Start();
152 rv = quic_server_info->WaitForDataReady(callback.callback()); 156 rv = quic_server_info->WaitForDataReady(callback.callback());
153 EXPECT_EQ(OK, callback.GetResult(rv)); 157 EXPECT_EQ(OK, callback.GetResult(rv));
154 EXPECT_TRUE(quic_server_info->IsDataReady()); 158 EXPECT_TRUE(quic_server_info->IsDataReady());
155 159
156 const QuicServerInfo::State& state1 = quic_server_info->state(); 160 const QuicServerInfo::State& state1 = quic_server_info->state();
157 EXPECT_EQ(server_config_a, state1.server_config); 161 EXPECT_EQ(server_config_a, state1.server_config);
158 EXPECT_EQ(source_address_token_a, state1.source_address_token); 162 EXPECT_EQ(source_address_token_a, state1.source_address_token);
163 EXPECT_EQ(cert_sct_a, state1.cert_sct);
164 EXPECT_EQ(chlo_hash_a, state1.chlo_hash);
159 EXPECT_EQ(server_config_sig_a, state1.server_config_sig); 165 EXPECT_EQ(server_config_sig_a, state1.server_config_sig);
160 EXPECT_EQ(2U, state1.certs.size()); 166 EXPECT_EQ(2U, state1.certs.size());
161 EXPECT_EQ(cert_a, state1.certs[0]); 167 EXPECT_EQ(cert_a, state1.certs[0]);
162 EXPECT_EQ(cert_b, state1.certs[1]); 168 EXPECT_EQ(cert_b, state1.certs[1]);
163 169
164 RemoveMockTransaction(&kHostInfoTransaction1); 170 RemoveMockTransaction(&kHostInfoTransaction1);
165 } 171 }
166 172
167 // Test that demonstrates different info is returned when the ports differ. 173 // Test that demonstrates different info is returned when the ports differ.
168 TEST(DiskCacheBasedQuicServerInfo, UpdateDifferentPorts) { 174 TEST(DiskCacheBasedQuicServerInfo, UpdateDifferentPorts) {
169 MockHttpCache cache; 175 MockHttpCache cache;
170 AddMockTransaction(&kHostInfoTransaction1); 176 AddMockTransaction(&kHostInfoTransaction1);
171 AddMockTransaction(&kHostInfoTransaction2); 177 AddMockTransaction(&kHostInfoTransaction2);
172 TestCompletionCallback callback; 178 TestCompletionCallback callback;
173 179
174 // Persist data for port 443. 180 // Persist data for port 443.
175 QuicServerId server_id1("www.google.com", 443, PRIVACY_MODE_DISABLED); 181 QuicServerId server_id1("www.google.com", 443, PRIVACY_MODE_DISABLED);
176 scoped_ptr<QuicServerInfo> quic_server_info1( 182 scoped_ptr<QuicServerInfo> quic_server_info1(
177 new DiskCacheBasedQuicServerInfo(server_id1, cache.http_cache())); 183 new DiskCacheBasedQuicServerInfo(server_id1, cache.http_cache()));
178 quic_server_info1->Start(); 184 quic_server_info1->Start();
179 int rv = quic_server_info1->WaitForDataReady(callback.callback()); 185 int rv = quic_server_info1->WaitForDataReady(callback.callback());
180 EXPECT_EQ(OK, callback.GetResult(rv)); 186 EXPECT_EQ(OK, callback.GetResult(rv));
181 187
182 QuicServerInfo::State* state1 = quic_server_info1->mutable_state(); 188 QuicServerInfo::State* state1 = quic_server_info1->mutable_state();
183 EXPECT_TRUE(state1->certs.empty()); 189 EXPECT_TRUE(state1->certs.empty());
184 const string server_config_a = "server_config_a"; 190 const string server_config_a = "server_config_a";
185 const string source_address_token_a = "source_address_token_a"; 191 const string source_address_token_a = "source_address_token_a";
192 const string cert_sct_a = "cert_sct_a";
193 const string chlo_hash_a = "chlo_hash_a";
186 const string server_config_sig_a = "server_config_sig_a"; 194 const string server_config_sig_a = "server_config_sig_a";
187 const string cert_a = "cert_a"; 195 const string cert_a = "cert_a";
188 196
189 state1->server_config = server_config_a; 197 state1->server_config = server_config_a;
190 state1->source_address_token = source_address_token_a; 198 state1->source_address_token = source_address_token_a;
199 state1->cert_sct = cert_sct_a;
200 state1->chlo_hash = chlo_hash_a;
191 state1->server_config_sig = server_config_sig_a; 201 state1->server_config_sig = server_config_sig_a;
192 state1->certs.push_back(cert_a); 202 state1->certs.push_back(cert_a);
193 quic_server_info1->Persist(); 203 quic_server_info1->Persist();
194 204
195 // Wait until Persist() does the work. 205 // Wait until Persist() does the work.
196 base::MessageLoop::current()->RunUntilIdle(); 206 base::MessageLoop::current()->RunUntilIdle();
197 207
198 // Persist data for port 80. 208 // Persist data for port 80.
199 QuicServerId server_id2("www.google.com", 80, PRIVACY_MODE_DISABLED); 209 QuicServerId server_id2("www.google.com", 80, PRIVACY_MODE_DISABLED);
200 scoped_ptr<QuicServerInfo> quic_server_info2( 210 scoped_ptr<QuicServerInfo> quic_server_info2(
201 new DiskCacheBasedQuicServerInfo(server_id2, cache.http_cache())); 211 new DiskCacheBasedQuicServerInfo(server_id2, cache.http_cache()));
202 quic_server_info2->Start(); 212 quic_server_info2->Start();
203 rv = quic_server_info2->WaitForDataReady(callback.callback()); 213 rv = quic_server_info2->WaitForDataReady(callback.callback());
204 EXPECT_EQ(OK, callback.GetResult(rv)); 214 EXPECT_EQ(OK, callback.GetResult(rv));
205 215
206 QuicServerInfo::State* state2 = quic_server_info2->mutable_state(); 216 QuicServerInfo::State* state2 = quic_server_info2->mutable_state();
207 EXPECT_TRUE(state2->certs.empty()); 217 EXPECT_TRUE(state2->certs.empty());
208 const string server_config_b = "server_config_b"; 218 const string server_config_b = "server_config_b";
209 const string source_address_token_b = "source_address_token_b"; 219 const string source_address_token_b = "source_address_token_b";
220 const string cert_sct_b = "cert_sct_b";
221 const string chlo_hash_b = "chlo_hash_b";
210 const string server_config_sig_b = "server_config_sig_b"; 222 const string server_config_sig_b = "server_config_sig_b";
211 const string cert_b = "cert_b"; 223 const string cert_b = "cert_b";
212 224
213 state2->server_config = server_config_b; 225 state2->server_config = server_config_b;
214 state2->source_address_token = source_address_token_b; 226 state2->source_address_token = source_address_token_b;
227 state2->cert_sct = cert_sct_b;
228 state2->chlo_hash = chlo_hash_b;
215 state2->server_config_sig = server_config_sig_b; 229 state2->server_config_sig = server_config_sig_b;
216 state2->certs.push_back(cert_b); 230 state2->certs.push_back(cert_b);
217 quic_server_info2->Persist(); 231 quic_server_info2->Persist();
218 232
219 // Wait until Persist() does the work. 233 // Wait until Persist() does the work.
220 base::MessageLoop::current()->RunUntilIdle(); 234 base::MessageLoop::current()->RunUntilIdle();
221 235
222 // Verify the stored QuicServerInfo for port 443. 236 // Verify the stored QuicServerInfo for port 443.
223 scoped_ptr<QuicServerInfo> quic_server_info( 237 scoped_ptr<QuicServerInfo> quic_server_info(
224 new DiskCacheBasedQuicServerInfo(server_id1, cache.http_cache())); 238 new DiskCacheBasedQuicServerInfo(server_id1, cache.http_cache()));
225 quic_server_info->Start(); 239 quic_server_info->Start();
226 rv = quic_server_info->WaitForDataReady(callback.callback()); 240 rv = quic_server_info->WaitForDataReady(callback.callback());
227 EXPECT_EQ(OK, callback.GetResult(rv)); 241 EXPECT_EQ(OK, callback.GetResult(rv));
228 EXPECT_TRUE(quic_server_info->IsDataReady()); 242 EXPECT_TRUE(quic_server_info->IsDataReady());
229 243
230 const QuicServerInfo::State& state_a = quic_server_info->state(); 244 const QuicServerInfo::State& state_a = quic_server_info->state();
231 EXPECT_EQ(server_config_a, state_a.server_config); 245 EXPECT_EQ(server_config_a, state_a.server_config);
232 EXPECT_EQ(source_address_token_a, state_a.source_address_token); 246 EXPECT_EQ(source_address_token_a, state_a.source_address_token);
247 EXPECT_EQ(cert_sct_a, state_a.cert_sct);
248 EXPECT_EQ(chlo_hash_a, state_a.chlo_hash);
233 EXPECT_EQ(server_config_sig_a, state_a.server_config_sig); 249 EXPECT_EQ(server_config_sig_a, state_a.server_config_sig);
234 EXPECT_EQ(1U, state_a.certs.size()); 250 EXPECT_EQ(1U, state_a.certs.size());
235 EXPECT_EQ(cert_a, state_a.certs[0]); 251 EXPECT_EQ(cert_a, state_a.certs[0]);
236 252
237 // Verify the stored QuicServerInfo for port 80. 253 // Verify the stored QuicServerInfo for port 80.
238 quic_server_info.reset( 254 quic_server_info.reset(
239 new DiskCacheBasedQuicServerInfo(server_id2, cache.http_cache())); 255 new DiskCacheBasedQuicServerInfo(server_id2, cache.http_cache()));
240 quic_server_info->Start(); 256 quic_server_info->Start();
241 rv = quic_server_info->WaitForDataReady(callback.callback()); 257 rv = quic_server_info->WaitForDataReady(callback.callback());
242 EXPECT_EQ(OK, callback.GetResult(rv)); 258 EXPECT_EQ(OK, callback.GetResult(rv));
243 EXPECT_TRUE(quic_server_info->IsDataReady()); 259 EXPECT_TRUE(quic_server_info->IsDataReady());
244 260
245 const QuicServerInfo::State& state_b = quic_server_info->state(); 261 const QuicServerInfo::State& state_b = quic_server_info->state();
246 EXPECT_EQ(server_config_b, state_b.server_config); 262 EXPECT_EQ(server_config_b, state_b.server_config);
247 EXPECT_EQ(source_address_token_b, state_b.source_address_token); 263 EXPECT_EQ(source_address_token_b, state_b.source_address_token);
264 EXPECT_EQ(cert_sct_b, state_b.cert_sct);
265 EXPECT_EQ(chlo_hash_b, state_b.chlo_hash);
248 EXPECT_EQ(server_config_sig_b, state_b.server_config_sig); 266 EXPECT_EQ(server_config_sig_b, state_b.server_config_sig);
249 EXPECT_EQ(1U, state_b.certs.size()); 267 EXPECT_EQ(1U, state_b.certs.size());
250 EXPECT_EQ(cert_b, state_b.certs[0]); 268 EXPECT_EQ(cert_b, state_b.certs[0]);
251 269
252 RemoveMockTransaction(&kHostInfoTransaction2); 270 RemoveMockTransaction(&kHostInfoTransaction2);
253 RemoveMockTransaction(&kHostInfoTransaction1); 271 RemoveMockTransaction(&kHostInfoTransaction1);
254 } 272 }
255 273
256 // Test IsReadyToPersist when there is a pending write. 274 // Test IsReadyToPersist when there is a pending write.
257 TEST(DiskCacheBasedQuicServerInfo, IsReadyToPersist) { 275 TEST(DiskCacheBasedQuicServerInfo, IsReadyToPersist) {
258 MockHttpCache cache; 276 MockHttpCache cache;
259 AddMockTransaction(&kHostInfoTransaction1); 277 AddMockTransaction(&kHostInfoTransaction1);
260 TestCompletionCallback callback; 278 TestCompletionCallback callback;
261 279
262 QuicServerId server_id("www.google.com", 443, PRIVACY_MODE_DISABLED); 280 QuicServerId server_id("www.google.com", 443, PRIVACY_MODE_DISABLED);
263 scoped_ptr<QuicServerInfo> quic_server_info( 281 scoped_ptr<QuicServerInfo> quic_server_info(
264 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); 282 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache()));
265 EXPECT_FALSE(quic_server_info->IsDataReady()); 283 EXPECT_FALSE(quic_server_info->IsDataReady());
266 quic_server_info->Start(); 284 quic_server_info->Start();
267 int rv = quic_server_info->WaitForDataReady(callback.callback()); 285 int rv = quic_server_info->WaitForDataReady(callback.callback());
268 EXPECT_EQ(OK, callback.GetResult(rv)); 286 EXPECT_EQ(OK, callback.GetResult(rv));
269 EXPECT_TRUE(quic_server_info->IsDataReady()); 287 EXPECT_TRUE(quic_server_info->IsDataReady());
270 288
271 QuicServerInfo::State* state = quic_server_info->mutable_state(); 289 QuicServerInfo::State* state = quic_server_info->mutable_state();
272 EXPECT_TRUE(state->certs.empty()); 290 EXPECT_TRUE(state->certs.empty());
273 const string server_config_a = "server_config_a"; 291 const string server_config_a = "server_config_a";
274 const string source_address_token_a = "source_address_token_a"; 292 const string source_address_token_a = "source_address_token_a";
293 const string cert_sct_a = "cert_sct_a";
294 const string chlo_hash_a = "chlo_hash_a";
275 const string server_config_sig_a = "server_config_sig_a"; 295 const string server_config_sig_a = "server_config_sig_a";
276 const string cert_a = "cert_a"; 296 const string cert_a = "cert_a";
277 297
278 state->server_config = server_config_a; 298 state->server_config = server_config_a;
279 state->source_address_token = source_address_token_a; 299 state->source_address_token = source_address_token_a;
300 state->cert_sct = cert_sct_a;
301 state->chlo_hash = chlo_hash_a;
280 state->server_config_sig = server_config_sig_a; 302 state->server_config_sig = server_config_sig_a;
281 state->certs.push_back(cert_a); 303 state->certs.push_back(cert_a);
282 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); 304 EXPECT_TRUE(quic_server_info->IsReadyToPersist());
283 quic_server_info->Persist(); 305 quic_server_info->Persist();
284 306
285 // Once we call Persist, IsReadyToPersist should return false until Persist 307 // Once we call Persist, IsReadyToPersist should return false until Persist
286 // has completed. 308 // has completed.
287 EXPECT_FALSE(quic_server_info->IsReadyToPersist()); 309 EXPECT_FALSE(quic_server_info->IsReadyToPersist());
288 310
289 // Wait until Persist() does the work. 311 // Wait until Persist() does the work.
290 base::MessageLoop::current()->RunUntilIdle(); 312 base::MessageLoop::current()->RunUntilIdle();
291 313
292 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); 314 EXPECT_TRUE(quic_server_info->IsReadyToPersist());
293 315
294 // Verify that the state was updated. 316 // Verify that the state was updated.
295 quic_server_info.reset( 317 quic_server_info.reset(
296 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); 318 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache()));
297 quic_server_info->Start(); 319 quic_server_info->Start();
298 rv = quic_server_info->WaitForDataReady(callback.callback()); 320 rv = quic_server_info->WaitForDataReady(callback.callback());
299 EXPECT_EQ(OK, callback.GetResult(rv)); 321 EXPECT_EQ(OK, callback.GetResult(rv));
300 EXPECT_TRUE(quic_server_info->IsDataReady()); 322 EXPECT_TRUE(quic_server_info->IsDataReady());
301 323
302 const QuicServerInfo::State& state1 = quic_server_info->state(); 324 const QuicServerInfo::State& state1 = quic_server_info->state();
303 EXPECT_EQ(server_config_a, state1.server_config); 325 EXPECT_EQ(server_config_a, state1.server_config);
304 EXPECT_EQ(source_address_token_a, state1.source_address_token); 326 EXPECT_EQ(source_address_token_a, state1.source_address_token);
327 EXPECT_EQ(cert_sct_a, state1.cert_sct);
328 EXPECT_EQ(chlo_hash_a, state1.chlo_hash);
305 EXPECT_EQ(server_config_sig_a, state1.server_config_sig); 329 EXPECT_EQ(server_config_sig_a, state1.server_config_sig);
306 EXPECT_EQ(1U, state1.certs.size()); 330 EXPECT_EQ(1U, state1.certs.size());
307 EXPECT_EQ(cert_a, state1.certs[0]); 331 EXPECT_EQ(cert_a, state1.certs[0]);
308 332
309 RemoveMockTransaction(&kHostInfoTransaction1); 333 RemoveMockTransaction(&kHostInfoTransaction1);
310 } 334 }
311 335
312 // Test multiple calls to Persist. 336 // Test multiple calls to Persist.
313 TEST(DiskCacheBasedQuicServerInfo, MultiplePersist) { 337 TEST(DiskCacheBasedQuicServerInfo, MultiplePersist) {
314 MockHttpCache cache; 338 MockHttpCache cache;
315 AddMockTransaction(&kHostInfoTransaction1); 339 AddMockTransaction(&kHostInfoTransaction1);
316 TestCompletionCallback callback; 340 TestCompletionCallback callback;
317 341
318 QuicServerId server_id("www.google.com", 443, PRIVACY_MODE_DISABLED); 342 QuicServerId server_id("www.google.com", 443, PRIVACY_MODE_DISABLED);
319 scoped_ptr<QuicServerInfo> quic_server_info( 343 scoped_ptr<QuicServerInfo> quic_server_info(
320 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); 344 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache()));
321 EXPECT_FALSE(quic_server_info->IsDataReady()); 345 EXPECT_FALSE(quic_server_info->IsDataReady());
322 quic_server_info->Start(); 346 quic_server_info->Start();
323 int rv = quic_server_info->WaitForDataReady(callback.callback()); 347 int rv = quic_server_info->WaitForDataReady(callback.callback());
324 EXPECT_EQ(OK, callback.GetResult(rv)); 348 EXPECT_EQ(OK, callback.GetResult(rv));
325 EXPECT_TRUE(quic_server_info->IsDataReady()); 349 EXPECT_TRUE(quic_server_info->IsDataReady());
326 350
327 // Persist data once. 351 // Persist data once.
328 QuicServerInfo::State* state = quic_server_info->mutable_state(); 352 QuicServerInfo::State* state = quic_server_info->mutable_state();
329 EXPECT_TRUE(state->certs.empty()); 353 EXPECT_TRUE(state->certs.empty());
330 const string server_config_init = "server_config_init"; 354 const string server_config_init = "server_config_init";
331 const string source_address_token_init = "source_address_token_init"; 355 const string source_address_token_init = "source_address_token_init";
356 const string cert_sct_init = "cert_sct_init";
357 const string chlo_hash_init = "chlo_hash_init";
332 const string server_config_sig_init = "server_config_sig_init"; 358 const string server_config_sig_init = "server_config_sig_init";
333 const string cert_init = "cert_init"; 359 const string cert_init = "cert_init";
334 360
335 state->server_config = server_config_init; 361 state->server_config = server_config_init;
336 state->source_address_token = source_address_token_init; 362 state->source_address_token = source_address_token_init;
363 state->cert_sct = cert_sct_init;
364 state->chlo_hash = chlo_hash_init;
337 state->server_config_sig = server_config_sig_init; 365 state->server_config_sig = server_config_sig_init;
338 state->certs.push_back(cert_init); 366 state->certs.push_back(cert_init);
339 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); 367 EXPECT_TRUE(quic_server_info->IsReadyToPersist());
340 quic_server_info->Persist(); 368 quic_server_info->Persist();
341 369
342 // Once we call Persist, IsReadyToPersist should return false until Persist 370 // Once we call Persist, IsReadyToPersist should return false until Persist
343 // has completed. 371 // has completed.
344 EXPECT_FALSE(quic_server_info->IsReadyToPersist()); 372 EXPECT_FALSE(quic_server_info->IsReadyToPersist());
345 373
346 // Wait until Persist() does the work. 374 // Wait until Persist() does the work.
347 base::MessageLoop::current()->RunUntilIdle(); 375 base::MessageLoop::current()->RunUntilIdle();
348 376
349 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); 377 EXPECT_TRUE(quic_server_info->IsReadyToPersist());
350 378
351 // Persist one more time using the same |quic_server_info| object and without 379 // Persist one more time using the same |quic_server_info| object and without
352 // doing another Start() and WaitForDataReady. 380 // doing another Start() and WaitForDataReady.
353 const string server_config_a = "server_config_a"; 381 const string server_config_a = "server_config_a";
354 const string source_address_token_a = "source_address_token_a"; 382 const string source_address_token_a = "source_address_token_a";
383 const string cert_sct_a = "cert_sct_a";
384 const string chlo_hash_a = "chlo_hash_a";
355 const string server_config_sig_a = "server_config_sig_a"; 385 const string server_config_sig_a = "server_config_sig_a";
356 const string cert_a = "cert_a"; 386 const string cert_a = "cert_a";
357 387
358 state->server_config = server_config_a; 388 state->server_config = server_config_a;
359 state->source_address_token = source_address_token_a; 389 state->source_address_token = source_address_token_a;
390 state->cert_sct = cert_sct_a;
391 state->chlo_hash = chlo_hash_a;
360 state->server_config_sig = server_config_sig_a; 392 state->server_config_sig = server_config_sig_a;
361 state->certs.push_back(cert_a); 393 state->certs.push_back(cert_a);
362 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); 394 EXPECT_TRUE(quic_server_info->IsReadyToPersist());
363 quic_server_info->Persist(); 395 quic_server_info->Persist();
364 396
365 // Once we call Persist, IsReadyToPersist should return false until Persist 397 // Once we call Persist, IsReadyToPersist should return false until Persist
366 // has completed. 398 // has completed.
367 EXPECT_FALSE(quic_server_info->IsReadyToPersist()); 399 EXPECT_FALSE(quic_server_info->IsReadyToPersist());
368 400
369 // Wait until Persist() does the work. 401 // Wait until Persist() does the work.
370 base::MessageLoop::current()->RunUntilIdle(); 402 base::MessageLoop::current()->RunUntilIdle();
371 403
372 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); 404 EXPECT_TRUE(quic_server_info->IsReadyToPersist());
373 405
374 // Verify that the state was updated. 406 // Verify that the state was updated.
375 quic_server_info.reset( 407 quic_server_info.reset(
376 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); 408 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache()));
377 quic_server_info->Start(); 409 quic_server_info->Start();
378 rv = quic_server_info->WaitForDataReady(callback.callback()); 410 rv = quic_server_info->WaitForDataReady(callback.callback());
379 EXPECT_EQ(OK, callback.GetResult(rv)); 411 EXPECT_EQ(OK, callback.GetResult(rv));
380 EXPECT_TRUE(quic_server_info->IsDataReady()); 412 EXPECT_TRUE(quic_server_info->IsDataReady());
381 413
382 const QuicServerInfo::State& state1 = quic_server_info->state(); 414 const QuicServerInfo::State& state1 = quic_server_info->state();
383 EXPECT_EQ(server_config_a, state1.server_config); 415 EXPECT_EQ(server_config_a, state1.server_config);
384 EXPECT_EQ(source_address_token_a, state1.source_address_token); 416 EXPECT_EQ(source_address_token_a, state1.source_address_token);
417 EXPECT_EQ(cert_sct_a, state1.cert_sct);
418 EXPECT_EQ(chlo_hash_a, state1.chlo_hash);
385 EXPECT_EQ(server_config_sig_a, state1.server_config_sig); 419 EXPECT_EQ(server_config_sig_a, state1.server_config_sig);
386 EXPECT_EQ(1U, state1.certs.size()); 420 EXPECT_EQ(1U, state1.certs.size());
387 EXPECT_EQ(cert_a, state1.certs[0]); 421 EXPECT_EQ(cert_a, state1.certs[0]);
388 422
389 RemoveMockTransaction(&kHostInfoTransaction1); 423 RemoveMockTransaction(&kHostInfoTransaction1);
390 } 424 }
391 425
392 TEST(DiskCacheBasedQuicServerInfo, CancelWaitForDataReady) { 426 TEST(DiskCacheBasedQuicServerInfo, CancelWaitForDataReady) {
393 MockBlockingBackendFactory* factory = new MockBlockingBackendFactory(); 427 MockBlockingBackendFactory* factory = new MockBlockingBackendFactory();
394 MockHttpCache cache(make_scoped_ptr(factory)); 428 MockHttpCache cache(make_scoped_ptr(factory));
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 quic_server_info->Start(); 493 quic_server_info->Start();
460 // Wait until Start() does the work. 494 // Wait until Start() does the work.
461 base::MessageLoop::current()->RunUntilIdle(); 495 base::MessageLoop::current()->RunUntilIdle();
462 496
463 EXPECT_TRUE(quic_server_info->IsDataReady()); 497 EXPECT_TRUE(quic_server_info->IsDataReady());
464 498
465 QuicServerInfo::State* state = quic_server_info->mutable_state(); 499 QuicServerInfo::State* state = quic_server_info->mutable_state();
466 EXPECT_TRUE(state->certs.empty()); 500 EXPECT_TRUE(state->certs.empty());
467 const string server_config_a = "server_config_a"; 501 const string server_config_a = "server_config_a";
468 const string source_address_token_a = "source_address_token_a"; 502 const string source_address_token_a = "source_address_token_a";
503 const string cert_sct_a = "cert_sct_a";
504 const string chlo_hash_a = "chlo_hash_a";
469 const string server_config_sig_a = "server_config_sig_a"; 505 const string server_config_sig_a = "server_config_sig_a";
470 const string cert_a = "cert_a"; 506 const string cert_a = "cert_a";
471 507
472 state->server_config = server_config_a; 508 state->server_config = server_config_a;
473 state->source_address_token = source_address_token_a; 509 state->source_address_token = source_address_token_a;
510 state->cert_sct = cert_sct_a;
511 state->chlo_hash = chlo_hash_a;
474 state->server_config_sig = server_config_sig_a; 512 state->server_config_sig = server_config_sig_a;
475 state->certs.push_back(cert_a); 513 state->certs.push_back(cert_a);
476 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); 514 EXPECT_TRUE(quic_server_info->IsReadyToPersist());
477 quic_server_info->Persist(); 515 quic_server_info->Persist();
478 quic_server_info->OnExternalCacheHit(); 516 quic_server_info->OnExternalCacheHit();
479 517
480 // Once we call Persist, IsReadyToPersist should return false until Persist 518 // Once we call Persist, IsReadyToPersist should return false until Persist
481 // has completed. 519 // has completed.
482 EXPECT_FALSE(quic_server_info->IsReadyToPersist()); 520 EXPECT_FALSE(quic_server_info->IsReadyToPersist());
483 521
484 // Wait until Persist() does the work. 522 // Wait until Persist() does the work.
485 base::MessageLoop::current()->RunUntilIdle(); 523 base::MessageLoop::current()->RunUntilIdle();
486 524
487 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); 525 EXPECT_TRUE(quic_server_info->IsReadyToPersist());
488 526
489 // Verify that the state was updated. 527 // Verify that the state was updated.
490 quic_server_info.reset( 528 quic_server_info.reset(
491 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); 529 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache()));
492 quic_server_info->Start(); 530 quic_server_info->Start();
493 TestCompletionCallback callback; 531 TestCompletionCallback callback;
494 int rv = quic_server_info->WaitForDataReady(callback.callback()); 532 int rv = quic_server_info->WaitForDataReady(callback.callback());
495 EXPECT_EQ(OK, callback.GetResult(rv)); 533 EXPECT_EQ(OK, callback.GetResult(rv));
496 EXPECT_TRUE(quic_server_info->IsDataReady()); 534 EXPECT_TRUE(quic_server_info->IsDataReady());
497 535
498 const QuicServerInfo::State& state1 = quic_server_info->state(); 536 const QuicServerInfo::State& state1 = quic_server_info->state();
499 EXPECT_EQ(server_config_a, state1.server_config); 537 EXPECT_EQ(server_config_a, state1.server_config);
500 EXPECT_EQ(source_address_token_a, state1.source_address_token); 538 EXPECT_EQ(source_address_token_a, state1.source_address_token);
539 EXPECT_EQ(cert_sct_a, state1.cert_sct);
540 EXPECT_EQ(chlo_hash_a, state1.chlo_hash);
501 EXPECT_EQ(server_config_sig_a, state1.server_config_sig); 541 EXPECT_EQ(server_config_sig_a, state1.server_config_sig);
502 EXPECT_EQ(1U, state1.certs.size()); 542 EXPECT_EQ(1U, state1.certs.size());
503 EXPECT_EQ(cert_a, state1.certs[0]); 543 EXPECT_EQ(cert_a, state1.certs[0]);
504 544
505 RemoveMockTransaction(&kHostInfoTransaction1); 545 RemoveMockTransaction(&kHostInfoTransaction1);
506 } 546 }
507 547
508 // Test Persisting data when we are not ready to persist and then verify it 548 // Test Persisting data when we are not ready to persist and then verify it
509 // persists the data when Start() finishes. 549 // persists the data when Start() finishes.
510 TEST(DiskCacheBasedQuicServerInfo, PersistWhenNotReadyToPersist) { 550 TEST(DiskCacheBasedQuicServerInfo, PersistWhenNotReadyToPersist) {
511 MockBlockingBackendFactory* factory = new MockBlockingBackendFactory(); 551 MockBlockingBackendFactory* factory = new MockBlockingBackendFactory();
512 MockHttpCache cache(make_scoped_ptr(factory)); 552 MockHttpCache cache(make_scoped_ptr(factory));
513 AddMockTransaction(&kHostInfoTransaction1); 553 AddMockTransaction(&kHostInfoTransaction1);
514 TestCompletionCallback callback; 554 TestCompletionCallback callback;
515 555
516 QuicServerId server_id("www.google.com", 443, PRIVACY_MODE_DISABLED); 556 QuicServerId server_id("www.google.com", 443, PRIVACY_MODE_DISABLED);
517 scoped_ptr<QuicServerInfo> quic_server_info( 557 scoped_ptr<QuicServerInfo> quic_server_info(
518 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); 558 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache()));
519 EXPECT_FALSE(quic_server_info->IsDataReady()); 559 EXPECT_FALSE(quic_server_info->IsDataReady());
520 // We do a Start(), but don't call WaitForDataReady(). Because we haven't 560 // We do a Start(), but don't call WaitForDataReady(). Because we haven't
521 // created the backend, we will wait and data wouldn't be ready. 561 // created the backend, we will wait and data wouldn't be ready.
522 quic_server_info->Start(); 562 quic_server_info->Start();
523 EXPECT_FALSE(quic_server_info->IsDataReady()); 563 EXPECT_FALSE(quic_server_info->IsDataReady());
524 564
525 // Persist data once, even though the backend is not ready. 565 // Persist data once, even though the backend is not ready.
526 QuicServerInfo::State* state = quic_server_info->mutable_state(); 566 QuicServerInfo::State* state = quic_server_info->mutable_state();
527 EXPECT_TRUE(state->certs.empty()); 567 EXPECT_TRUE(state->certs.empty());
528 const string server_config_init = "server_config_init"; 568 const string server_config_init = "server_config_init";
529 const string source_address_token_init = "source_address_token_init"; 569 const string source_address_token_init = "source_address_token_init";
570 const string cert_sct_init = "cert_sct_init";
571 const string chlo_hash_init = "chlo_hash_init";
530 const string server_config_sig_init = "server_config_sig_init"; 572 const string server_config_sig_init = "server_config_sig_init";
531 const string cert_init = "cert_init"; 573 const string cert_init = "cert_init";
532 574
533 state->server_config = server_config_init; 575 state->server_config = server_config_init;
534 state->source_address_token = source_address_token_init; 576 state->source_address_token = source_address_token_init;
577 state->cert_sct = cert_sct_init;
578 state->chlo_hash = chlo_hash_init;
535 state->server_config_sig = server_config_sig_init; 579 state->server_config_sig = server_config_sig_init;
536 state->certs.push_back(cert_init); 580 state->certs.push_back(cert_init);
537 EXPECT_FALSE(quic_server_info->IsReadyToPersist()); 581 EXPECT_FALSE(quic_server_info->IsReadyToPersist());
538 quic_server_info->Persist(); 582 quic_server_info->Persist();
539 EXPECT_FALSE(quic_server_info->IsReadyToPersist()); 583 EXPECT_FALSE(quic_server_info->IsReadyToPersist());
540 584
541 // Now complete the backend creation and let the callback run. 585 // Now complete the backend creation and let the callback run.
542 factory->FinishCreation(); 586 factory->FinishCreation();
543 EXPECT_TRUE(quic_server_info->IsDataReady()); 587 EXPECT_TRUE(quic_server_info->IsDataReady());
544 588
545 // Wait until Persist() does the work. 589 // Wait until Persist() does the work.
546 base::MessageLoop::current()->RunUntilIdle(); 590 base::MessageLoop::current()->RunUntilIdle();
547 591
548 // Verify that the state was updated. 592 // Verify that the state was updated.
549 quic_server_info.reset( 593 quic_server_info.reset(
550 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); 594 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache()));
551 quic_server_info->Start(); 595 quic_server_info->Start();
552 int rv = quic_server_info->WaitForDataReady(callback.callback()); 596 int rv = quic_server_info->WaitForDataReady(callback.callback());
553 EXPECT_EQ(OK, callback.GetResult(rv)); 597 EXPECT_EQ(OK, callback.GetResult(rv));
554 EXPECT_TRUE(quic_server_info->IsDataReady()); 598 EXPECT_TRUE(quic_server_info->IsDataReady());
555 599
556 const QuicServerInfo::State& state1 = quic_server_info->state(); 600 const QuicServerInfo::State& state1 = quic_server_info->state();
557 EXPECT_EQ(server_config_init, state1.server_config); 601 EXPECT_EQ(server_config_init, state1.server_config);
558 EXPECT_EQ(source_address_token_init, state1.source_address_token); 602 EXPECT_EQ(source_address_token_init, state1.source_address_token);
603 EXPECT_EQ(cert_sct_init, state1.cert_sct);
604 EXPECT_EQ(chlo_hash_init, state1.chlo_hash);
559 EXPECT_EQ(server_config_sig_init, state1.server_config_sig); 605 EXPECT_EQ(server_config_sig_init, state1.server_config_sig);
560 EXPECT_EQ(1U, state1.certs.size()); 606 EXPECT_EQ(1U, state1.certs.size());
561 EXPECT_EQ(cert_init, state1.certs[0]); 607 EXPECT_EQ(cert_init, state1.certs[0]);
562 RemoveMockTransaction(&kHostInfoTransaction1); 608 RemoveMockTransaction(&kHostInfoTransaction1);
563 } 609 }
564 610
565 // Test multiple calls to Persist without waiting for the data to be written. 611 // Test multiple calls to Persist without waiting for the data to be written.
566 TEST(DiskCacheBasedQuicServerInfo, MultiplePersistsWithoutWaiting) { 612 TEST(DiskCacheBasedQuicServerInfo, MultiplePersistsWithoutWaiting) {
567 MockHttpCache cache; 613 MockHttpCache cache;
568 AddMockTransaction(&kHostInfoTransaction1); 614 AddMockTransaction(&kHostInfoTransaction1);
569 TestCompletionCallback callback; 615 TestCompletionCallback callback;
570 616
571 QuicServerId server_id("www.google.com", 443, PRIVACY_MODE_DISABLED); 617 QuicServerId server_id("www.google.com", 443, PRIVACY_MODE_DISABLED);
572 scoped_ptr<QuicServerInfo> quic_server_info( 618 scoped_ptr<QuicServerInfo> quic_server_info(
573 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); 619 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache()));
574 EXPECT_FALSE(quic_server_info->IsDataReady()); 620 EXPECT_FALSE(quic_server_info->IsDataReady());
575 quic_server_info->Start(); 621 quic_server_info->Start();
576 int rv = quic_server_info->WaitForDataReady(callback.callback()); 622 int rv = quic_server_info->WaitForDataReady(callback.callback());
577 EXPECT_EQ(OK, callback.GetResult(rv)); 623 EXPECT_EQ(OK, callback.GetResult(rv));
578 EXPECT_TRUE(quic_server_info->IsDataReady()); 624 EXPECT_TRUE(quic_server_info->IsDataReady());
579 625
580 // Persist data once. 626 // Persist data once.
581 QuicServerInfo::State* state = quic_server_info->mutable_state(); 627 QuicServerInfo::State* state = quic_server_info->mutable_state();
582 EXPECT_TRUE(state->certs.empty()); 628 EXPECT_TRUE(state->certs.empty());
583 const string server_config_init = "server_config_init"; 629 const string server_config_init = "server_config_init";
584 const string source_address_token_init = "source_address_token_init"; 630 const string source_address_token_init = "source_address_token_init";
631 const string cert_sct_init = "cert_sct_init";
632 const string chlo_hash_init = "chlo_hash_init";
585 const string server_config_sig_init = "server_config_sig_init"; 633 const string server_config_sig_init = "server_config_sig_init";
586 const string cert_init = "cert_init"; 634 const string cert_init = "cert_init";
587 635
588 state->server_config = server_config_init; 636 state->server_config = server_config_init;
589 state->source_address_token = source_address_token_init; 637 state->source_address_token = source_address_token_init;
638 state->cert_sct = cert_sct_init;
639 state->chlo_hash = chlo_hash_init;
590 state->server_config_sig = server_config_sig_init; 640 state->server_config_sig = server_config_sig_init;
591 state->certs.push_back(cert_init); 641 state->certs.push_back(cert_init);
592 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); 642 EXPECT_TRUE(quic_server_info->IsReadyToPersist());
593 quic_server_info->Persist(); 643 quic_server_info->Persist();
594 644
595 // Once we call Persist, IsReadyToPersist should return false until Persist 645 // Once we call Persist, IsReadyToPersist should return false until Persist
596 // has completed. 646 // has completed.
597 EXPECT_FALSE(quic_server_info->IsReadyToPersist()); 647 EXPECT_FALSE(quic_server_info->IsReadyToPersist());
598 648
599 // Persist one more time using the same |quic_server_info| object and without 649 // Persist one more time using the same |quic_server_info| object and without
600 // doing another Start() and WaitForDataReady. 650 // doing another Start() and WaitForDataReady.
601 const string server_config_a = "server_config_a"; 651 const string server_config_a = "server_config_a";
602 const string source_address_token_a = "source_address_token_a"; 652 const string source_address_token_a = "source_address_token_a";
653 const string cert_sct_a = "cert_sct_a";
654 const string chlo_hash_a = "chlo_hash_a";
603 const string server_config_sig_a = "server_config_sig_a"; 655 const string server_config_sig_a = "server_config_sig_a";
604 const string cert_a = "cert_a"; 656 const string cert_a = "cert_a";
605 657
606 state->server_config = server_config_a; 658 state->server_config = server_config_a;
607 state->source_address_token = source_address_token_a; 659 state->source_address_token = source_address_token_a;
660 state->cert_sct = cert_sct_a;
661 state->chlo_hash = chlo_hash_a;
608 state->server_config_sig = server_config_sig_a; 662 state->server_config_sig = server_config_sig_a;
609 state->certs.push_back(cert_a); 663 state->certs.push_back(cert_a);
610 EXPECT_FALSE(quic_server_info->IsReadyToPersist()); 664 EXPECT_FALSE(quic_server_info->IsReadyToPersist());
611 quic_server_info->Persist(); 665 quic_server_info->Persist();
612 666
613 // Wait until Persist() does the work. 667 // Wait until Persist() does the work.
614 base::MessageLoop::current()->RunUntilIdle(); 668 base::MessageLoop::current()->RunUntilIdle();
615 669
616 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); 670 EXPECT_TRUE(quic_server_info->IsReadyToPersist());
617 671
618 // Verify that the state was updated. 672 // Verify that the state was updated.
619 quic_server_info.reset( 673 quic_server_info.reset(
620 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); 674 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache()));
621 quic_server_info->Start(); 675 quic_server_info->Start();
622 rv = quic_server_info->WaitForDataReady(callback.callback()); 676 rv = quic_server_info->WaitForDataReady(callback.callback());
623 EXPECT_EQ(OK, callback.GetResult(rv)); 677 EXPECT_EQ(OK, callback.GetResult(rv));
624 EXPECT_TRUE(quic_server_info->IsDataReady()); 678 EXPECT_TRUE(quic_server_info->IsDataReady());
625 679
626 // Verify the second time persisted data is persisted. 680 // Verify the second time persisted data is persisted.
627 const QuicServerInfo::State& state1 = quic_server_info->state(); 681 const QuicServerInfo::State& state1 = quic_server_info->state();
628 EXPECT_EQ(server_config_a, state1.server_config); 682 EXPECT_EQ(server_config_a, state1.server_config);
629 EXPECT_EQ(source_address_token_a, state1.source_address_token); 683 EXPECT_EQ(source_address_token_a, state1.source_address_token);
684 EXPECT_EQ(cert_sct_a, state1.cert_sct);
685 EXPECT_EQ(chlo_hash_a, state1.chlo_hash);
630 EXPECT_EQ(server_config_sig_a, state1.server_config_sig); 686 EXPECT_EQ(server_config_sig_a, state1.server_config_sig);
631 EXPECT_EQ(1U, state1.certs.size()); 687 EXPECT_EQ(1U, state1.certs.size());
632 EXPECT_EQ(cert_a, state1.certs[0]); 688 EXPECT_EQ(cert_a, state1.certs[0]);
633 689
634 RemoveMockTransaction(&kHostInfoTransaction1); 690 RemoveMockTransaction(&kHostInfoTransaction1);
635 } 691 }
636 692
637 // crbug.com/439209: test deletion of QuicServerInfo object in the callback 693 // crbug.com/439209: test deletion of QuicServerInfo object in the callback
638 // doesn't crash. 694 // doesn't crash.
639 TEST(DiskCacheBasedQuicServerInfo, DeleteServerInfoInCallback) { 695 TEST(DiskCacheBasedQuicServerInfo, DeleteServerInfoInCallback) {
640 // Use the blocking mock backend factory to force asynchronous completion 696 // Use the blocking mock backend factory to force asynchronous completion
641 // of quic_server_info->WaitForDataReady(), so that the callback will run. 697 // of quic_server_info->WaitForDataReady(), so that the callback will run.
642 MockBlockingBackendFactory* factory = new MockBlockingBackendFactory(); 698 MockBlockingBackendFactory* factory = new MockBlockingBackendFactory();
643 MockHttpCache cache(make_scoped_ptr(factory)); 699 MockHttpCache cache(make_scoped_ptr(factory));
644 QuicServerId server_id("www.verisign.com", 443, PRIVACY_MODE_DISABLED); 700 QuicServerId server_id("www.verisign.com", 443, PRIVACY_MODE_DISABLED);
645 QuicServerInfo* quic_server_info = 701 QuicServerInfo* quic_server_info =
646 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache()); 702 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache());
647 // |cb| takes owndership and deletes |quic_server_info| when it is called. 703 // |cb| takes owndership and deletes |quic_server_info| when it is called.
648 DeleteCacheCompletionCallback cb(quic_server_info); 704 DeleteCacheCompletionCallback cb(quic_server_info);
649 quic_server_info->Start(); 705 quic_server_info->Start();
650 int rv = quic_server_info->WaitForDataReady(cb.callback()); 706 int rv = quic_server_info->WaitForDataReady(cb.callback());
651 EXPECT_EQ(ERR_IO_PENDING, rv); 707 EXPECT_EQ(ERR_IO_PENDING, rv);
652 // Now complete the backend creation and let the callback run. 708 // Now complete the backend creation and let the callback run.
653 factory->FinishCreation(); 709 factory->FinishCreation();
654 EXPECT_EQ(OK, cb.GetResult(rv)); 710 EXPECT_EQ(OK, cb.GetResult(rv));
655 } 711 }
656 712
657 } // namespace net 713 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/crypto/properties_based_quic_server_info_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698