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

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 windows specific file. 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
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..bbf1e433bf3c4804b89e214a4a10bed3167737db 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)
+ explicit SparseTestCompletionCallback(scoped_ptr<disk_cache::Backend>* cache)
rvargas (doing something else) 2013/07/26 21:05:01 nit: this is kind of ugly :(. The argument suggest
qsr 2013/07/29 08:26:28 Given that this is a pointer to the scoped_ptr, an
: cache_(cache) {
}
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,10 @@ TEST_F(DiskCacheEntryTest, DoomSparseEntry2) {
EXPECT_EQ(9, cache_->GetEntryCount());
entry->Close();
- SparseTestCompletionCallback cb(cache_);
+ SparseTestCompletionCallback cb(&cache_);
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() {

Powered by Google App Engine
This is Rietveld 408576698