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 "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
11 #include "net/base/test_completion_callback.h" | 11 #include "net/base/test_completion_callback.h" |
12 #include "net/disk_cache/backend_impl.h" | 12 #include "net/disk_cache/backend_impl.h" |
13 #include "net/disk_cache/disk_cache_test_util.h" | 13 #include "net/disk_cache/disk_cache_test_util.h" |
14 #include "net/disk_cache/mem_backend_impl.h" | 14 #include "net/disk_cache/mem_backend_impl.h" |
15 | 15 |
16 DiskCacheTest::DiskCacheTest() { | 16 DiskCacheTest::DiskCacheTest() { |
17 cache_path_ = GetCacheFilePath(); | 17 CHECK(temp_dir_.CreateUniqueTempDir()); |
| 18 cache_path_ = temp_dir_.path(); |
18 if (!MessageLoop::current()) | 19 if (!MessageLoop::current()) |
19 message_loop_.reset(new MessageLoopForIO()); | 20 message_loop_.reset(new MessageLoopForIO()); |
20 } | 21 } |
21 | 22 |
22 DiskCacheTest::~DiskCacheTest() { | 23 DiskCacheTest::~DiskCacheTest() { |
23 } | 24 } |
24 | 25 |
25 bool DiskCacheTest::CopyTestCache(const std::string& name) { | 26 bool DiskCacheTest::CopyTestCache(const std::string& name) { |
26 FilePath path; | 27 FilePath path; |
27 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 28 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 291 |
291 if (new_eviction_) | 292 if (new_eviction_) |
292 cache_impl_->SetNewEviction(); | 293 cache_impl_->SetNewEviction(); |
293 | 294 |
294 cache_impl_->SetType(type_); | 295 cache_impl_->SetType(type_); |
295 cache_impl_->SetFlags(disk_cache::kNoRandom); | 296 cache_impl_->SetFlags(disk_cache::kNoRandom); |
296 net::TestCompletionCallback cb; | 297 net::TestCompletionCallback cb; |
297 int rv = cache_impl_->Init(cb.callback()); | 298 int rv = cache_impl_->Init(cb.callback()); |
298 ASSERT_EQ(net::OK, cb.GetResult(rv)); | 299 ASSERT_EQ(net::OK, cb.GetResult(rv)); |
299 } | 300 } |
OLD | NEW |