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

Unified Diff: net/disk_cache/entry_unittest.cc

Issue 20737002: Change the API of disk_cache::CreateCacheBackend to use scoped_ptr (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix new test Created 7 years, 5 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/disk_cache/disk_cache_test_base.cc ('k') | net/disk_cache/mem_backend_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/entry_unittest.cc
diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc
index f54cec0f770e72379dd6f366b8deca703fa76b83..857e07f1b7b1dcf08f4317eec0f175f07f4af72b 100644
--- a/net/disk_cache/entry_unittest.cc
+++ b/net/disk_cache/entry_unittest.cc
@@ -2025,17 +2025,17 @@ TEST_F(DiskCacheEntryTest, MemoryOnlyDoomSparseEntry) {
// way to simulate a race is to execute what we want on the callback.
class SparseTestCompletionCallback: public net::TestCompletionCallback {
public:
- explicit SparseTestCompletionCallback(disk_cache::Backend* cache)
- : cache_(cache) {
+ explicit SparseTestCompletionCallback(scoped_ptr<disk_cache::Backend> cache)
+ : cache_(cache.Pass()) {
}
private:
virtual void SetResult(int result) OVERRIDE {
- delete cache_;
+ cache_.reset();
TestCompletionCallback::SetResult(result);
}
- disk_cache::Backend* cache_;
+ scoped_ptr<disk_cache::Backend> cache_;
DISALLOW_COPY_AND_ASSIGN(SparseTestCompletionCallback);
};
@@ -2063,13 +2063,11 @@ TEST_F(DiskCacheEntryTest, DoomSparseEntry2) {
EXPECT_EQ(9, cache_->GetEntryCount());
entry->Close();
- SparseTestCompletionCallback cb(cache_);
- int rv = cache_->DoomEntry(key, cb.callback());
+ disk_cache::Backend* cache = cache_.get();
+ SparseTestCompletionCallback cb(cache_.Pass());
+ int rv = cache->DoomEntry(key, cb.callback());
EXPECT_EQ(net::ERR_IO_PENDING, rv);
EXPECT_EQ(net::OK, cb.WaitForResult());
-
- // TearDown will attempt to delete the cache_.
- cache_ = NULL;
}
void DiskCacheEntryTest::PartialSparseEntry() {
« no previous file with comments | « net/disk_cache/disk_cache_test_base.cc ('k') | net/disk_cache/mem_backend_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698