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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 for (size_t i = 0; i < kNbThreads; ++i) { | 255 for (size_t i = 0; i < kNbThreads; ++i) { |
256 ASSERT_NE(static_cast<ChromeStarter*>(NULL), chrome_starters_[i].get()); | 256 ASSERT_NE(static_cast<ChromeStarter*>(NULL), chrome_starters_[i].get()); |
257 chrome_starters_[i]->Reset(); | 257 chrome_starters_[i]->Reset(); |
258 | 258 |
259 ASSERT_TRUE(chrome_starter_threads_[i]->IsRunning()); | 259 ASSERT_TRUE(chrome_starter_threads_[i]->IsRunning()); |
260 ASSERT_NE(static_cast<base::MessageLoop*>(NULL), | 260 ASSERT_NE(static_cast<base::MessageLoop*>(NULL), |
261 chrome_starter_threads_[i]->message_loop()); | 261 chrome_starter_threads_[i]->message_loop()); |
262 | 262 |
263 chrome_starter_threads_[i]->task_runner()->PostTask( | 263 chrome_starter_threads_[i]->task_runner()->PostTask( |
264 FROM_HERE, | 264 FROM_HERE, |
265 base::Bind(&ChromeStarter::StartChrome, chrome_starters_[i], | 265 base::BindOnce(&ChromeStarter::StartChrome, chrome_starters_[i], |
266 &threads_waker_, first_run)); | 266 &threads_waker_, first_run)); |
267 } | 267 } |
268 | 268 |
269 // Wait for all the starters to be ready. | 269 // Wait for all the starters to be ready. |
270 // We could replace this loop if we ever implement a WaitAll(). | 270 // We could replace this loop if we ever implement a WaitAll(). |
271 for (size_t i = 0; i < kNbThreads; ++i) { | 271 for (size_t i = 0; i < kNbThreads; ++i) { |
272 SCOPED_TRACE(testing::Message() << "Waiting on thread: " << i << "."); | 272 SCOPED_TRACE(testing::Message() << "Waiting on thread: " << i << "."); |
273 chrome_starters_[i]->ready_event_.Wait(); | 273 chrome_starters_[i]->ready_event_.Wait(); |
274 } | 274 } |
275 // GO! | 275 // GO! |
276 threads_waker_.Signal(); | 276 threads_waker_.Signal(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 // "There can be only one!" :-) | 317 // "There can be only one!" :-) |
318 ASSERT_EQ(static_cast<size_t>(1), pending_starters.size()); | 318 ASSERT_EQ(static_cast<size_t>(1), pending_starters.size()); |
319 size_t last_index = pending_starters.front(); | 319 size_t last_index = pending_starters.front(); |
320 pending_starters.clear(); | 320 pending_starters.clear(); |
321 if (chrome_starters_[last_index]->process_.IsValid()) { | 321 if (chrome_starters_[last_index]->process_.IsValid()) { |
322 KillProcessTree(chrome_starters_[last_index]->process_); | 322 KillProcessTree(chrome_starters_[last_index]->process_); |
323 chrome_starters_[last_index]->done_event_.Wait(); | 323 chrome_starters_[last_index]->done_event_.Wait(); |
324 } | 324 } |
325 } | 325 } |
326 } | 326 } |
OLD | NEW |