| OLD | NEW |
| 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" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
| 14 #include "net/http/mock_http_cache.h" | 14 #include "net/http/mock_http_cache.h" |
| 15 #include "net/quic/crypto/quic_server_info.h" | 15 #include "net/quic/crypto/quic_server_info.h" |
| 16 #include "net/quic/quic_server_id.h" | 16 #include "net/quic/quic_server_id.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 18 |
| 19 using std::string; | 19 using std::string; |
| 20 | 20 |
| 21 namespace net { | 21 namespace net { |
| 22 namespace { | 22 namespace { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 state->server_config = server_config_a; | 126 state->server_config = server_config_a; |
| 127 state->source_address_token = source_address_token_a; | 127 state->source_address_token = source_address_token_a; |
| 128 state->cert_sct = cert_sct_a; | 128 state->cert_sct = cert_sct_a; |
| 129 state->chlo_hash = chlo_hash_a; | 129 state->chlo_hash = chlo_hash_a; |
| 130 state->server_config_sig = server_config_sig_a; | 130 state->server_config_sig = server_config_sig_a; |
| 131 state->certs.push_back(cert_a); | 131 state->certs.push_back(cert_a); |
| 132 quic_server_info->Persist(); | 132 quic_server_info->Persist(); |
| 133 | 133 |
| 134 // Wait until Persist() does the work. | 134 // Wait until Persist() does the work. |
| 135 base::MessageLoop::current()->RunUntilIdle(); | 135 base::RunLoop().RunUntilIdle(); |
| 136 | 136 |
| 137 // Open the stored QuicServerInfo. | 137 // Open the stored QuicServerInfo. |
| 138 quic_server_info.reset( | 138 quic_server_info.reset( |
| 139 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); | 139 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); |
| 140 quic_server_info->Start(); | 140 quic_server_info->Start(); |
| 141 rv = quic_server_info->WaitForDataReady(callback.callback()); | 141 rv = quic_server_info->WaitForDataReady(callback.callback()); |
| 142 EXPECT_EQ(OK, callback.GetResult(rv)); | 142 EXPECT_EQ(OK, callback.GetResult(rv)); |
| 143 | 143 |
| 144 // And now update the data. | 144 // And now update the data. |
| 145 state = quic_server_info->mutable_state(); | 145 state = quic_server_info->mutable_state(); |
| 146 state->certs.push_back(cert_b); | 146 state->certs.push_back(cert_b); |
| 147 | 147 |
| 148 // Fail instead of DCHECKing double creates. | 148 // Fail instead of DCHECKing double creates. |
| 149 cache.disk_cache()->set_double_create_check(false); | 149 cache.disk_cache()->set_double_create_check(false); |
| 150 quic_server_info->Persist(); | 150 quic_server_info->Persist(); |
| 151 base::MessageLoop::current()->RunUntilIdle(); | 151 base::RunLoop().RunUntilIdle(); |
| 152 | 152 |
| 153 // Verify that the state was updated. | 153 // Verify that the state was updated. |
| 154 quic_server_info.reset( | 154 quic_server_info.reset( |
| 155 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); | 155 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); |
| 156 quic_server_info->Start(); | 156 quic_server_info->Start(); |
| 157 rv = quic_server_info->WaitForDataReady(callback.callback()); | 157 rv = quic_server_info->WaitForDataReady(callback.callback()); |
| 158 EXPECT_EQ(OK, callback.GetResult(rv)); | 158 EXPECT_EQ(OK, callback.GetResult(rv)); |
| 159 EXPECT_TRUE(quic_server_info->IsDataReady()); | 159 EXPECT_TRUE(quic_server_info->IsDataReady()); |
| 160 | 160 |
| 161 const QuicServerInfo::State& state1 = quic_server_info->state(); | 161 const QuicServerInfo::State& state1 = quic_server_info->state(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 197 |
| 198 state1->server_config = server_config_a; | 198 state1->server_config = server_config_a; |
| 199 state1->source_address_token = source_address_token_a; | 199 state1->source_address_token = source_address_token_a; |
| 200 state1->cert_sct = cert_sct_a; | 200 state1->cert_sct = cert_sct_a; |
| 201 state1->chlo_hash = chlo_hash_a; | 201 state1->chlo_hash = chlo_hash_a; |
| 202 state1->server_config_sig = server_config_sig_a; | 202 state1->server_config_sig = server_config_sig_a; |
| 203 state1->certs.push_back(cert_a); | 203 state1->certs.push_back(cert_a); |
| 204 quic_server_info1->Persist(); | 204 quic_server_info1->Persist(); |
| 205 | 205 |
| 206 // Wait until Persist() does the work. | 206 // Wait until Persist() does the work. |
| 207 base::MessageLoop::current()->RunUntilIdle(); | 207 base::RunLoop().RunUntilIdle(); |
| 208 | 208 |
| 209 // Persist data for port 80. | 209 // Persist data for port 80. |
| 210 QuicServerId server_id2("www.google.com", 80, PRIVACY_MODE_DISABLED); | 210 QuicServerId server_id2("www.google.com", 80, PRIVACY_MODE_DISABLED); |
| 211 std::unique_ptr<QuicServerInfo> quic_server_info2( | 211 std::unique_ptr<QuicServerInfo> quic_server_info2( |
| 212 new DiskCacheBasedQuicServerInfo(server_id2, cache.http_cache())); | 212 new DiskCacheBasedQuicServerInfo(server_id2, cache.http_cache())); |
| 213 quic_server_info2->Start(); | 213 quic_server_info2->Start(); |
| 214 rv = quic_server_info2->WaitForDataReady(callback.callback()); | 214 rv = quic_server_info2->WaitForDataReady(callback.callback()); |
| 215 EXPECT_EQ(OK, callback.GetResult(rv)); | 215 EXPECT_EQ(OK, callback.GetResult(rv)); |
| 216 | 216 |
| 217 QuicServerInfo::State* state2 = quic_server_info2->mutable_state(); | 217 QuicServerInfo::State* state2 = quic_server_info2->mutable_state(); |
| 218 EXPECT_TRUE(state2->certs.empty()); | 218 EXPECT_TRUE(state2->certs.empty()); |
| 219 const string server_config_b = "server_config_b"; | 219 const string server_config_b = "server_config_b"; |
| 220 const string source_address_token_b = "source_address_token_b"; | 220 const string source_address_token_b = "source_address_token_b"; |
| 221 const string cert_sct_b = "cert_sct_b"; | 221 const string cert_sct_b = "cert_sct_b"; |
| 222 const string chlo_hash_b = "chlo_hash_b"; | 222 const string chlo_hash_b = "chlo_hash_b"; |
| 223 const string server_config_sig_b = "server_config_sig_b"; | 223 const string server_config_sig_b = "server_config_sig_b"; |
| 224 const string cert_b = "cert_b"; | 224 const string cert_b = "cert_b"; |
| 225 | 225 |
| 226 state2->server_config = server_config_b; | 226 state2->server_config = server_config_b; |
| 227 state2->source_address_token = source_address_token_b; | 227 state2->source_address_token = source_address_token_b; |
| 228 state2->cert_sct = cert_sct_b; | 228 state2->cert_sct = cert_sct_b; |
| 229 state2->chlo_hash = chlo_hash_b; | 229 state2->chlo_hash = chlo_hash_b; |
| 230 state2->server_config_sig = server_config_sig_b; | 230 state2->server_config_sig = server_config_sig_b; |
| 231 state2->certs.push_back(cert_b); | 231 state2->certs.push_back(cert_b); |
| 232 quic_server_info2->Persist(); | 232 quic_server_info2->Persist(); |
| 233 | 233 |
| 234 // Wait until Persist() does the work. | 234 // Wait until Persist() does the work. |
| 235 base::MessageLoop::current()->RunUntilIdle(); | 235 base::RunLoop().RunUntilIdle(); |
| 236 | 236 |
| 237 // Verify the stored QuicServerInfo for port 443. | 237 // Verify the stored QuicServerInfo for port 443. |
| 238 std::unique_ptr<QuicServerInfo> quic_server_info( | 238 std::unique_ptr<QuicServerInfo> quic_server_info( |
| 239 new DiskCacheBasedQuicServerInfo(server_id1, cache.http_cache())); | 239 new DiskCacheBasedQuicServerInfo(server_id1, cache.http_cache())); |
| 240 quic_server_info->Start(); | 240 quic_server_info->Start(); |
| 241 rv = quic_server_info->WaitForDataReady(callback.callback()); | 241 rv = quic_server_info->WaitForDataReady(callback.callback()); |
| 242 EXPECT_EQ(OK, callback.GetResult(rv)); | 242 EXPECT_EQ(OK, callback.GetResult(rv)); |
| 243 EXPECT_TRUE(quic_server_info->IsDataReady()); | 243 EXPECT_TRUE(quic_server_info->IsDataReady()); |
| 244 | 244 |
| 245 const QuicServerInfo::State& state_a = quic_server_info->state(); | 245 const QuicServerInfo::State& state_a = quic_server_info->state(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 state->server_config_sig = server_config_sig_a; | 303 state->server_config_sig = server_config_sig_a; |
| 304 state->certs.push_back(cert_a); | 304 state->certs.push_back(cert_a); |
| 305 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); | 305 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); |
| 306 quic_server_info->Persist(); | 306 quic_server_info->Persist(); |
| 307 | 307 |
| 308 // Once we call Persist, IsReadyToPersist should return false until Persist | 308 // Once we call Persist, IsReadyToPersist should return false until Persist |
| 309 // has completed. | 309 // has completed. |
| 310 EXPECT_FALSE(quic_server_info->IsReadyToPersist()); | 310 EXPECT_FALSE(quic_server_info->IsReadyToPersist()); |
| 311 | 311 |
| 312 // Wait until Persist() does the work. | 312 // Wait until Persist() does the work. |
| 313 base::MessageLoop::current()->RunUntilIdle(); | 313 base::RunLoop().RunUntilIdle(); |
| 314 | 314 |
| 315 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); | 315 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); |
| 316 | 316 |
| 317 // Verify that the state was updated. | 317 // Verify that the state was updated. |
| 318 quic_server_info.reset( | 318 quic_server_info.reset( |
| 319 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); | 319 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); |
| 320 quic_server_info->Start(); | 320 quic_server_info->Start(); |
| 321 rv = quic_server_info->WaitForDataReady(callback.callback()); | 321 rv = quic_server_info->WaitForDataReady(callback.callback()); |
| 322 EXPECT_EQ(OK, callback.GetResult(rv)); | 322 EXPECT_EQ(OK, callback.GetResult(rv)); |
| 323 EXPECT_TRUE(quic_server_info->IsDataReady()); | 323 EXPECT_TRUE(quic_server_info->IsDataReady()); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 state->server_config_sig = server_config_sig_init; | 366 state->server_config_sig = server_config_sig_init; |
| 367 state->certs.push_back(cert_init); | 367 state->certs.push_back(cert_init); |
| 368 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); | 368 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); |
| 369 quic_server_info->Persist(); | 369 quic_server_info->Persist(); |
| 370 | 370 |
| 371 // Once we call Persist, IsReadyToPersist should return false until Persist | 371 // Once we call Persist, IsReadyToPersist should return false until Persist |
| 372 // has completed. | 372 // has completed. |
| 373 EXPECT_FALSE(quic_server_info->IsReadyToPersist()); | 373 EXPECT_FALSE(quic_server_info->IsReadyToPersist()); |
| 374 | 374 |
| 375 // Wait until Persist() does the work. | 375 // Wait until Persist() does the work. |
| 376 base::MessageLoop::current()->RunUntilIdle(); | 376 base::RunLoop().RunUntilIdle(); |
| 377 | 377 |
| 378 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); | 378 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); |
| 379 | 379 |
| 380 // Persist one more time using the same |quic_server_info| object and without | 380 // Persist one more time using the same |quic_server_info| object and without |
| 381 // doing another Start() and WaitForDataReady. | 381 // doing another Start() and WaitForDataReady. |
| 382 const string server_config_a = "server_config_a"; | 382 const string server_config_a = "server_config_a"; |
| 383 const string source_address_token_a = "source_address_token_a"; | 383 const string source_address_token_a = "source_address_token_a"; |
| 384 const string cert_sct_a = "cert_sct_a"; | 384 const string cert_sct_a = "cert_sct_a"; |
| 385 const string chlo_hash_a = "chlo_hash_a"; | 385 const string chlo_hash_a = "chlo_hash_a"; |
| 386 const string server_config_sig_a = "server_config_sig_a"; | 386 const string server_config_sig_a = "server_config_sig_a"; |
| 387 const string cert_a = "cert_a"; | 387 const string cert_a = "cert_a"; |
| 388 | 388 |
| 389 state->server_config = server_config_a; | 389 state->server_config = server_config_a; |
| 390 state->source_address_token = source_address_token_a; | 390 state->source_address_token = source_address_token_a; |
| 391 state->cert_sct = cert_sct_a; | 391 state->cert_sct = cert_sct_a; |
| 392 state->chlo_hash = chlo_hash_a; | 392 state->chlo_hash = chlo_hash_a; |
| 393 state->server_config_sig = server_config_sig_a; | 393 state->server_config_sig = server_config_sig_a; |
| 394 state->certs.push_back(cert_a); | 394 state->certs.push_back(cert_a); |
| 395 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); | 395 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); |
| 396 quic_server_info->Persist(); | 396 quic_server_info->Persist(); |
| 397 | 397 |
| 398 // Once we call Persist, IsReadyToPersist should return false until Persist | 398 // Once we call Persist, IsReadyToPersist should return false until Persist |
| 399 // has completed. | 399 // has completed. |
| 400 EXPECT_FALSE(quic_server_info->IsReadyToPersist()); | 400 EXPECT_FALSE(quic_server_info->IsReadyToPersist()); |
| 401 | 401 |
| 402 // Wait until Persist() does the work. | 402 // Wait until Persist() does the work. |
| 403 base::MessageLoop::current()->RunUntilIdle(); | 403 base::RunLoop().RunUntilIdle(); |
| 404 | 404 |
| 405 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); | 405 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); |
| 406 | 406 |
| 407 // Verify that the state was updated. | 407 // Verify that the state was updated. |
| 408 quic_server_info.reset( | 408 quic_server_info.reset( |
| 409 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); | 409 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); |
| 410 quic_server_info->Start(); | 410 quic_server_info->Start(); |
| 411 rv = quic_server_info->WaitForDataReady(callback.callback()); | 411 rv = quic_server_info->WaitForDataReady(callback.callback()); |
| 412 EXPECT_EQ(OK, callback.GetResult(rv)); | 412 EXPECT_EQ(OK, callback.GetResult(rv)); |
| 413 EXPECT_TRUE(quic_server_info->IsDataReady()); | 413 EXPECT_TRUE(quic_server_info->IsDataReady()); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 TEST(DiskCacheBasedQuicServerInfo, StartAndPersist) { | 486 TEST(DiskCacheBasedQuicServerInfo, StartAndPersist) { |
| 487 MockHttpCache cache; | 487 MockHttpCache cache; |
| 488 AddMockTransaction(&kHostInfoTransaction1); | 488 AddMockTransaction(&kHostInfoTransaction1); |
| 489 | 489 |
| 490 QuicServerId server_id("www.google.com", 443, PRIVACY_MODE_DISABLED); | 490 QuicServerId server_id("www.google.com", 443, PRIVACY_MODE_DISABLED); |
| 491 std::unique_ptr<QuicServerInfo> quic_server_info( | 491 std::unique_ptr<QuicServerInfo> quic_server_info( |
| 492 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); | 492 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); |
| 493 EXPECT_FALSE(quic_server_info->IsDataReady()); | 493 EXPECT_FALSE(quic_server_info->IsDataReady()); |
| 494 quic_server_info->Start(); | 494 quic_server_info->Start(); |
| 495 // Wait until Start() does the work. | 495 // Wait until Start() does the work. |
| 496 base::MessageLoop::current()->RunUntilIdle(); | 496 base::RunLoop().RunUntilIdle(); |
| 497 | 497 |
| 498 EXPECT_TRUE(quic_server_info->IsDataReady()); | 498 EXPECT_TRUE(quic_server_info->IsDataReady()); |
| 499 | 499 |
| 500 QuicServerInfo::State* state = quic_server_info->mutable_state(); | 500 QuicServerInfo::State* state = quic_server_info->mutable_state(); |
| 501 EXPECT_TRUE(state->certs.empty()); | 501 EXPECT_TRUE(state->certs.empty()); |
| 502 const string server_config_a = "server_config_a"; | 502 const string server_config_a = "server_config_a"; |
| 503 const string source_address_token_a = "source_address_token_a"; | 503 const string source_address_token_a = "source_address_token_a"; |
| 504 const string cert_sct_a = "cert_sct_a"; | 504 const string cert_sct_a = "cert_sct_a"; |
| 505 const string chlo_hash_a = "chlo_hash_a"; | 505 const string chlo_hash_a = "chlo_hash_a"; |
| 506 const string server_config_sig_a = "server_config_sig_a"; | 506 const string server_config_sig_a = "server_config_sig_a"; |
| 507 const string cert_a = "cert_a"; | 507 const string cert_a = "cert_a"; |
| 508 | 508 |
| 509 state->server_config = server_config_a; | 509 state->server_config = server_config_a; |
| 510 state->source_address_token = source_address_token_a; | 510 state->source_address_token = source_address_token_a; |
| 511 state->cert_sct = cert_sct_a; | 511 state->cert_sct = cert_sct_a; |
| 512 state->chlo_hash = chlo_hash_a; | 512 state->chlo_hash = chlo_hash_a; |
| 513 state->server_config_sig = server_config_sig_a; | 513 state->server_config_sig = server_config_sig_a; |
| 514 state->certs.push_back(cert_a); | 514 state->certs.push_back(cert_a); |
| 515 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); | 515 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); |
| 516 quic_server_info->Persist(); | 516 quic_server_info->Persist(); |
| 517 quic_server_info->OnExternalCacheHit(); | 517 quic_server_info->OnExternalCacheHit(); |
| 518 | 518 |
| 519 // Once we call Persist, IsReadyToPersist should return false until Persist | 519 // Once we call Persist, IsReadyToPersist should return false until Persist |
| 520 // has completed. | 520 // has completed. |
| 521 EXPECT_FALSE(quic_server_info->IsReadyToPersist()); | 521 EXPECT_FALSE(quic_server_info->IsReadyToPersist()); |
| 522 | 522 |
| 523 // Wait until Persist() does the work. | 523 // Wait until Persist() does the work. |
| 524 base::MessageLoop::current()->RunUntilIdle(); | 524 base::RunLoop().RunUntilIdle(); |
| 525 | 525 |
| 526 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); | 526 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); |
| 527 | 527 |
| 528 // Verify that the state was updated. | 528 // Verify that the state was updated. |
| 529 quic_server_info.reset( | 529 quic_server_info.reset( |
| 530 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); | 530 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); |
| 531 quic_server_info->Start(); | 531 quic_server_info->Start(); |
| 532 TestCompletionCallback callback; | 532 TestCompletionCallback callback; |
| 533 int rv = quic_server_info->WaitForDataReady(callback.callback()); | 533 int rv = quic_server_info->WaitForDataReady(callback.callback()); |
| 534 EXPECT_EQ(OK, callback.GetResult(rv)); | 534 EXPECT_EQ(OK, callback.GetResult(rv)); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 state->certs.push_back(cert_init); | 581 state->certs.push_back(cert_init); |
| 582 EXPECT_FALSE(quic_server_info->IsReadyToPersist()); | 582 EXPECT_FALSE(quic_server_info->IsReadyToPersist()); |
| 583 quic_server_info->Persist(); | 583 quic_server_info->Persist(); |
| 584 EXPECT_FALSE(quic_server_info->IsReadyToPersist()); | 584 EXPECT_FALSE(quic_server_info->IsReadyToPersist()); |
| 585 | 585 |
| 586 // Now complete the backend creation and let the callback run. | 586 // Now complete the backend creation and let the callback run. |
| 587 factory->FinishCreation(); | 587 factory->FinishCreation(); |
| 588 EXPECT_TRUE(quic_server_info->IsDataReady()); | 588 EXPECT_TRUE(quic_server_info->IsDataReady()); |
| 589 | 589 |
| 590 // Wait until Persist() does the work. | 590 // Wait until Persist() does the work. |
| 591 base::MessageLoop::current()->RunUntilIdle(); | 591 base::RunLoop().RunUntilIdle(); |
| 592 | 592 |
| 593 // Verify that the state was updated. | 593 // Verify that the state was updated. |
| 594 quic_server_info.reset( | 594 quic_server_info.reset( |
| 595 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); | 595 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); |
| 596 quic_server_info->Start(); | 596 quic_server_info->Start(); |
| 597 int rv = quic_server_info->WaitForDataReady(callback.callback()); | 597 int rv = quic_server_info->WaitForDataReady(callback.callback()); |
| 598 EXPECT_EQ(OK, callback.GetResult(rv)); | 598 EXPECT_EQ(OK, callback.GetResult(rv)); |
| 599 EXPECT_TRUE(quic_server_info->IsDataReady()); | 599 EXPECT_TRUE(quic_server_info->IsDataReady()); |
| 600 | 600 |
| 601 const QuicServerInfo::State& state1 = quic_server_info->state(); | 601 const QuicServerInfo::State& state1 = quic_server_info->state(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 state->server_config = server_config_a; | 659 state->server_config = server_config_a; |
| 660 state->source_address_token = source_address_token_a; | 660 state->source_address_token = source_address_token_a; |
| 661 state->cert_sct = cert_sct_a; | 661 state->cert_sct = cert_sct_a; |
| 662 state->chlo_hash = chlo_hash_a; | 662 state->chlo_hash = chlo_hash_a; |
| 663 state->server_config_sig = server_config_sig_a; | 663 state->server_config_sig = server_config_sig_a; |
| 664 state->certs.push_back(cert_a); | 664 state->certs.push_back(cert_a); |
| 665 EXPECT_FALSE(quic_server_info->IsReadyToPersist()); | 665 EXPECT_FALSE(quic_server_info->IsReadyToPersist()); |
| 666 quic_server_info->Persist(); | 666 quic_server_info->Persist(); |
| 667 | 667 |
| 668 // Wait until Persist() does the work. | 668 // Wait until Persist() does the work. |
| 669 base::MessageLoop::current()->RunUntilIdle(); | 669 base::RunLoop().RunUntilIdle(); |
| 670 | 670 |
| 671 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); | 671 EXPECT_TRUE(quic_server_info->IsReadyToPersist()); |
| 672 | 672 |
| 673 // Verify that the state was updated. | 673 // Verify that the state was updated. |
| 674 quic_server_info.reset( | 674 quic_server_info.reset( |
| 675 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); | 675 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); |
| 676 quic_server_info->Start(); | 676 quic_server_info->Start(); |
| 677 rv = quic_server_info->WaitForDataReady(callback.callback()); | 677 rv = quic_server_info->WaitForDataReady(callback.callback()); |
| 678 EXPECT_EQ(OK, callback.GetResult(rv)); | 678 EXPECT_EQ(OK, callback.GetResult(rv)); |
| 679 EXPECT_TRUE(quic_server_info->IsDataReady()); | 679 EXPECT_TRUE(quic_server_info->IsDataReady()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 705 DeleteCacheCompletionCallback cb(quic_server_info); | 705 DeleteCacheCompletionCallback cb(quic_server_info); |
| 706 quic_server_info->Start(); | 706 quic_server_info->Start(); |
| 707 int rv = quic_server_info->WaitForDataReady(cb.callback()); | 707 int rv = quic_server_info->WaitForDataReady(cb.callback()); |
| 708 EXPECT_EQ(ERR_IO_PENDING, rv); | 708 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 709 // Now complete the backend creation and let the callback run. | 709 // Now complete the backend creation and let the callback run. |
| 710 factory->FinishCreation(); | 710 factory->FinishCreation(); |
| 711 EXPECT_EQ(OK, cb.GetResult(rv)); | 711 EXPECT_EQ(OK, cb.GetResult(rv)); |
| 712 } | 712 } |
| 713 | 713 |
| 714 } // namespace net | 714 } // namespace net |
| OLD | NEW |