OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "base/multiprocess_test.h" | 5 #include "base/multiprocess_test.h" |
6 #include "base/platform_thread.h" | 6 #include "base/platform_thread.h" |
7 #include "base/simple_thread.h" | 7 #include "base/simple_thread.h" |
8 #include "base/shared_memory.h" | 8 #include "base/shared_memory.h" |
9 #include "base/stats_table.h" | 9 #include "base/stats_table.h" |
10 #include "base/stats_counters.h" | 10 #include "base/stats_counters.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 203 |
204 // Spawn the processes. | 204 // Spawn the processes. |
205 for (int16 index = 0; index < kMaxProcs; index++) { | 205 for (int16 index = 0; index < kMaxProcs; index++) { |
206 procs[index] = this->SpawnChild(L"StatsTableMultipleProcessMain"); | 206 procs[index] = this->SpawnChild(L"StatsTableMultipleProcessMain"); |
207 EXPECT_NE(static_cast<ProcessHandle>(NULL), procs[index]); | 207 EXPECT_NE(static_cast<ProcessHandle>(NULL), procs[index]); |
208 } | 208 } |
209 | 209 |
210 // Wait for the processes to finish. | 210 // Wait for the processes to finish. |
211 for (int index = 0; index < kMaxProcs; index++) { | 211 for (int index = 0; index < kMaxProcs; index++) { |
212 EXPECT_TRUE(WaitForSingleProcess(procs[index], 60 * 1000)); | 212 EXPECT_TRUE(WaitForSingleProcess(procs[index], 60 * 1000)); |
| 213 base::CloseProcessHandle(procs[index]); |
213 } | 214 } |
214 | 215 |
215 StatsCounter zero_counter(kCounterZero); | 216 StatsCounter zero_counter(kCounterZero); |
216 StatsCounter lucky13_counter(kCounter1313); | 217 StatsCounter lucky13_counter(kCounter1313); |
217 StatsCounter increment_counter(kCounterIncrement); | 218 StatsCounter increment_counter(kCounterIncrement); |
218 StatsCounter decrement_counter(kCounterDecrement); | 219 StatsCounter decrement_counter(kCounterDecrement); |
219 | 220 |
220 // Verify the various counters are correct. | 221 // Verify the various counters are correct. |
221 std::string name; | 222 std::string name; |
222 name = "c:" + kCounterZero; | 223 name = "c:" + kCounterZero; |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 PlatformThread::Sleep(500); | 394 PlatformThread::Sleep(500); |
394 } | 395 } |
395 EXPECT_LE(1000, table.GetCounterValue("t:foo")); | 396 EXPECT_LE(1000, table.GetCounterValue("t:foo")); |
396 EXPECT_LE(1000, table.GetCounterValue("t:bar")); | 397 EXPECT_LE(1000, table.GetCounterValue("t:bar")); |
397 EXPECT_EQ(2, table.GetCounterValue("c:bar")); | 398 EXPECT_EQ(2, table.GetCounterValue("c:bar")); |
398 | 399 |
399 DeleteShmem(kTableName); | 400 DeleteShmem(kTableName); |
400 } | 401 } |
401 | 402 |
402 } // namespace base | 403 } // namespace base |
OLD | NEW |