| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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_util.h" | 5 #include "net/disk_cache/disk_cache_test_util.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 file->SetLength(4 * 1024 * 1024); | 71 file->SetLength(4 * 1024 * 1024); |
| 72 return true; | 72 return true; |
| 73 } | 73 } |
| 74 | 74 |
| 75 bool DeleteCache(const wchar_t* path) { | 75 bool DeleteCache(const wchar_t* path) { |
| 76 disk_cache::DeleteCache(path, false); | 76 disk_cache::DeleteCache(path, false); |
| 77 return true; | 77 return true; |
| 78 } | 78 } |
| 79 | 79 |
| 80 bool CheckCacheIntegrity(const std::wstring& path, bool new_eviction) { | 80 bool CheckCacheIntegrity(const std::wstring& path, bool new_eviction) { |
| 81 scoped_ptr<disk_cache::BackendImpl> cache(new disk_cache::BackendImpl(path)); | 81 scoped_ptr<disk_cache::BackendImpl> cache(new disk_cache::BackendImpl( |
| 82 FilePath::FromWStringHack(path))); |
| 82 if (!cache.get()) | 83 if (!cache.get()) |
| 83 return false; | 84 return false; |
| 84 if (new_eviction) | 85 if (new_eviction) |
| 85 cache->SetNewEviction(); | 86 cache->SetNewEviction(); |
| 86 cache->SetFlags(disk_cache::kNoRandom); | 87 cache->SetFlags(disk_cache::kNoRandom); |
| 87 if (!cache->Init()) | 88 if (!cache->Init()) |
| 88 return false; | 89 return false; |
| 89 return cache->SelfCheck() >= 0; | 90 return cache->SelfCheck() >= 0; |
| 90 } | 91 } |
| 91 | 92 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } else { | 164 } else { |
| 164 // Not finished yet. See if we have to abort. | 165 // Not finished yet. See if we have to abort. |
| 165 if (last_ == g_cache_tests_received) | 166 if (last_ == g_cache_tests_received) |
| 166 num_iterations_++; | 167 num_iterations_++; |
| 167 else | 168 else |
| 168 last_ = g_cache_tests_received; | 169 last_ = g_cache_tests_received; |
| 169 if (40 == num_iterations_) | 170 if (40 == num_iterations_) |
| 170 MessageLoop::current()->Quit(); | 171 MessageLoop::current()->Quit(); |
| 171 } | 172 } |
| 172 } | 173 } |
| OLD | NEW |