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

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

Issue 10546071: CapturingNetLog - remove maximum entries constructor argument. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: sync Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (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_cache.h" 5 #include "net/http/http_cache.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/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 EXPECT_EQ(1, cache.network_layer()->transaction_count()); 420 EXPECT_EQ(1, cache.network_layer()->transaction_count());
421 EXPECT_EQ(0, cache.disk_cache()->open_count()); 421 EXPECT_EQ(0, cache.disk_cache()->open_count());
422 EXPECT_EQ(1, cache.disk_cache()->create_count()); 422 EXPECT_EQ(1, cache.disk_cache()->create_count());
423 } 423 }
424 424
425 TEST(HttpCache, SimpleGETNoDiskCache) { 425 TEST(HttpCache, SimpleGETNoDiskCache) {
426 MockHttpCache cache; 426 MockHttpCache cache;
427 427
428 cache.disk_cache()->set_fail_requests(); 428 cache.disk_cache()->set_fail_requests();
429 429
430 net::CapturingBoundNetLog log(net::CapturingNetLog::kUnbounded); 430 net::CapturingBoundNetLog log;
431 log.SetLogLevel(net::NetLog::LOG_BASIC); 431 log.SetLogLevel(net::NetLog::LOG_BASIC);
432 432
433 // Read from the network, and don't use the cache. 433 // Read from the network, and don't use the cache.
434 RunTransactionTestWithLog(cache.http_cache(), kSimpleGET_Transaction, 434 RunTransactionTestWithLog(cache.http_cache(), kSimpleGET_Transaction,
435 log.bound()); 435 log.bound());
436 436
437 // Check that the NetLog was filled as expected. 437 // Check that the NetLog was filled as expected.
438 // (We attempted to both Open and Create entries, but both failed). 438 // (We attempted to both Open and Create entries, but both failed).
439 net::CapturingNetLog::CapturedEntryList entries; 439 net::CapturingNetLog::CapturedEntryList entries;
440 log.GetEntries(&entries); 440 log.GetEntries(&entries);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction); 562 RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction);
563 563
564 EXPECT_EQ(3, cache.network_layer()->transaction_count()); 564 EXPECT_EQ(3, cache.network_layer()->transaction_count());
565 EXPECT_EQ(1, cache.disk_cache()->open_count()); 565 EXPECT_EQ(1, cache.disk_cache()->open_count());
566 EXPECT_EQ(3, cache.disk_cache()->create_count()); 566 EXPECT_EQ(3, cache.disk_cache()->create_count());
567 } 567 }
568 568
569 TEST(HttpCache, SimpleGET_LoadOnlyFromCache_Hit) { 569 TEST(HttpCache, SimpleGET_LoadOnlyFromCache_Hit) {
570 MockHttpCache cache; 570 MockHttpCache cache;
571 571
572 net::CapturingBoundNetLog log(net::CapturingNetLog::kUnbounded); 572 net::CapturingBoundNetLog log;
573 573
574 // This prevents a number of write events from being logged. 574 // This prevents a number of write events from being logged.
575 log.SetLogLevel(net::NetLog::LOG_BASIC); 575 log.SetLogLevel(net::NetLog::LOG_BASIC);
576 576
577 // write to the cache 577 // write to the cache
578 RunTransactionTestWithLog(cache.http_cache(), kSimpleGET_Transaction, 578 RunTransactionTestWithLog(cache.http_cache(), kSimpleGET_Transaction,
579 log.bound()); 579 log.bound());
580 580
581 // Check that the NetLog was filled as expected. 581 // Check that the NetLog was filled as expected.
582 net::CapturingNetLog::CapturedEntryList entries; 582 net::CapturingNetLog::CapturedEntryList entries;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 TEST(HttpCache, SimpleGET_LoadBypassCache) { 695 TEST(HttpCache, SimpleGET_LoadBypassCache) {
696 MockHttpCache cache; 696 MockHttpCache cache;
697 697
698 // Write to the cache. 698 // Write to the cache.
699 RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction); 699 RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction);
700 700
701 // Force this transaction to write to the cache again. 701 // Force this transaction to write to the cache again.
702 MockTransaction transaction(kSimpleGET_Transaction); 702 MockTransaction transaction(kSimpleGET_Transaction);
703 transaction.load_flags |= net::LOAD_BYPASS_CACHE; 703 transaction.load_flags |= net::LOAD_BYPASS_CACHE;
704 704
705 net::CapturingBoundNetLog log(net::CapturingNetLog::kUnbounded); 705 net::CapturingBoundNetLog log;
706 706
707 // This prevents a number of write events from being logged. 707 // This prevents a number of write events from being logged.
708 log.SetLogLevel(net::NetLog::LOG_BASIC); 708 log.SetLogLevel(net::NetLog::LOG_BASIC);
709 709
710 RunTransactionTestWithLog(cache.http_cache(), transaction, log.bound()); 710 RunTransactionTestWithLog(cache.http_cache(), transaction, log.bound());
711 711
712 // Check that the NetLog was filled as expected. 712 // Check that the NetLog was filled as expected.
713 net::CapturingNetLog::CapturedEntryList entries; 713 net::CapturingNetLog::CapturedEntryList entries;
714 log.GetEntries(&entries); 714 log.GetEntries(&entries);
715 715
(...skipping 4226 matching lines...) Expand 10 before | Expand all | Expand 10 after
4942 4942
4943 // Verify that the entry is marked as incomplete. 4943 // Verify that the entry is marked as incomplete.
4944 disk_cache::Entry* entry; 4944 disk_cache::Entry* entry;
4945 ASSERT_TRUE(cache.OpenBackendEntry(kSimpleGET_Transaction.url, &entry)); 4945 ASSERT_TRUE(cache.OpenBackendEntry(kSimpleGET_Transaction.url, &entry));
4946 net::HttpResponseInfo response; 4946 net::HttpResponseInfo response;
4947 bool truncated = false; 4947 bool truncated = false;
4948 EXPECT_TRUE(MockHttpCache::ReadResponseInfo(entry, &response, &truncated)); 4948 EXPECT_TRUE(MockHttpCache::ReadResponseInfo(entry, &response, &truncated));
4949 EXPECT_TRUE(truncated); 4949 EXPECT_TRUE(truncated);
4950 entry->Close(); 4950 entry->Close();
4951 } 4951 }
OLDNEW
« no previous file with comments | « net/http/http_auth_handler_unittest.cc ('k') | net/http/http_network_transaction_spdy2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698