| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 | 261 |
| 262 void DiskCacheTestWithCache::CreateBackend(uint32 flags, base::Thread* thread) { | 262 void DiskCacheTestWithCache::CreateBackend(uint32 flags, base::Thread* thread) { |
| 263 base::MessageLoopProxy* runner; | 263 base::MessageLoopProxy* runner; |
| 264 if (use_current_thread_) | 264 if (use_current_thread_) |
| 265 runner = base::MessageLoopProxy::current(); | 265 runner = base::MessageLoopProxy::current(); |
| 266 else | 266 else |
| 267 runner = thread->message_loop_proxy(); | 267 runner = thread->message_loop_proxy(); |
| 268 | 268 |
| 269 if (simple_cache_mode_) { | 269 if (simple_cache_mode_) { |
| 270 net::TestCompletionCallback cb; | 270 net::TestCompletionCallback cb; |
| 271 disk_cache::Backend* simple_backend; | 271 disk_cache::SimpleBackendImpl* simple_backend = |
| 272 // TODO(pasko): split Simple Backend construction from initialization. | 272 new disk_cache::SimpleBackendImpl(cache_path_, size_, type_, |
| 273 int rv = disk_cache::SimpleBackendImpl::CreateBackend(cache_path_, size_, | 273 make_scoped_refptr(runner), NULL); |
| 274 type_, disk_cache::kNone, make_scoped_refptr(runner), NULL, | 274 int rv = simple_backend->Init(cb.callback()); |
| 275 &simple_backend, cb.callback()); | |
| 276 ASSERT_EQ(net::OK, cb.GetResult(rv)); | 275 ASSERT_EQ(net::OK, cb.GetResult(rv)); |
| 277 cache_ = simple_backend; | 276 cache_ = simple_backend; |
| 278 return; | 277 return; |
| 279 } | 278 } |
| 280 | 279 |
| 281 if (mask_) | 280 if (mask_) |
| 282 cache_impl_ = new disk_cache::BackendImpl(cache_path_, mask_, runner, NULL); | 281 cache_impl_ = new disk_cache::BackendImpl(cache_path_, mask_, runner, NULL); |
| 283 else | 282 else |
| 284 cache_impl_ = new disk_cache::BackendImpl(cache_path_, runner, NULL); | 283 cache_impl_ = new disk_cache::BackendImpl(cache_path_, runner, NULL); |
| 285 cache_ = cache_impl_; | 284 cache_ = cache_impl_; |
| 286 ASSERT_TRUE(NULL != cache_); | 285 ASSERT_TRUE(NULL != cache_); |
| 287 if (size_) | 286 if (size_) |
| 288 EXPECT_TRUE(cache_impl_->SetMaxSize(size_)); | 287 EXPECT_TRUE(cache_impl_->SetMaxSize(size_)); |
| 289 if (new_eviction_) | 288 if (new_eviction_) |
| 290 cache_impl_->SetNewEviction(); | 289 cache_impl_->SetNewEviction(); |
| 291 cache_impl_->SetType(type_); | 290 cache_impl_->SetType(type_); |
| 292 cache_impl_->SetFlags(flags); | 291 cache_impl_->SetFlags(flags); |
| 293 net::TestCompletionCallback cb; | 292 net::TestCompletionCallback cb; |
| 294 int rv = cache_impl_->Init(cb.callback()); | 293 int rv = cache_impl_->Init(cb.callback()); |
| 295 ASSERT_EQ(net::OK, cb.GetResult(rv)); | 294 ASSERT_EQ(net::OK, cb.GetResult(rv)); |
| 296 cache_ = cache_impl_; | 295 cache_ = cache_impl_; |
| 297 } | 296 } |
| OLD | NEW |