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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 EXPECT_TRUE(temp_profile_dir_.CreateUniqueTempDir()); | 145 EXPECT_TRUE(temp_profile_dir_.CreateUniqueTempDir()); |
146 } | 146 } |
147 | 147 |
148 void SetUp() override { | 148 void SetUp() override { |
149 InProcessBrowserTest::SetUp(); | 149 InProcessBrowserTest::SetUp(); |
150 // Start the threads and create the starters. | 150 // Start the threads and create the starters. |
151 for (size_t i = 0; i < kNbThreads; ++i) { | 151 for (size_t i = 0; i < kNbThreads; ++i) { |
152 chrome_starter_threads_[i].reset(new base::Thread("ChromeStarter")); | 152 chrome_starter_threads_[i].reset(new base::Thread("ChromeStarter")); |
153 ASSERT_TRUE(chrome_starter_threads_[i]->Start()); | 153 ASSERT_TRUE(chrome_starter_threads_[i]->Start()); |
154 chrome_starters_[i] = new ChromeStarter( | 154 chrome_starters_[i] = new ChromeStarter( |
155 TestTimeouts::action_max_timeout(), temp_profile_dir_.path()); | 155 TestTimeouts::action_max_timeout(), temp_profile_dir_.GetPath()); |
156 } | 156 } |
157 } | 157 } |
158 | 158 |
159 void TearDown() override { | 159 void TearDown() override { |
160 // Stop the threads. | 160 // Stop the threads. |
161 for (size_t i = 0; i < kNbThreads; ++i) | 161 for (size_t i = 0; i < kNbThreads; ++i) |
162 chrome_starter_threads_[i]->Stop(); | 162 chrome_starter_threads_[i]->Stop(); |
163 } | 163 } |
164 | 164 |
165 // This method is used to make sure we kill the main browser process after | 165 // This method is used to make sure we kill the main browser process after |
(...skipping 151 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 |