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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 "remove_load3" | 116 "remove_load3" |
117 }; | 117 }; |
118 COMPILE_ASSERT(arraysize(folders) == disk_cache::MAX_CRASH, sync_folders); | 118 COMPILE_ASSERT(arraysize(folders) == disk_cache::MAX_CRASH, sync_folders); |
119 DCHECK(action > disk_cache::NO_CRASH && action < disk_cache::MAX_CRASH); | 119 DCHECK(action > disk_cache::NO_CRASH && action < disk_cache::MAX_CRASH); |
120 | 120 |
121 *full_path = path.AppendASCII(folders[action]); | 121 *full_path = path.AppendASCII(folders[action]); |
122 | 122 |
123 if (base::PathExists(*full_path)) | 123 if (base::PathExists(*full_path)) |
124 return false; | 124 return false; |
125 | 125 |
126 return file_util::CreateDirectory(*full_path); | 126 return base::CreateDirectory(*full_path); |
127 } | 127 } |
128 | 128 |
129 // Makes sure that any pending task is processed. | 129 // Makes sure that any pending task is processed. |
130 void FlushQueue(disk_cache::Backend* cache) { | 130 void FlushQueue(disk_cache::Backend* cache) { |
131 net::TestCompletionCallback cb; | 131 net::TestCompletionCallback cb; |
132 int rv = | 132 int rv = |
133 reinterpret_cast<disk_cache::BackendImpl*>(cache)->FlushQueueForTest( | 133 reinterpret_cast<disk_cache::BackendImpl*>(cache)->FlushQueueForTest( |
134 cb.callback()); | 134 cb.callback()); |
135 cb.GetResult(rv); // Ignore the result; | 135 cb.GetResult(rv); // Ignore the result; |
136 } | 136 } |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 | 373 |
374 base::FilePath path; | 374 base::FilePath path; |
375 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 375 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
376 path = path.AppendASCII("net"); | 376 path = path.AppendASCII("net"); |
377 path = path.AppendASCII("data"); | 377 path = path.AppendASCII("data"); |
378 path = path.AppendASCII("cache_tests"); | 378 path = path.AppendASCII("cache_tests"); |
379 path = path.AppendASCII("new_crashes"); | 379 path = path.AppendASCII("new_crashes"); |
380 | 380 |
381 return SlaveCode(path, action); | 381 return SlaveCode(path, action); |
382 } | 382 } |
OLD | NEW |