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