OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 is a simple application that stress-tests the crash recovery of the disk | 5 // This is a simple application that stress-tests the crash recovery of the disk |
6 // cache. The main application starts a copy of itself on a loop, checking the | 6 // cache. The main application starts a copy of itself on a loop, checking the |
7 // exit code of the child process. When the child dies in an unexpected way, | 7 // exit code of the child process. When the child dies in an unexpected way, |
8 // the main application quits. | 8 // the main application quits. |
9 | 9 |
10 // The child application has two threads: one to exercise the cache in an | 10 // The child application has two threads: one to exercise the cache in an |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 // Starts a new process. | 53 // Starts a new process. |
54 int RunSlave(int iteration) { | 54 int RunSlave(int iteration) { |
55 FilePath exe; | 55 FilePath exe; |
56 PathService::Get(base::FILE_EXE, &exe); | 56 PathService::Get(base::FILE_EXE, &exe); |
57 | 57 |
58 CommandLine cmdline(exe); | 58 CommandLine cmdline(exe); |
59 cmdline.AppendArg(base::IntToString(iteration)); | 59 cmdline.AppendArg(base::IntToString(iteration)); |
60 | 60 |
61 base::ProcessHandle handle; | 61 base::ProcessHandle handle; |
62 if (!base::LaunchApp(cmdline, false, false, &handle)) { | 62 base::LaunchOptions options; |
| 63 options.process_handle = &handle; |
| 64 if (!base::LaunchProcess(cmdline, options)) { |
63 printf("Unable to run test\n"); | 65 printf("Unable to run test\n"); |
64 return kError; | 66 return kError; |
65 } | 67 } |
66 | 68 |
67 int exit_code; | 69 int exit_code; |
68 if (!base::WaitForExitCode(handle, &exit_code)) { | 70 if (!base::WaitForExitCode(handle, &exit_code)) { |
69 printf("Unable to get return code\n"); | 71 printf("Unable to get return code\n"); |
70 return kError; | 72 return kError; |
71 } | 73 } |
72 return exit_code; | 74 return exit_code; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 long int iteration = strtol(argv[1], &end, 0); | 237 long int iteration = strtol(argv[1], &end, 0); |
236 | 238 |
237 if (!StartCrashThread()) { | 239 if (!StartCrashThread()) { |
238 printf("failed to start thread\n"); | 240 printf("failed to start thread\n"); |
239 return kError; | 241 return kError; |
240 } | 242 } |
241 | 243 |
242 StressTheCache(iteration); | 244 StressTheCache(iteration); |
243 return 0; | 245 return 0; |
244 } | 246 } |
OLD | NEW |