| 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> |
| 11 | 11 |
| 12 #include "base/at_exit.h" | 12 #include "base/at_exit.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
| 17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 18 #include "base/process_util.h" | 18 #include "base/process_util.h" |
| 19 #include "base/string_number_conversions.h" | 19 #include "base/string_number_conversions.h" |
| 20 #include "base/string_util.h" | 20 #include "base/string_util.h" |
| 21 #include "base/threading/thread.h" | 21 #include "base/threading/thread.h" |
| 22 #include "base/utf_string_conversions.h" | 22 #include "base/utf_string_conversions.h" |
| 23 #include "net/base/net_api.h" | |
| 24 #include "net/base/net_errors.h" | 23 #include "net/base/net_errors.h" |
| 24 #include "net/base/net_export.h" |
| 25 #include "net/base/test_completion_callback.h" | 25 #include "net/base/test_completion_callback.h" |
| 26 #include "net/disk_cache/backend_impl.h" | 26 #include "net/disk_cache/backend_impl.h" |
| 27 #include "net/disk_cache/disk_cache.h" | 27 #include "net/disk_cache/disk_cache.h" |
| 28 #include "net/disk_cache/disk_cache_test_util.h" | 28 #include "net/disk_cache/disk_cache_test_util.h" |
| 29 #include "net/disk_cache/rankings.h" | 29 #include "net/disk_cache/rankings.h" |
| 30 | 30 |
| 31 using base::Time; | 31 using base::Time; |
| 32 | 32 |
| 33 enum Errors { | 33 enum Errors { |
| 34 GENERIC = -1, | 34 GENERIC = -1, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 if (ALL_GOOD != ret) | 73 if (ALL_GOOD != ret) |
| 74 return ret; | 74 return ret; |
| 75 } | 75 } |
| 76 | 76 |
| 77 return ALL_GOOD; | 77 return ALL_GOOD; |
| 78 } | 78 } |
| 79 | 79 |
| 80 // ----------------------------------------------------------------------- | 80 // ----------------------------------------------------------------------- |
| 81 | 81 |
| 82 namespace disk_cache { | 82 namespace disk_cache { |
| 83 NET_TEST extern RankCrashes g_rankings_crash; | 83 NET_EXPORT_PRIVATE extern RankCrashes g_rankings_crash; |
| 84 } | 84 } |
| 85 | 85 |
| 86 const char* kCrashEntryName = "the first key"; | 86 const char* kCrashEntryName = "the first key"; |
| 87 | 87 |
| 88 // Creates the destinaton folder for this run, and returns it on full_path. | 88 // Creates the destinaton folder for this run, and returns it on full_path. |
| 89 bool CreateTargetFolder(const FilePath& path, RankCrashes action, | 89 bool CreateTargetFolder(const FilePath& path, RankCrashes action, |
| 90 FilePath* full_path) { | 90 FilePath* full_path) { |
| 91 const char* folders[] = { | 91 const char* folders[] = { |
| 92 "", | 92 "", |
| 93 "insert_empty1", | 93 "insert_empty1", |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 | 364 |
| 365 FilePath path; | 365 FilePath path; |
| 366 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 366 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
| 367 path = path.AppendASCII("net"); | 367 path = path.AppendASCII("net"); |
| 368 path = path.AppendASCII("data"); | 368 path = path.AppendASCII("data"); |
| 369 path = path.AppendASCII("cache_tests"); | 369 path = path.AppendASCII("cache_tests"); |
| 370 path = path.AppendASCII("new_crashes"); | 370 path = path.AppendASCII("new_crashes"); |
| 371 | 371 |
| 372 return SlaveCode(path, action); | 372 return SlaveCode(path, action); |
| 373 } | 373 } |
| OLD | NEW |