| 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 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 bool first_run = attempt % 2; | 246 bool first_run = attempt % 2; |
| 247 #endif | 247 #endif |
| 248 | 248 |
| 249 // Here we prime all the threads with a ChromeStarter that will wait for | 249 // Here we prime all the threads with a ChromeStarter that will wait for |
| 250 // our signal to launch its chrome process. | 250 // our signal to launch its chrome process. |
| 251 for (size_t i = 0; i < kNbThreads; ++i) { | 251 for (size_t i = 0; i < kNbThreads; ++i) { |
| 252 ASSERT_NE(static_cast<ChromeStarter*>(NULL), chrome_starters_[i].get()); | 252 ASSERT_NE(static_cast<ChromeStarter*>(NULL), chrome_starters_[i].get()); |
| 253 chrome_starters_[i]->Reset(); | 253 chrome_starters_[i]->Reset(); |
| 254 | 254 |
| 255 ASSERT_TRUE(chrome_starter_threads_[i]->IsRunning()); | 255 ASSERT_TRUE(chrome_starter_threads_[i]->IsRunning()); |
| 256 ASSERT_NE(static_cast<MessageLoop*>(NULL), | 256 ASSERT_NE(static_cast<base::MessageLoop*>(NULL), |
| 257 chrome_starter_threads_[i]->message_loop()); | 257 chrome_starter_threads_[i]->message_loop()); |
| 258 | 258 |
| 259 chrome_starter_threads_[i]->message_loop()->PostTask( | 259 chrome_starter_threads_[i]->message_loop()->PostTask( |
| 260 FROM_HERE, base::Bind(&ChromeStarter::StartChrome, | 260 FROM_HERE, base::Bind(&ChromeStarter::StartChrome, |
| 261 chrome_starters_[i].get(), | 261 chrome_starters_[i].get(), |
| 262 &threads_waker_, | 262 &threads_waker_, |
| 263 first_run)); | 263 first_run)); |
| 264 } | 264 } |
| 265 | 265 |
| 266 // Wait for all the starters to be ready. | 266 // Wait for all the starters to be ready. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 ASSERT_EQ(static_cast<size_t>(1), pending_starters.size()); | 316 ASSERT_EQ(static_cast<size_t>(1), pending_starters.size()); |
| 317 size_t last_index = pending_starters.front(); | 317 size_t last_index = pending_starters.front(); |
| 318 pending_starters.clear(); | 318 pending_starters.clear(); |
| 319 if (chrome_starters_[last_index]->process_handle_ != | 319 if (chrome_starters_[last_index]->process_handle_ != |
| 320 base::kNullProcessHandle) { | 320 base::kNullProcessHandle) { |
| 321 KillProcessTree(chrome_starters_[last_index]->process_handle_); | 321 KillProcessTree(chrome_starters_[last_index]->process_handle_); |
| 322 chrome_starters_[last_index]->done_event_.Wait(); | 322 chrome_starters_[last_index]->done_event_.Wait(); |
| 323 } | 323 } |
| 324 } | 324 } |
| 325 } | 325 } |
| OLD | NEW |