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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 L"remove_load1", | 104 L"remove_load1", |
105 L"remove_load2", | 105 L"remove_load2", |
106 L"remove_load3" | 106 L"remove_load3" |
107 }; | 107 }; |
108 COMPILE_ASSERT(arraysize(folders) == disk_cache::MAX_CRASH, sync_folders); | 108 COMPILE_ASSERT(arraysize(folders) == disk_cache::MAX_CRASH, sync_folders); |
109 DCHECK(action > disk_cache::NO_CRASH && action < disk_cache::MAX_CRASH); | 109 DCHECK(action > disk_cache::NO_CRASH && action < disk_cache::MAX_CRASH); |
110 | 110 |
111 *full_path = path; | 111 *full_path = path; |
112 file_util::AppendToPath(full_path, folders[action]); | 112 file_util::AppendToPath(full_path, folders[action]); |
113 | 113 |
114 if (file_util::PathExists(FilePath::FromWStringHack(*full_path))) | 114 if (file_util::PathExists(*full_path)) |
115 return false; | 115 return false; |
116 | 116 |
117 return file_util::CreateDirectory(*full_path); | 117 return file_util::CreateDirectory(*full_path); |
118 } | 118 } |
119 | 119 |
120 // Generates the files for an empty and one item cache. | 120 // Generates the files for an empty and one item cache. |
121 int SimpleInsert(const std::wstring& path, RankCrashes action) { | 121 int SimpleInsert(const std::wstring& path, RankCrashes action) { |
122 disk_cache::Backend* cache = disk_cache::CreateCacheBackend(path, false, 0, | 122 disk_cache::Backend* cache = disk_cache::CreateCacheBackend(path, false, 0, |
123 net::DISK_CACHE); | 123 net::DISK_CACHE); |
124 if (!cache || cache->GetEntryCount()) | 124 if (!cache || cache->GetEntryCount()) |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 | 303 |
304 FilePath path; | 304 FilePath path; |
305 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 305 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
306 path = path.AppendASCII("net"); | 306 path = path.AppendASCII("net"); |
307 path = path.AppendASCII("data"); | 307 path = path.AppendASCII("data"); |
308 path = path.AppendASCII("cache_tests"); | 308 path = path.AppendASCII("cache_tests"); |
309 path = path.AppendASCII("new_crashes"); | 309 path = path.AppendASCII("new_crashes"); |
310 | 310 |
311 return SlaveCode(path.ToWStringHack(), action); | 311 return SlaveCode(path.ToWStringHack(), action); |
312 } | 312 } |
OLD | NEW |