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

Side by Side Diff: net/disk_cache/disk_cache_test_base.cc

Issue 4067002: First pass at adding http/backend cache to NetLog (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Lint fixes Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/disk_cache/disk_cache_perftest.cc ('k') | net/disk_cache/disk_cache_test_util.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 (c) 2006-2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2010 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/disk_cache/disk_cache_test_base.h" 5 #include "net/disk_cache/disk_cache_test_base.h"
6 6
7 #include "net/base/io_buffer.h" 7 #include "net/base/io_buffer.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 #include "net/base/test_completion_callback.h" 9 #include "net/base/test_completion_callback.h"
10 #include "net/disk_cache/backend_impl.h" 10 #include "net/disk_cache/backend_impl.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 if (implementation_) 68 if (implementation_)
69 return InitDiskCacheImpl(path); 69 return InitDiskCacheImpl(path);
70 70
71 scoped_refptr<base::MessageLoopProxy> thread = 71 scoped_refptr<base::MessageLoopProxy> thread =
72 use_current_thread_ ? base::MessageLoopProxy::CreateForCurrentThread() : 72 use_current_thread_ ? base::MessageLoopProxy::CreateForCurrentThread() :
73 cache_thread_.message_loop_proxy(); 73 cache_thread_.message_loop_proxy();
74 74
75 TestCompletionCallback cb; 75 TestCompletionCallback cb;
76 int rv = disk_cache::BackendImpl::CreateBackend( 76 int rv = disk_cache::BackendImpl::CreateBackend(
77 path, force_creation_, size_, type_, 77 path, force_creation_, size_, type_,
78 disk_cache::kNoRandom, thread, &cache_, &cb); 78 disk_cache::kNoRandom, thread, NULL, &cache_, &cb);
79 ASSERT_EQ(net::OK, cb.GetResult(rv)); 79 ASSERT_EQ(net::OK, cb.GetResult(rv));
80 } 80 }
81 81
82 void DiskCacheTestWithCache::InitDiskCacheImpl(const FilePath& path) { 82 void DiskCacheTestWithCache::InitDiskCacheImpl(const FilePath& path) {
83 scoped_refptr<base::MessageLoopProxy> thread = 83 scoped_refptr<base::MessageLoopProxy> thread =
84 use_current_thread_ ? base::MessageLoopProxy::CreateForCurrentThread() : 84 use_current_thread_ ? base::MessageLoopProxy::CreateForCurrentThread() :
85 cache_thread_.message_loop_proxy(); 85 cache_thread_.message_loop_proxy();
86 if (mask_) 86 if (mask_)
87 cache_impl_ = new disk_cache::BackendImpl(path, mask_, thread); 87 cache_impl_ = new disk_cache::BackendImpl(path, mask_, thread, NULL);
88 else 88 else
89 cache_impl_ = new disk_cache::BackendImpl(path, thread); 89 cache_impl_ = new disk_cache::BackendImpl(path, thread, NULL);
90 90
91 cache_ = cache_impl_; 91 cache_ = cache_impl_;
92 ASSERT_TRUE(NULL != cache_); 92 ASSERT_TRUE(NULL != cache_);
93 93
94 if (size_) 94 if (size_)
95 EXPECT_TRUE(cache_impl_->SetMaxSize(size_)); 95 EXPECT_TRUE(cache_impl_->SetMaxSize(size_));
96 96
97 if (new_eviction_) 97 if (new_eviction_)
98 cache_impl_->SetNewEviction(); 98 cache_impl_->SetNewEviction();
99 99
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 return cb.GetResult(rv); 229 return cb.GetResult(rv);
230 } 230 }
231 231
232 int DiskCacheTestWithCache::WriteSparseData(disk_cache::Entry* entry, 232 int DiskCacheTestWithCache::WriteSparseData(disk_cache::Entry* entry,
233 int64 offset, 233 int64 offset,
234 net::IOBuffer* buf, int len) { 234 net::IOBuffer* buf, int len) {
235 TestCompletionCallback cb; 235 TestCompletionCallback cb;
236 int rv = entry->WriteSparseData(offset, buf, len, &cb); 236 int rv = entry->WriteSparseData(offset, buf, len, &cb);
237 return cb.GetResult(rv); 237 return cb.GetResult(rv);
238 } 238 }
OLDNEW
« no previous file with comments | « net/disk_cache/disk_cache_perftest.cc ('k') | net/disk_cache/disk_cache_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698