Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Side by Side Diff: net/disk_cache/stress_cache.cc

Issue 18248: CommandLine API rework (Closed)
Patch Set: fixes Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/views/window.cc ('k') | net/tools/crash_cache/crash_cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 18 matching lines...) Expand all
29 using base::Time; 29 using base::Time;
30 30
31 const int kError = -1; 31 const int kError = -1;
32 const int kExpectedCrash = 100; 32 const int kExpectedCrash = 100;
33 33
34 // Starts a new process. 34 // Starts a new process.
35 int RunSlave(int iteration) { 35 int RunSlave(int iteration) {
36 std::wstring exe; 36 std::wstring exe;
37 PathService::Get(base::FILE_EXE, &exe); 37 PathService::Get(base::FILE_EXE, &exe);
38 38
39 #if defined(OS_WIN) 39 CommandLine cmdline(exe);
40 CommandLine cmdline(StringPrintf(L"%ls %d", exe.c_str(), iteration)); 40 cmdline.AppendLooseValue(ASCIIToWide(IntToString(iteration)));
41 #elif defined(OS_POSIX)
42 std::vector<std::string> cmd_argv;
43 cmd_argv.push_back(WideToUTF8(exe));
44 cmd_argv.push_back(IntToString(iteration));
45 CommandLine cmdline(cmd_argv);
46 #endif
47 41
48 base::ProcessHandle handle; 42 base::ProcessHandle handle;
49 if (!base::LaunchApp(cmdline, false, false, &handle)) { 43 if (!base::LaunchApp(cmdline, false, false, &handle)) {
50 printf("Unable to run test\n"); 44 printf("Unable to run test\n");
51 return kError; 45 return kError;
52 } 46 }
53 47
54 int exit_code; 48 int exit_code;
55 if (!base::WaitForExitCode(handle, &exit_code)) { 49 if (!base::WaitForExitCode(handle, &exit_code)) {
56 printf("Unable to get return code\n"); 50 printf("Unable to get return code\n");
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 195
202 if (!StartCrashThread()) { 196 if (!StartCrashThread()) {
203 printf("failed to start thread\n"); 197 printf("failed to start thread\n");
204 return kError; 198 return kError;
205 } 199 }
206 200
207 StressTheCache(iteration); 201 StressTheCache(iteration);
208 return 0; 202 return 0;
209 } 203 }
210 204
OLDNEW
« no previous file with comments | « chrome/views/window.cc ('k') | net/tools/crash_cache/crash_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698