OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 "remove_tail3", | 111 "remove_tail3", |
112 "remove_load1", | 112 "remove_load1", |
113 "remove_load2", | 113 "remove_load2", |
114 "remove_load3" | 114 "remove_load3" |
115 }; | 115 }; |
116 COMPILE_ASSERT(arraysize(folders) == disk_cache::MAX_CRASH, sync_folders); | 116 COMPILE_ASSERT(arraysize(folders) == disk_cache::MAX_CRASH, sync_folders); |
117 DCHECK(action > disk_cache::NO_CRASH && action < disk_cache::MAX_CRASH); | 117 DCHECK(action > disk_cache::NO_CRASH && action < disk_cache::MAX_CRASH); |
118 | 118 |
119 *full_path = path.AppendASCII(folders[action]); | 119 *full_path = path.AppendASCII(folders[action]); |
120 | 120 |
121 if (file_util::PathExists(*full_path)) | 121 if (base::PathExists(*full_path)) |
122 return false; | 122 return false; |
123 | 123 |
124 return file_util::CreateDirectory(*full_path); | 124 return file_util::CreateDirectory(*full_path); |
125 } | 125 } |
126 | 126 |
127 // Makes sure that any pending task is processed. | 127 // Makes sure that any pending task is processed. |
128 void FlushQueue(disk_cache::Backend* cache) { | 128 void FlushQueue(disk_cache::Backend* cache) { |
129 net::TestCompletionCallback cb; | 129 net::TestCompletionCallback cb; |
130 int rv = | 130 int rv = |
131 reinterpret_cast<disk_cache::BackendImpl*>(cache)->FlushQueueForTest( | 131 reinterpret_cast<disk_cache::BackendImpl*>(cache)->FlushQueueForTest( |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 | 371 |
372 base::FilePath path; | 372 base::FilePath path; |
373 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 373 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
374 path = path.AppendASCII("net"); | 374 path = path.AppendASCII("net"); |
375 path = path.AppendASCII("data"); | 375 path = path.AppendASCII("data"); |
376 path = path.AppendASCII("cache_tests"); | 376 path = path.AppendASCII("cache_tests"); |
377 path = path.AppendASCII("new_crashes"); | 377 path = path.AppendASCII("new_crashes"); |
378 | 378 |
379 return SlaveCode(path, action); | 379 return SlaveCode(path, action); |
380 } | 380 } |
OLD | NEW |