Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: base/stats_table_unittest.cc

Issue 3035062: Revert 55400 - Cleanup in base. This moves the implementation (and a bunch of... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/shared_memory_unittest.cc ('k') | base/test/multiprocess_test.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #if defined(OS_WIN) 5 #if defined(OS_WIN)
6 #include <process.h> 6 #include <process.h>
7 #include <windows.h> 7 #include <windows.h>
8 #endif 8 #endif
9 9
10 #include "base/multiprocess_test.h"
10 #include "base/platform_thread.h" 11 #include "base/platform_thread.h"
11 #include "base/simple_thread.h" 12 #include "base/simple_thread.h"
12 #include "base/shared_memory.h" 13 #include "base/shared_memory.h"
13 #include "base/stats_table.h" 14 #include "base/stats_table.h"
14 #include "base/stats_counters.h" 15 #include "base/stats_counters.h"
15 #include "base/string_piece.h"
16 #include "base/string_util.h"
17 #include "base/test/multiprocess_test.h"
18 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
19 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
20 #include "testing/multiprocess_func_list.h" 18 #include "testing/multiprocess_func_list.h"
21 19
22 namespace base { 20 namespace base {
23 21
24 class StatsTableTest : public MultiProcessTest { 22 class StatsTableTest : public MultiProcessTest {
25 public: 23 public:
26 void DeleteShmem(std::string name) { 24 void DeleteShmem(std::string name) {
27 base::SharedMemory mem; 25 base::SharedMemory mem;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 StatsTable::set_current(&table); 197 StatsTable::set_current(&table);
200 EXPECT_EQ(0, table.CountThreadsRegistered()); 198 EXPECT_EQ(0, table.CountThreadsRegistered());
201 199
202 // Spin up a set of processes to go bang on the various counters. 200 // Spin up a set of processes to go bang on the various counters.
203 // After we join the processes, we'll make sure the counters 201 // After we join the processes, we'll make sure the counters
204 // contain the values we expected. 202 // contain the values we expected.
205 ProcessHandle procs[kMaxProcs]; 203 ProcessHandle procs[kMaxProcs];
206 204
207 // Spawn the processes. 205 // Spawn the processes.
208 for (int16 index = 0; index < kMaxProcs; index++) { 206 for (int16 index = 0; index < kMaxProcs; index++) {
209 procs[index] = this->SpawnChild("StatsTableMultipleProcessMain", false); 207 procs[index] = this->SpawnChild("StatsTableMultipleProcessMain");
210 EXPECT_NE(base::kNullProcessHandle, procs[index]); 208 EXPECT_NE(base::kNullProcessHandle, procs[index]);
211 } 209 }
212 210
213 // Wait for the processes to finish. 211 // Wait for the processes to finish.
214 for (int index = 0; index < kMaxProcs; index++) { 212 for (int index = 0; index < kMaxProcs; index++) {
215 EXPECT_TRUE(WaitForSingleProcess(procs[index], 60 * 1000)); 213 EXPECT_TRUE(WaitForSingleProcess(procs[index], 60 * 1000));
216 base::CloseProcessHandle(procs[index]); 214 base::CloseProcessHandle(procs[index]);
217 } 215 }
218 216
219 StatsCounter zero_counter(kCounterZero); 217 StatsCounter zero_counter(kCounterZero);
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 PlatformThread::Sleep(500); 395 PlatformThread::Sleep(500);
398 } 396 }
399 EXPECT_LE(1000, table.GetCounterValue("t:foo")); 397 EXPECT_LE(1000, table.GetCounterValue("t:foo"));
400 EXPECT_LE(1000, table.GetCounterValue("t:bar")); 398 EXPECT_LE(1000, table.GetCounterValue("t:bar"));
401 EXPECT_EQ(2, table.GetCounterValue("c:bar")); 399 EXPECT_EQ(2, table.GetCounterValue("c:bar"));
402 400
403 DeleteShmem(kTableName); 401 DeleteShmem(kTableName);
404 } 402 }
405 403
406 } // namespace base 404 } // namespace base
OLDNEW
« no previous file with comments | « base/shared_memory_unittest.cc ('k') | base/test/multiprocess_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698