| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // This command-line program generates the set of files needed for the crash- | 5 // This command-line program generates the set of files needed for the crash- |
| 6 // cache unit tests (DiskCacheTest,CacheBackend_Recover*). This program only | 6 // cache unit tests (DiskCacheTest,CacheBackend_Recover*). This program only |
| 7 // works properly on debug mode, because the crash functionality is not compiled | 7 // works properly on debug mode, because the crash functionality is not compiled |
| 8 // on release builds of the cache. | 8 // on release builds of the cache. |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 entry->Close(); | 207 entry->Close(); |
| 208 | 208 |
| 209 return NOT_REACHED; | 209 return NOT_REACHED; |
| 210 } | 210 } |
| 211 | 211 |
| 212 // Generates the files for insertion and removals on heavy loaded caches. | 212 // Generates the files for insertion and removals on heavy loaded caches. |
| 213 int LoadOperations(const std::wstring& path, RankCrashes action) { | 213 int LoadOperations(const std::wstring& path, RankCrashes action) { |
| 214 DCHECK(action >= disk_cache::INSERT_LOAD_1); | 214 DCHECK(action >= disk_cache::INSERT_LOAD_1); |
| 215 | 215 |
| 216 // Work with a tiny index table (16 entries) | 216 // Work with a tiny index table (16 entries) |
| 217 disk_cache::BackendImpl* cache = new disk_cache::BackendImpl(path, 0xf); | 217 disk_cache::BackendImpl* cache = |
| 218 new disk_cache::BackendImpl(FilePath::FromWStringHack(path), 0xf); |
| 218 if (!cache || !cache->SetMaxSize(0x100000) || !cache->Init() || | 219 if (!cache || !cache->SetMaxSize(0x100000) || !cache->Init() || |
| 219 cache->GetEntryCount()) | 220 cache->GetEntryCount()) |
| 220 return GENERIC; | 221 return GENERIC; |
| 221 | 222 |
| 222 int seed = static_cast<int>(Time::Now().ToInternalValue()); | 223 int seed = static_cast<int>(Time::Now().ToInternalValue()); |
| 223 srand(seed); | 224 srand(seed); |
| 224 | 225 |
| 225 disk_cache::Entry* entry; | 226 disk_cache::Entry* entry; |
| 226 for (int i = 0; i < 100; i++) { | 227 for (int i = 0; i < 100; i++) { |
| 227 std::string key = GenerateKey(true); | 228 std::string key = GenerateKey(true); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 | 303 |
| 303 FilePath path; | 304 FilePath path; |
| 304 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 305 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
| 305 path = path.AppendASCII("net"); | 306 path = path.AppendASCII("net"); |
| 306 path = path.AppendASCII("data"); | 307 path = path.AppendASCII("data"); |
| 307 path = path.AppendASCII("cache_tests"); | 308 path = path.AppendASCII("cache_tests"); |
| 308 path = path.AppendASCII("new_crashes"); | 309 path = path.AppendASCII("new_crashes"); |
| 309 | 310 |
| 310 return SlaveCode(path.ToWStringHack(), action); | 311 return SlaveCode(path.ToWStringHack(), action); |
| 311 } | 312 } |
| OLD | NEW |