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::LaunchOptions options; | 100 base::LaunchProcess(command_line, base::LaunchOptions(), &process_handle_); |
101 options.process_handle = &process_handle_; | |
102 base::LaunchProcess(command_line, options); | |
103 ASSERT_NE(base::kNullProcessHandle, process_handle_); | 101 ASSERT_NE(base::kNullProcessHandle, process_handle_); |
104 | 102 |
105 // We can wait on the handle here, we should get stuck on one and only | 103 // We can wait on the handle here, we should get stuck on one and only |
106 // one process. The test below will take care of killing that process | 104 // one process. The test below will take care of killing that process |
107 // to unstuck us once it confirms there is only one. | 105 // to unstuck us once it confirms there is only one. |
108 process_terminated_ = base::WaitForSingleProcess(process_handle_, | 106 process_terminated_ = base::WaitForSingleProcess(process_handle_, |
109 timeout_ms_); | 107 timeout_ms_); |
110 // Let the test know we are done. | 108 // Let the test know we are done. |
111 done_event_.Signal(); | 109 done_event_.Signal(); |
112 } | 110 } |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 pending_starters.empty(); | 317 pending_starters.empty(); |
320 if (chrome_starters_[last_index]->process_handle_ != | 318 if (chrome_starters_[last_index]->process_handle_ != |
321 base::kNullProcessHandle) { | 319 base::kNullProcessHandle) { |
322 KillProcessTree(chrome_starters_[last_index]->process_handle_); | 320 KillProcessTree(chrome_starters_[last_index]->process_handle_); |
323 chrome_starters_[last_index]->done_event_.Wait(); | 321 chrome_starters_[last_index]->done_event_.Wait(); |
324 } | 322 } |
325 } | 323 } |
326 } | 324 } |
327 | 325 |
328 } // namespace | 326 } // namespace |
OLD | NEW |