OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 DISALLOW_COPY_AND_ASSIGN(ChromeStarter); | 129 DISALLOW_COPY_AND_ASSIGN(ChromeStarter); |
130 }; | 130 }; |
131 | 131 |
132 // Our test fixture that initializes and holds onto a few global vars. | 132 // Our test fixture that initializes and holds onto a few global vars. |
133 class ProcessSingletonTest : public UITest { | 133 class ProcessSingletonTest : public UITest { |
134 public: | 134 public: |
135 ProcessSingletonTest() | 135 ProcessSingletonTest() |
136 // We use a manual reset so that all threads wake up at once when signaled | 136 // We use a manual reset so that all threads wake up at once when signaled |
137 // and thus we must manually reset it for each attempt. | 137 // and thus we must manually reset it for each attempt. |
138 : threads_waker_(true /* manual */, false /* signaled */) { | 138 : threads_waker_(true /* manual */, false /* signaled */) { |
139 temp_profile_dir_.CreateUniqueTempDir(); | 139 EXPECT_TRUE(temp_profile_dir_.CreateUniqueTempDir()); |
140 } | 140 } |
141 | 141 |
142 void SetUp() { | 142 void SetUp() { |
143 // Start the threads and create the starters. | 143 // Start the threads and create the starters. |
144 for (size_t i = 0; i < kNbThreads; ++i) { | 144 for (size_t i = 0; i < kNbThreads; ++i) { |
145 chrome_starter_threads_[i].reset(new base::Thread("ChromeStarter")); | 145 chrome_starter_threads_[i].reset(new base::Thread("ChromeStarter")); |
146 ASSERT_TRUE(chrome_starter_threads_[i]->Start()); | 146 ASSERT_TRUE(chrome_starter_threads_[i]->Start()); |
147 chrome_starters_[i] = new ChromeStarter(action_max_timeout_ms(), | 147 chrome_starters_[i] = new ChromeStarter(action_max_timeout_ms(), |
148 temp_profile_dir_.path()); | 148 temp_profile_dir_.path()); |
149 } | 149 } |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 pending_starters.empty(); | 317 pending_starters.empty(); |
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 } |
325 | 325 |
326 } // namespace | 326 } // namespace |
OLD | NEW |