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 22 matching lines...) Expand all Loading... |
33 NOT_REACHED | 33 NOT_REACHED |
34 }; | 34 }; |
35 | 35 |
36 using disk_cache::RankCrashes; | 36 using disk_cache::RankCrashes; |
37 | 37 |
38 // Starts a new process, to generate the files. | 38 // Starts a new process, to generate the files. |
39 int RunSlave(RankCrashes action) { | 39 int RunSlave(RankCrashes action) { |
40 std::wstring exe; | 40 std::wstring exe; |
41 PathService::Get(base::FILE_EXE, &exe); | 41 PathService::Get(base::FILE_EXE, &exe); |
42 | 42 |
43 #if defined(OS_WIN) | 43 CommandLine cmdline(exe); |
44 CommandLine cmdline(StringPrintf(L"%ls %d", exe.c_str(), action)); | 44 cmdline.AppendLooseValue(ASCIIToWide(IntToString(action))); |
45 #elif defined(OS_POSIX) | |
46 std::vector<std::string> cmd_argv; | |
47 cmd_argv.push_back(WideToUTF8(exe)); | |
48 cmd_argv.push_back(IntToString(action)); | |
49 CommandLine cmdline(cmd_argv); | |
50 #endif | |
51 | 45 |
52 base::ProcessHandle handle; | 46 base::ProcessHandle handle; |
53 if (!base::LaunchApp(cmdline, false, false, &handle)) { | 47 if (!base::LaunchApp(cmdline, false, false, &handle)) { |
54 printf("Unable to run test %d\n", action); | 48 printf("Unable to run test %d\n", action); |
55 return GENERIC; | 49 return GENERIC; |
56 } | 50 } |
57 | 51 |
58 int exit_code; | 52 int exit_code; |
59 | 53 |
60 if (!base::WaitForExitCode(handle, &exit_code)) { | 54 if (!base::WaitForExitCode(handle, &exit_code)) { |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 std::wstring path; | 300 std::wstring path; |
307 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 301 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
308 file_util::AppendToPath(&path, L"net"); | 302 file_util::AppendToPath(&path, L"net"); |
309 file_util::AppendToPath(&path, L"data"); | 303 file_util::AppendToPath(&path, L"data"); |
310 file_util::AppendToPath(&path, L"cache_tests"); | 304 file_util::AppendToPath(&path, L"cache_tests"); |
311 file_util::AppendToPath(&path, L"new_crashes"); | 305 file_util::AppendToPath(&path, L"new_crashes"); |
312 | 306 |
313 return SlaveCode(path, action); | 307 return SlaveCode(path, action); |
314 } | 308 } |
315 | 309 |
OLD | NEW |