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 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 21 matching lines...) Expand all Loading... |
32 using base::Time; | 32 using base::Time; |
33 | 33 |
34 const int kError = -1; | 34 const int kError = -1; |
35 const int kExpectedCrash = 100; | 35 const int kExpectedCrash = 100; |
36 | 36 |
37 // Starts a new process. | 37 // Starts a new process. |
38 int RunSlave(int iteration) { | 38 int RunSlave(int iteration) { |
39 FilePath exe; | 39 FilePath exe; |
40 PathService::Get(base::FILE_EXE, &exe); | 40 PathService::Get(base::FILE_EXE, &exe); |
41 | 41 |
42 CommandLine cmdline(exe.ToWStringHack()); | 42 CommandLine cmdline(exe); |
43 cmdline.AppendLooseValue(ASCIIToWide(IntToString(iteration))); | 43 cmdline.AppendLooseValue(ASCIIToWide(IntToString(iteration))); |
44 | 44 |
45 base::ProcessHandle handle; | 45 base::ProcessHandle handle; |
46 if (!base::LaunchApp(cmdline, false, false, &handle)) { | 46 if (!base::LaunchApp(cmdline, false, false, &handle)) { |
47 printf("Unable to run test\n"); | 47 printf("Unable to run test\n"); |
48 return kError; | 48 return kError; |
49 } | 49 } |
50 | 50 |
51 int exit_code; | 51 int exit_code; |
52 if (!base::WaitForExitCode(handle, &exit_code)) { | 52 if (!base::WaitForExitCode(handle, &exit_code)) { |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 long int iteration = strtol(argv[1], &end, 0); | 198 long int iteration = strtol(argv[1], &end, 0); |
199 | 199 |
200 if (!StartCrashThread()) { | 200 if (!StartCrashThread()) { |
201 printf("failed to start thread\n"); | 201 printf("failed to start thread\n"); |
202 return kError; | 202 return kError; |
203 } | 203 } |
204 | 204 |
205 StressTheCache(iteration); | 205 StressTheCache(iteration); |
206 return 0; | 206 return 0; |
207 } | 207 } |
OLD | NEW |