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

Unified Diff: net/http/http_cache_unittest.cc

Issue 2668563002: Change MockHttpCache constructor to take boolean to set quic server info factory (Closed)
Patch Set: sync with master Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/disk_cache_based_quic_server_info_unittest.cc ('k') | net/http/mock_http_cache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_cache_unittest.cc
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc
index 60c7ed7c8d75d286465b15c12b4806d86acc6b87..8431ae67f51d74dea532e1f75956c75c08abb684 100644
--- a/net/http/http_cache_unittest.cc
+++ b/net/http/http_cache_unittest.cc
@@ -647,7 +647,7 @@ TEST(HttpCache, CreateThenDestroy) {
}
TEST(HttpCache, GetBackend) {
- MockHttpCache cache(HttpCache::DefaultBackend::InMemory(0));
+ MockHttpCache cache(HttpCache::DefaultBackend::InMemory(0), false);
Ryan Hamilton 2017/02/02 01:07:09 I think you can revert these changes now, right?
Zhongyi Shi 2017/02/02 01:32:13 Added one more constructor in the MockHttpCache so
disk_cache::Backend* backend;
TestCompletionCallback cb;
@@ -715,7 +715,7 @@ TEST(HttpCache, SimpleGETNoDiskCache2) {
new MockBlockingBackendFactory());
factory->set_fail(true);
factory->FinishCreation(); // We'll complete synchronously.
- MockHttpCache cache(std::move(factory));
+ MockHttpCache cache(std::move(factory), false);
// Read from the network, and don't use the cache.
RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction);
@@ -1464,7 +1464,7 @@ TEST(HttpCache, SimpleGET_RacingReaders) {
// See http://code.google.com/p/chromium/issues/detail?id=25588
TEST(HttpCache, SimpleGET_DoomWithPending) {
// We need simultaneous doomed / not_doomed entries so let's use a real cache.
- MockHttpCache cache(HttpCache::DefaultBackend::InMemory(1024 * 1024));
+ MockHttpCache cache(HttpCache::DefaultBackend::InMemory(1024 * 1024), false);
MockHttpRequest request(kSimpleGET_Transaction);
MockHttpRequest writer_request(kSimpleGET_Transaction);
@@ -1802,7 +1802,7 @@ TEST(HttpCache, SimpleGET_AbandonedCacheRead) {
// ("waiting for the backend" as opposed to Active or Doomed entries).
TEST(HttpCache, SimpleGET_ManyWriters_DeleteCache) {
std::unique_ptr<MockHttpCache> cache(
- new MockHttpCache(base::WrapUnique(new MockBackendNoCbFactory())));
+ new MockHttpCache(base::WrapUnique(new MockBackendNoCbFactory()), false));
MockHttpRequest request(kSimpleGET_Transaction);
@@ -1839,7 +1839,7 @@ TEST(HttpCache, SimpleGET_ManyWriters_DeleteCache) {
// Tests that we queue requests when initializing the backend.
TEST(HttpCache, SimpleGET_WaitForBackend) {
MockBlockingBackendFactory* factory = new MockBlockingBackendFactory();
- MockHttpCache cache(base::WrapUnique(factory));
+ MockHttpCache cache(base::WrapUnique(factory), false);
MockHttpRequest request0(kSimpleGET_Transaction);
MockHttpRequest request1(kTypicalGET_Transaction);
@@ -1885,7 +1885,7 @@ TEST(HttpCache, SimpleGET_WaitForBackend) {
// to be initialized.
TEST(HttpCache, SimpleGET_WaitForBackend_CancelCreate) {
MockBlockingBackendFactory* factory = new MockBlockingBackendFactory();
- MockHttpCache cache(base::WrapUnique(factory));
+ MockHttpCache cache(base::WrapUnique(factory), false);
MockHttpRequest request0(kSimpleGET_Transaction);
MockHttpRequest request1(kTypicalGET_Transaction);
@@ -1940,7 +1940,7 @@ TEST(HttpCache, SimpleGET_WaitForBackend_CancelCreate) {
TEST(HttpCache, DeleteCacheWaitingForBackend) {
MockBlockingBackendFactory* factory = new MockBlockingBackendFactory();
std::unique_ptr<MockHttpCache> cache(
- new MockHttpCache(base::WrapUnique(factory)));
+ new MockHttpCache(base::WrapUnique(factory), false));
MockHttpRequest request(kSimpleGET_Transaction);
@@ -1972,7 +1972,7 @@ TEST(HttpCache, DeleteCacheWaitingForBackend) {
// one of the callbacks.
TEST(HttpCache, DeleteCacheWaitingForBackend2) {
MockBlockingBackendFactory* factory = new MockBlockingBackendFactory();
- MockHttpCache* cache = new MockHttpCache(base::WrapUnique(factory));
+ MockHttpCache* cache = new MockHttpCache(base::WrapUnique(factory), false);
DeleteCacheCompletionCallback cb(cache);
disk_cache::Backend* backend;
@@ -3148,7 +3148,7 @@ TEST(HttpCache, SimplePOST_NoUploadId_NoBackend) {
new MockBlockingBackendFactory());
factory->set_fail(true);
factory->FinishCreation();
- MockHttpCache cache(std::move(factory));
+ MockHttpCache cache(std::move(factory), false);
std::vector<std::unique_ptr<UploadElementReader>> element_readers;
element_readers.push_back(
@@ -5457,7 +5457,7 @@ TEST(HttpCache, RangeGET_InvalidResponse3) {
// Tests that we handle large range values properly.
TEST(HttpCache, RangeGET_LargeValues) {
// We need a real sparse cache for this test.
- MockHttpCache cache(HttpCache::DefaultBackend::InMemory(1024 * 1024));
+ MockHttpCache cache(HttpCache::DefaultBackend::InMemory(1024 * 1024), false);
std::string headers;
MockTransaction transaction(kRangeGET_TransactionOK);
@@ -5493,7 +5493,7 @@ TEST(HttpCache, RangeGET_NoDiskCache) {
new MockBlockingBackendFactory());
factory->set_fail(true);
factory->FinishCreation(); // We'll complete synchronously.
- MockHttpCache cache(std::move(factory));
+ MockHttpCache cache(std::move(factory), false);
AddMockTransaction(&kRangeGET_TransactionOK);
@@ -6614,7 +6614,7 @@ TEST(HttpCache, SimpleGET_SSLError) {
// Ensure that we don't crash by if left-behind transactions.
TEST(HttpCache, OutlivedTransactions) {
- MockHttpCache* cache = new MockHttpCache;
+ MockHttpCache* cache = new MockHttpCache(false);
std::unique_ptr<HttpTransaction> trans;
EXPECT_THAT(cache->CreateTransaction(&trans), IsOk());
@@ -7742,7 +7742,8 @@ class HttpCachePrefetchValidationTest : public ::testing::Test {
static const int kMaxAgeSecs = 100;
static const int kRequireValidationSecs = kMaxAgeSecs + 1;
- HttpCachePrefetchValidationTest() : transaction_(kSimpleGET_Transaction) {
+ HttpCachePrefetchValidationTest()
+ : cache_(false), transaction_(kSimpleGET_Transaction) {
DCHECK_LT(kMaxAgeSecs, prefetch_reuse_mins() * kNumSecondsPerMinute);
clock_ = new base::SimpleTestClock();
« no previous file with comments | « net/http/disk_cache_based_quic_server_info_unittest.cc ('k') | net/http/mock_http_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698