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 19 matching lines...) Expand all Loading... |
30 bool DiskCacheTest::CopyTestCache(const std::string& name) { | 30 bool DiskCacheTest::CopyTestCache(const std::string& name) { |
31 base::FilePath path; | 31 base::FilePath path; |
32 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 32 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
33 path = path.AppendASCII("net"); | 33 path = path.AppendASCII("net"); |
34 path = path.AppendASCII("data"); | 34 path = path.AppendASCII("data"); |
35 path = path.AppendASCII("cache_tests"); | 35 path = path.AppendASCII("cache_tests"); |
36 path = path.AppendASCII(name); | 36 path = path.AppendASCII(name); |
37 | 37 |
38 if (!CleanupCacheDir()) | 38 if (!CleanupCacheDir()) |
39 return false; | 39 return false; |
40 return file_util::CopyDirectory(path, cache_path_, false); | 40 return base::CopyDirectory(path, cache_path_, false); |
41 } | 41 } |
42 | 42 |
43 bool DiskCacheTest::CleanupCacheDir() { | 43 bool DiskCacheTest::CleanupCacheDir() { |
44 return DeleteCache(cache_path_); | 44 return DeleteCache(cache_path_); |
45 } | 45 } |
46 | 46 |
47 void DiskCacheTest::TearDown() { | 47 void DiskCacheTest::TearDown() { |
48 base::RunLoop().RunUntilIdle(); | 48 base::RunLoop().RunUntilIdle(); |
49 } | 49 } |
50 | 50 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 EXPECT_TRUE(cache_impl_->SetMaxSize(size_)); | 291 EXPECT_TRUE(cache_impl_->SetMaxSize(size_)); |
292 if (new_eviction_) | 292 if (new_eviction_) |
293 cache_impl_->SetNewEviction(); | 293 cache_impl_->SetNewEviction(); |
294 cache_impl_->SetType(type_); | 294 cache_impl_->SetType(type_); |
295 cache_impl_->SetFlags(flags); | 295 cache_impl_->SetFlags(flags); |
296 net::TestCompletionCallback cb; | 296 net::TestCompletionCallback cb; |
297 int rv = cache_impl_->Init(cb.callback()); | 297 int rv = cache_impl_->Init(cb.callback()); |
298 ASSERT_EQ(net::OK, cb.GetResult(rv)); | 298 ASSERT_EQ(net::OK, cb.GetResult(rv)); |
299 cache_ = cache_impl_; | 299 cache_ = cache_impl_; |
300 } | 300 } |
OLD | NEW |