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 |
11 // infinite loop, and another one to asynchronously kill the process. | 11 // infinite loop, and another one to asynchronously kill the process. |
12 | 12 |
13 #include <windows.h> | 13 #include <windows.h> |
14 #include <string> | 14 #include <string> |
15 | 15 |
16 #include "base/at_exit.h" | 16 #include "base/at_exit.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
20 #include "base/string_util.h" | 20 #include "base/string_util.h" |
21 #include "base/thread.h" | 21 #include "base/thread.h" |
22 #include "net/disk_cache/disk_cache.h" | 22 #include "net/disk_cache/disk_cache.h" |
23 #include "net/disk_cache/disk_cache_test_util.h" | 23 #include "net/disk_cache/disk_cache_test_util.h" |
24 | 24 |
| 25 using base::Time; |
| 26 |
25 const int kError = -1; | 27 const int kError = -1; |
26 const int kExpectedCrash = 1000000; | 28 const int kExpectedCrash = 1000000; |
27 | 29 |
28 // Starts a new process. | 30 // Starts a new process. |
29 int RunSlave(int iteration) { | 31 int RunSlave(int iteration) { |
30 std::wstring exe; | 32 std::wstring exe; |
31 PathService::Get(base::FILE_EXE, &exe); | 33 PathService::Get(base::FILE_EXE, &exe); |
32 | 34 |
33 std::wstring command = StringPrintf(L"%ls %d", exe.c_str(), iteration); | 35 std::wstring command = StringPrintf(L"%ls %d", exe.c_str(), iteration); |
34 | 36 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 199 |
198 if (!StartCrashThread()) { | 200 if (!StartCrashThread()) { |
199 printf("failed to start thread\n"); | 201 printf("failed to start thread\n"); |
200 return kError; | 202 return kError; |
201 } | 203 } |
202 | 204 |
203 StressTheCache(iteration); | 205 StressTheCache(iteration); |
204 return 0; | 206 return 0; |
205 } | 207 } |
206 | 208 |
OLD | NEW |