OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 test validates that the ProcessSingleton class properly makes sure | 5 // This test validates that the ProcessSingleton class properly makes sure |
6 // that there is only one main browser process. | 6 // that there is only one main browser process. |
7 // | 7 // |
8 // It is currently compiled and run on Windows and Posix(non-Mac) platforms. | 8 // It is currently compiled and run on Windows and Posix(non-Mac) platforms. |
9 // Mac uses system services and ProcessSingletonMac is a noop. (Maybe it still | 9 // Mac uses system services and ProcessSingletonMac is a noop. (Maybe it still |
10 // makes sense to test that the system services are giving the behavior we | 10 // makes sense to test that the system services are giving the behavior we |
11 // want?) | 11 // want?) |
12 | 12 |
13 #include <stddef.h> | 13 #include <stddef.h> |
14 | 14 |
| 15 #include <memory> |
| 16 |
15 #include "base/bind.h" | 17 #include "base/bind.h" |
16 #include "base/command_line.h" | 18 #include "base/command_line.h" |
17 #include "base/files/file_path.h" | 19 #include "base/files/file_path.h" |
18 #include "base/files/scoped_temp_dir.h" | 20 #include "base/files/scoped_temp_dir.h" |
19 #include "base/location.h" | 21 #include "base/location.h" |
20 #include "base/macros.h" | 22 #include "base/macros.h" |
21 #include "base/memory/ref_counted.h" | 23 #include "base/memory/ref_counted.h" |
22 #include "base/memory/scoped_ptr.h" | |
23 #include "base/path_service.h" | 24 #include "base/path_service.h" |
24 #include "base/process/launch.h" | 25 #include "base/process/launch.h" |
25 #include "base/process/process.h" | 26 #include "base/process/process.h" |
26 #include "base/process/process_iterator.h" | 27 #include "base/process/process_iterator.h" |
27 #include "base/single_thread_task_runner.h" | 28 #include "base/single_thread_task_runner.h" |
28 #include "base/synchronization/waitable_event.h" | 29 #include "base/synchronization/waitable_event.h" |
29 #include "base/test/test_timeouts.h" | 30 #include "base/test/test_timeouts.h" |
30 #include "base/threading/thread.h" | 31 #include "base/threading/thread.h" |
31 #include "build/build_config.h" | 32 #include "build/build_config.h" |
32 #include "chrome/common/chrome_constants.h" | 33 #include "chrome/common/chrome_constants.h" |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 // "There can be only one!" :-) | 315 // "There can be only one!" :-) |
315 ASSERT_EQ(static_cast<size_t>(1), pending_starters.size()); | 316 ASSERT_EQ(static_cast<size_t>(1), pending_starters.size()); |
316 size_t last_index = pending_starters.front(); | 317 size_t last_index = pending_starters.front(); |
317 pending_starters.clear(); | 318 pending_starters.clear(); |
318 if (chrome_starters_[last_index]->process_.IsValid()) { | 319 if (chrome_starters_[last_index]->process_.IsValid()) { |
319 KillProcessTree(chrome_starters_[last_index]->process_); | 320 KillProcessTree(chrome_starters_[last_index]->process_); |
320 chrome_starters_[last_index]->done_event_.Wait(); | 321 chrome_starters_[last_index]->done_event_.Wait(); |
321 } | 322 } |
322 } | 323 } |
323 } | 324 } |
OLD | NEW |