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

Side by Side Diff: base/stats_table_unittest.cc

Issue 2022003: Disable StatsTableTest.MultipleThreads (Closed)
Patch Set: Created 10 years, 7 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
« no previous file with comments | « no previous file | no next file » | 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/multiprocess_test.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 decrement_counter.Decrement(); 101 decrement_counter.Decrement();
102 if (id_ % 2) 102 if (id_ % 2)
103 mixed_counter.Decrement(); 103 mixed_counter.Decrement();
104 else 104 else
105 mixed_counter.Increment(); 105 mixed_counter.Increment();
106 PlatformThread::Sleep(index % 10); // short wait 106 PlatformThread::Sleep(index % 10); // short wait
107 } 107 }
108 } 108 }
109 109
110 // Create a few threads and have them poke on their counters. 110 // Create a few threads and have them poke on their counters.
111 // Currently disabled. See bug report below: 111 // Disabled, http://crbug.com/10611.
112 // TODO(maruel): http://crbug.com/10611 112 TEST_F(StatsTableTest, DISABLED_MultipleThreads) {
113 TEST_F(StatsTableTest, MultipleThreads) {
114 #if 0
115 // Create a stats table. 113 // Create a stats table.
116 const std::string kTableName = "MultipleThreadStatTable"; 114 const std::string kTableName = "MultipleThreadStatTable";
117 const int kMaxThreads = 20; 115 const int kMaxThreads = 20;
118 const int kMaxCounter = 5; 116 const int kMaxCounter = 5;
119 DeleteShmem(kTableName); 117 DeleteShmem(kTableName);
120 StatsTable table(kTableName, kMaxThreads, kMaxCounter); 118 StatsTable table(kTableName, kMaxThreads, kMaxCounter);
121 StatsTable::set_current(&table); 119 StatsTable::set_current(&table);
122 120
123 EXPECT_EQ(0, table.CountThreadsRegistered()); 121 EXPECT_EQ(0, table.CountThreadsRegistered());
124 122
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 table.GetCounterValue(name)); 155 table.GetCounterValue(name));
158 name = "c:" + kCounterDecrement; 156 name = "c:" + kCounterDecrement;
159 EXPECT_EQ(-kMaxThreads * kThreadLoops, 157 EXPECT_EQ(-kMaxThreads * kThreadLoops,
160 table.GetCounterValue(name)); 158 table.GetCounterValue(name));
161 name = "c:" + kCounterMixed; 159 name = "c:" + kCounterMixed;
162 EXPECT_EQ((kMaxThreads % 2) * kThreadLoops, 160 EXPECT_EQ((kMaxThreads % 2) * kThreadLoops,
163 table.GetCounterValue(name)); 161 table.GetCounterValue(name));
164 EXPECT_EQ(0, table.CountThreadsRegistered()); 162 EXPECT_EQ(0, table.CountThreadsRegistered());
165 163
166 DeleteShmem(kTableName); 164 DeleteShmem(kTableName);
167 #endif
168 } 165 }
169 166
170 const std::string kMPTableName = "MultipleProcessStatTable"; 167 const std::string kMPTableName = "MultipleProcessStatTable";
171 168
172 MULTIPROCESS_TEST_MAIN(StatsTableMultipleProcessMain) { 169 MULTIPROCESS_TEST_MAIN(StatsTableMultipleProcessMain) {
173 // Each process will open the shared memory and set counters 170 // Each process will open the shared memory and set counters
174 // concurrently in a loop. We'll use some pauses to 171 // concurrently in a loop. We'll use some pauses to
175 // mixup the scheduling. 172 // mixup the scheduling.
176 173
177 StatsTable table(kMPTableName, 0, 0); 174 StatsTable table(kMPTableName, 0, 0);
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 PlatformThread::Sleep(500); 395 PlatformThread::Sleep(500);
399 } 396 }
400 EXPECT_LE(1000, table.GetCounterValue("t:foo")); 397 EXPECT_LE(1000, table.GetCounterValue("t:foo"));
401 EXPECT_LE(1000, table.GetCounterValue("t:bar")); 398 EXPECT_LE(1000, table.GetCounterValue("t:bar"));
402 EXPECT_EQ(2, table.GetCounterValue("c:bar")); 399 EXPECT_EQ(2, table.GetCounterValue("c:bar"));
403 400
404 DeleteShmem(kTableName); 401 DeleteShmem(kTableName);
405 } 402 }
406 403
407 } // namespace base 404 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698