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

Unified Diff: net/disk_cache/backend_unittest.cc

Issue 15984016: Call scoped_refptr<T>::get() rather than relying on implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/upload_file_element_reader_unittest.cc ('k') | net/disk_cache/disk_cache_perftest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/backend_unittest.cc
diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc
index 7c9c005165eeca45be9684325c295f09bd7bbf2e..2b0a1555a5bb5e2e6ee5f5205fb10c4912f45bb9 100644
--- a/net/disk_cache/backend_unittest.cc
+++ b/net/disk_cache/backend_unittest.cc
@@ -238,11 +238,16 @@ TEST_F(DiskCacheTest, CreateBackend) {
cache = NULL;
// Now test the public API.
- int rv = disk_cache::CreateCacheBackend(net::DISK_CACHE,
- net::CACHE_BACKEND_DEFAULT,
- cache_path_, 0, false,
- cache_thread.message_loop_proxy(),
- NULL, &cache, cb.callback());
+ int rv =
+ disk_cache::CreateCacheBackend(net::DISK_CACHE,
+ net::CACHE_BACKEND_DEFAULT,
+ cache_path_,
+ 0,
+ false,
+ cache_thread.message_loop_proxy().get(),
+ NULL,
+ &cache,
+ cb.callback());
ASSERT_EQ(net::OK, cb.GetResult(rv));
ASSERT_TRUE(cache);
delete cache;
@@ -273,7 +278,7 @@ TEST_F(DiskCacheBackendTest, CreateBackend_MissingFile) {
bool prev = base::ThreadRestrictions::SetIOAllowed(false);
disk_cache::BackendImpl* cache = new disk_cache::BackendImpl(
- cache_path_, cache_thread.message_loop_proxy(), NULL);
+ cache_path_, cache_thread.message_loop_proxy().get(), NULL);
int rv = cache->Init(cb.callback());
ASSERT_EQ(net::ERR_FAILED, cb.GetResult(rv));
base::ThreadRestrictions::SetIOAllowed(prev);
@@ -476,9 +481,16 @@ TEST_F(DiskCacheTest, TruncatedIndex) {
net::TestCompletionCallback cb;
disk_cache::Backend* backend = NULL;
- int rv = disk_cache::CreateCacheBackend(
- net::DISK_CACHE, net::CACHE_BACKEND_BLOCKFILE, cache_path_, 0, false,
- cache_thread.message_loop_proxy(), NULL, &backend, cb.callback());
+ int rv =
+ disk_cache::CreateCacheBackend(net::DISK_CACHE,
+ net::CACHE_BACKEND_BLOCKFILE,
+ cache_path_,
+ 0,
+ false,
+ cache_thread.message_loop_proxy().get(),
+ NULL,
+ &backend,
+ cb.callback());
ASSERT_NE(net::OK, cb.GetResult(rv));
ASSERT_TRUE(backend == NULL);
@@ -1677,7 +1689,7 @@ TEST_F(DiskCacheTest, WrongVersion) {
net::TestCompletionCallback cb;
disk_cache::BackendImpl* cache = new disk_cache::BackendImpl(
- cache_path_, cache_thread.message_loop_proxy(), NULL);
+ cache_path_, cache_thread.message_loop_proxy().get(), NULL);
int rv = cache->Init(cb.callback());
ASSERT_EQ(net::ERR_FAILED, cb.GetResult(rv));
@@ -1695,11 +1707,16 @@ TEST_F(DiskCacheBackendTest, DeleteOld) {
net::TestCompletionCallback cb;
bool prev = base::ThreadRestrictions::SetIOAllowed(false);
base::FilePath path(cache_path_);
- int rv = disk_cache::CreateCacheBackend(net::DISK_CACHE,
- net::CACHE_BACKEND_BLOCKFILE, path,
- 0, true,
- cache_thread.message_loop_proxy(),
- NULL, &cache_, cb.callback());
+ int rv =
+ disk_cache::CreateCacheBackend(net::DISK_CACHE,
+ net::CACHE_BACKEND_BLOCKFILE,
+ path,
+ 0,
+ true,
+ cache_thread.message_loop_proxy().get(),
+ NULL,
+ &cache_,
+ cb.callback());
path.clear(); // Make sure path was captured by the previous call.
ASSERT_EQ(net::OK, cb.GetResult(rv));
base::ThreadRestrictions::SetIOAllowed(prev);
@@ -2456,8 +2473,7 @@ TEST_F(DiskCacheTest, Backend_UsageStats) {
ASSERT_TRUE(CleanupCacheDir());
scoped_ptr<disk_cache::BackendImpl> cache;
cache.reset(new disk_cache::BackendImpl(
- cache_path_, base::MessageLoopProxy::current(),
- NULL));
+ cache_path_, base::MessageLoopProxy::current().get(), NULL));
ASSERT_TRUE(NULL != cache.get());
cache->SetUnitTestMode();
ASSERT_EQ(net::OK, cache->SyncInit());
@@ -2581,13 +2597,26 @@ TEST_F(DiskCacheTest, MultipleInstances) {
const int kNumberOfCaches = 2;
disk_cache::Backend* cache[kNumberOfCaches];
- int rv = disk_cache::CreateCacheBackend(
- net::DISK_CACHE, net::CACHE_BACKEND_DEFAULT, store1.path(), 0, false,
- cache_thread.message_loop_proxy(), NULL, &cache[0], cb.callback());
+ int rv =
+ disk_cache::CreateCacheBackend(net::DISK_CACHE,
+ net::CACHE_BACKEND_DEFAULT,
+ store1.path(),
+ 0,
+ false,
+ cache_thread.message_loop_proxy().get(),
+ NULL,
+ &cache[0],
+ cb.callback());
ASSERT_EQ(net::OK, cb.GetResult(rv));
- rv = disk_cache::CreateCacheBackend(
- net::MEDIA_CACHE, net::CACHE_BACKEND_DEFAULT, store2.path(), 0, false,
- cache_thread.message_loop_proxy(), NULL, &cache[1], cb.callback());
+ rv = disk_cache::CreateCacheBackend(net::MEDIA_CACHE,
+ net::CACHE_BACKEND_DEFAULT,
+ store2.path(),
+ 0,
+ false,
+ cache_thread.message_loop_proxy().get(),
+ NULL,
+ &cache[1],
+ cb.callback());
ASSERT_EQ(net::OK, cb.GetResult(rv));
ASSERT_TRUE(cache[0] != NULL && cache[1] != NULL);
@@ -2989,8 +3018,10 @@ TEST_F(DiskCacheBackendTest, SimpleCacheOverBlockfileCache) {
ASSERT_TRUE(cache_thread.StartWithOptions(
base::Thread::Options(base::MessageLoop::TYPE_IO, 0)));
disk_cache::SimpleBackendImpl* simple_cache =
- new disk_cache::SimpleBackendImpl(cache_path_, 0, net::DISK_CACHE,
- cache_thread.message_loop_proxy(),
+ new disk_cache::SimpleBackendImpl(cache_path_,
+ 0,
+ net::DISK_CACHE,
+ cache_thread.message_loop_proxy().get(),
NULL);
net::TestCompletionCallback cb;
int rv = simple_cache->Init(cb.callback());
@@ -3020,7 +3051,7 @@ TEST_F(DiskCacheBackendTest, BlockfileCacheOverSimpleCache) {
ASSERT_TRUE(cache_thread.StartWithOptions(
base::Thread::Options(base::MessageLoop::TYPE_IO, 0)));
disk_cache::BackendImpl* cache = new disk_cache::BackendImpl(
- cache_path_, base::MessageLoopProxy::current(), NULL);
+ cache_path_, base::MessageLoopProxy::current().get(), NULL);
cache->SetUnitTestMode();
net::TestCompletionCallback cb;
int rv = cache->Init(cb.callback());
« no previous file with comments | « net/base/upload_file_element_reader_unittest.cc ('k') | net/disk_cache/disk_cache_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698