OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // Try to get all threads to launch the app at the same time. | 90 // Try to get all threads to launch the app at the same time. |
91 // So let the test know we are ready. | 91 // So let the test know we are ready. |
92 ready_event_.Signal(); | 92 ready_event_.Signal(); |
93 // And then wait for the test to tell us to GO! | 93 // And then wait for the test to tell us to GO! |
94 ASSERT_NE(static_cast<base::WaitableEvent*>(NULL), start_event); | 94 ASSERT_NE(static_cast<base::WaitableEvent*>(NULL), start_event); |
95 ASSERT_TRUE(start_event->Wait()); | 95 ASSERT_TRUE(start_event->Wait()); |
96 | 96 |
97 // Here we don't wait for the app to be terminated because one of the | 97 // Here we don't wait for the app to be terminated because one of the |
98 // process will stay alive while the others will be restarted. If we would | 98 // process will stay alive while the others will be restarted. If we would |
99 // wait here, we would never get a handle to the main process... | 99 // wait here, we would never get a handle to the main process... |
100 base::LaunchApp(command_line, false /* wait */, | 100 base::LaunchOptions options; |
101 false /* hidden */, &process_handle_); | 101 options.process_handle = &process_handle_; |
| 102 base::LaunchProcess(command_line, options); |
102 ASSERT_NE(base::kNullProcessHandle, process_handle_); | 103 ASSERT_NE(base::kNullProcessHandle, process_handle_); |
103 | 104 |
104 // We can wait on the handle here, we should get stuck on one and only | 105 // We can wait on the handle here, we should get stuck on one and only |
105 // one process. The test below will take care of killing that process | 106 // one process. The test below will take care of killing that process |
106 // to unstuck us once it confirms there is only one. | 107 // to unstuck us once it confirms there is only one. |
107 process_terminated_ = base::WaitForSingleProcess(process_handle_, | 108 process_terminated_ = base::WaitForSingleProcess(process_handle_, |
108 timeout_ms_); | 109 timeout_ms_); |
109 // Let the test know we are done. | 110 // Let the test know we are done. |
110 done_event_.Signal(); | 111 done_event_.Signal(); |
111 } | 112 } |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 pending_starters.empty(); | 319 pending_starters.empty(); |
319 if (chrome_starters_[last_index]->process_handle_ != | 320 if (chrome_starters_[last_index]->process_handle_ != |
320 base::kNullProcessHandle) { | 321 base::kNullProcessHandle) { |
321 KillProcessTree(chrome_starters_[last_index]->process_handle_); | 322 KillProcessTree(chrome_starters_[last_index]->process_handle_); |
322 chrome_starters_[last_index]->done_event_.Wait(); | 323 chrome_starters_[last_index]->done_event_.Wait(); |
323 } | 324 } |
324 } | 325 } |
325 } | 326 } |
326 | 327 |
327 } // namespace | 328 } // namespace |
OLD | NEW |