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

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

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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/disk_cache_based_quic_server_info.cc ('k') | net/http/http_cache_transaction.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 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/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); 411 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache()));
412 EXPECT_FALSE(quic_server_info->IsDataReady()); 412 EXPECT_FALSE(quic_server_info->IsDataReady());
413 quic_server_info->Start(); 413 quic_server_info->Start();
414 int rv = quic_server_info->WaitForDataReady(callback.callback()); 414 int rv = quic_server_info->WaitForDataReady(callback.callback());
415 quic_server_info->CancelWaitForDataReadyCallback(); 415 quic_server_info->CancelWaitForDataReadyCallback();
416 EXPECT_EQ(OK, callback.GetResult(rv)); 416 EXPECT_EQ(OK, callback.GetResult(rv));
417 EXPECT_TRUE(quic_server_info->IsDataReady()); 417 EXPECT_TRUE(quic_server_info->IsDataReady());
418 RemoveMockTransaction(&kHostInfoTransaction1); 418 RemoveMockTransaction(&kHostInfoTransaction1);
419 } 419 }
420 420
421 TEST(DiskCacheBasedQuicServerInfo, CancelWaitForDataReadyAfterDeleteCache) {
422 scoped_ptr<QuicServerInfo> quic_server_info;
423 {
424 MockHttpCache cache;
425 AddMockTransaction(&kHostInfoTransaction1);
426 TestCompletionCallback callback;
427
428 QuicServerId server_id("www.google.com", 443, true, PRIVACY_MODE_DISABLED);
429 quic_server_info.reset(
430 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache()));
431 EXPECT_FALSE(quic_server_info->IsDataReady());
432 quic_server_info->Start();
433 int rv = quic_server_info->WaitForDataReady(callback.callback());
434 quic_server_info->CancelWaitForDataReadyCallback();
435 EXPECT_EQ(OK, callback.GetResult(rv));
436 EXPECT_TRUE(quic_server_info->IsDataReady());
437 RemoveMockTransaction(&kHostInfoTransaction1);
438 }
439 // Cancel the callback after Cache is deleted.
440 quic_server_info->ResetWaitForDataReadyCallback();
441 }
442
421 // Test Start() followed by Persist() without calling WaitForDataReady. 443 // Test Start() followed by Persist() without calling WaitForDataReady.
422 TEST(DiskCacheBasedQuicServerInfo, StartAndPersist) { 444 TEST(DiskCacheBasedQuicServerInfo, StartAndPersist) {
423 MockHttpCache cache; 445 MockHttpCache cache;
424 AddMockTransaction(&kHostInfoTransaction1); 446 AddMockTransaction(&kHostInfoTransaction1);
425 447
426 QuicServerId server_id("www.google.com", 443, true, PRIVACY_MODE_DISABLED); 448 QuicServerId server_id("www.google.com", 443, true, PRIVACY_MODE_DISABLED);
427 scoped_ptr<QuicServerInfo> quic_server_info( 449 scoped_ptr<QuicServerInfo> quic_server_info(
428 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache())); 450 new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache()));
429 EXPECT_FALSE(quic_server_info->IsDataReady()); 451 EXPECT_FALSE(quic_server_info->IsDataReady());
430 quic_server_info->Start(); 452 quic_server_info->Start();
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 DeleteCacheCompletionCallback cb(quic_server_info); 641 DeleteCacheCompletionCallback cb(quic_server_info);
620 quic_server_info->Start(); 642 quic_server_info->Start();
621 int rv = quic_server_info->WaitForDataReady(cb.callback()); 643 int rv = quic_server_info->WaitForDataReady(cb.callback());
622 EXPECT_EQ(ERR_IO_PENDING, rv); 644 EXPECT_EQ(ERR_IO_PENDING, rv);
623 // Now complete the backend creation and let the callback run. 645 // Now complete the backend creation and let the callback run.
624 factory->FinishCreation(); 646 factory->FinishCreation();
625 EXPECT_EQ(OK, cb.GetResult(rv)); 647 EXPECT_EQ(OK, cb.GetResult(rv));
626 } 648 }
627 649
628 } // namespace net 650 } // namespace net
OLDNEW
« no previous file with comments | « net/http/disk_cache_based_quic_server_info.cc ('k') | net/http/http_cache_transaction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698