| 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());
|
|
|