| 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/files/file_util.h" | 7 #include "base/files/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 "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 runner = thread->task_runner(); | 301 runner = thread->task_runner(); |
| 302 | 302 |
| 303 if (simple_cache_mode_) { | 303 if (simple_cache_mode_) { |
| 304 net::TestCompletionCallback cb; | 304 net::TestCompletionCallback cb; |
| 305 scoped_ptr<disk_cache::SimpleBackendImpl> simple_backend( | 305 scoped_ptr<disk_cache::SimpleBackendImpl> simple_backend( |
| 306 new disk_cache::SimpleBackendImpl( | 306 new disk_cache::SimpleBackendImpl( |
| 307 cache_path_, size_, type_, runner, NULL)); | 307 cache_path_, size_, type_, runner, NULL)); |
| 308 int rv = simple_backend->Init(cb.callback()); | 308 int rv = simple_backend->Init(cb.callback()); |
| 309 ASSERT_EQ(net::OK, cb.GetResult(rv)); | 309 ASSERT_EQ(net::OK, cb.GetResult(rv)); |
| 310 simple_cache_impl_ = simple_backend.get(); | 310 simple_cache_impl_ = simple_backend.get(); |
| 311 cache_ = simple_backend.PassAs<disk_cache::Backend>(); | 311 cache_ = simple_backend.Pass(); |
| 312 if (simple_cache_wait_for_index_) { | 312 if (simple_cache_wait_for_index_) { |
| 313 net::TestCompletionCallback wait_for_index_cb; | 313 net::TestCompletionCallback wait_for_index_cb; |
| 314 rv = simple_cache_impl_->index()->ExecuteWhenReady( | 314 rv = simple_cache_impl_->index()->ExecuteWhenReady( |
| 315 wait_for_index_cb.callback()); | 315 wait_for_index_cb.callback()); |
| 316 ASSERT_EQ(net::OK, wait_for_index_cb.GetResult(rv)); | 316 ASSERT_EQ(net::OK, wait_for_index_cb.GetResult(rv)); |
| 317 } | 317 } |
| 318 return; | 318 return; |
| 319 } | 319 } |
| 320 | 320 |
| 321 if (mask_) | 321 if (mask_) |
| 322 cache_impl_ = new disk_cache::BackendImpl(cache_path_, mask_, runner, NULL); | 322 cache_impl_ = new disk_cache::BackendImpl(cache_path_, mask_, runner, NULL); |
| 323 else | 323 else |
| 324 cache_impl_ = new disk_cache::BackendImpl(cache_path_, runner, NULL); | 324 cache_impl_ = new disk_cache::BackendImpl(cache_path_, runner, NULL); |
| 325 cache_.reset(cache_impl_); | 325 cache_.reset(cache_impl_); |
| 326 ASSERT_TRUE(cache_); | 326 ASSERT_TRUE(cache_); |
| 327 if (size_) | 327 if (size_) |
| 328 EXPECT_TRUE(cache_impl_->SetMaxSize(size_)); | 328 EXPECT_TRUE(cache_impl_->SetMaxSize(size_)); |
| 329 if (new_eviction_) | 329 if (new_eviction_) |
| 330 cache_impl_->SetNewEviction(); | 330 cache_impl_->SetNewEviction(); |
| 331 cache_impl_->SetType(type_); | 331 cache_impl_->SetType(type_); |
| 332 cache_impl_->SetFlags(flags); | 332 cache_impl_->SetFlags(flags); |
| 333 net::TestCompletionCallback cb; | 333 net::TestCompletionCallback cb; |
| 334 int rv = cache_impl_->Init(cb.callback()); | 334 int rv = cache_impl_->Init(cb.callback()); |
| 335 ASSERT_EQ(net::OK, cb.GetResult(rv)); | 335 ASSERT_EQ(net::OK, cb.GetResult(rv)); |
| 336 } | 336 } |
| OLD | NEW |