OLD | NEW |
1 // Copyright (c) 2009 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" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 EXPECT_EQ(0, table.CountThreadsRegistered()); | 201 EXPECT_EQ(0, table.CountThreadsRegistered()); |
202 | 202 |
203 // Spin up a set of processes to go bang on the various counters. | 203 // Spin up a set of processes to go bang on the various counters. |
204 // After we join the processes, we'll make sure the counters | 204 // After we join the processes, we'll make sure the counters |
205 // contain the values we expected. | 205 // contain the values we expected. |
206 ProcessHandle procs[kMaxProcs]; | 206 ProcessHandle procs[kMaxProcs]; |
207 | 207 |
208 // Spawn the processes. | 208 // Spawn the processes. |
209 for (int16 index = 0; index < kMaxProcs; index++) { | 209 for (int16 index = 0; index < kMaxProcs; index++) { |
210 procs[index] = this->SpawnChild(L"StatsTableMultipleProcessMain"); | 210 procs[index] = this->SpawnChild(L"StatsTableMultipleProcessMain"); |
211 EXPECT_NE(0, procs[index]); | 211 EXPECT_NE(static_cast<ProcessHandle>(NULL), procs[index]); |
212 } | 212 } |
213 | 213 |
214 // Wait for the processes to finish. | 214 // Wait for the processes to finish. |
215 for (int index = 0; index < kMaxProcs; index++) { | 215 for (int index = 0; index < kMaxProcs; index++) { |
216 EXPECT_TRUE(WaitForSingleProcess(procs[index], 60 * 1000)); | 216 EXPECT_TRUE(WaitForSingleProcess(procs[index], 60 * 1000)); |
217 base::CloseProcessHandle(procs[index]); | 217 base::CloseProcessHandle(procs[index]); |
218 } | 218 } |
219 | 219 |
220 StatsCounter zero_counter(kCounterZero); | 220 StatsCounter zero_counter(kCounterZero); |
221 StatsCounter lucky13_counter(kCounter1313); | 221 StatsCounter lucky13_counter(kCounter1313); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 PlatformThread::Sleep(500); | 398 PlatformThread::Sleep(500); |
399 } | 399 } |
400 EXPECT_LE(1000, table.GetCounterValue("t:foo")); | 400 EXPECT_LE(1000, table.GetCounterValue("t:foo")); |
401 EXPECT_LE(1000, table.GetCounterValue("t:bar")); | 401 EXPECT_LE(1000, table.GetCounterValue("t:bar")); |
402 EXPECT_EQ(2, table.GetCounterValue("c:bar")); | 402 EXPECT_EQ(2, table.GetCounterValue("c:bar")); |
403 | 403 |
404 DeleteShmem(kTableName); | 404 DeleteShmem(kTableName); |
405 } | 405 } |
406 | 406 |
407 } // namespace base | 407 } // namespace base |
OLD | NEW |