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

Side by Side Diff: third_party/tcmalloc/chromium/src/tests/profile-handler_unittest.cc

Issue 1076002: Revert 41938 - Merged third_party/tcmalloc/vendor/src(googleperftools r87) in... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 9 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
OLDNEW
1 // Copyright 2009 Google Inc. All Rights Reserved. 1 // Copyright 2009 Google Inc. All Rights Reserved.
2 // Author: Nabeel Mian (nabeelmian@google.com) 2 // Author: Nabeel Mian (nabeelmian@google.com)
3 // Chris Demetriou (cgd@google.com) 3 // Chris Demetriou (cgd@google.com)
4 // 4 //
5 // This file contains the unit tests for profile-handler.h interface. 5 // This file contains the unit tests for profile-handler.h interface.
6 6
7 #include "config.h" 7 #include "config.h"
8 #include "profile-handler.h" 8 #include "profile-handler.h"
9 9
10 #include <assert.h> 10 #include <assert.h>
11 #include <sys/time.h>
11 #include <pthread.h> 12 #include <pthread.h>
12 #include <sys/time.h>
13 #include <time.h>
14 #include "base/logging.h" 13 #include "base/logging.h"
15 #include "base/simple_mutex.h" 14 #include "base/simple_mutex.h"
16 15
17 // Some helpful macros for the test class 16 // Some helpful macros for the test class
18 #define TEST_F(cls, fn) void cls :: fn() 17 #define TEST_F(cls, fn) void cls :: fn()
19 18
20 namespace { 19 namespace {
21 20
22 // TODO(csilvers): error-checking on the pthreads routines 21 // TODO(csilvers): error-checking on the pthreads routines
23 class Thread { 22 class Thread {
(...skipping 16 matching lines...) Expand all
40 private: 39 private:
41 static void* DoRun(void* cls) { 40 static void* DoRun(void* cls) {
42 ProfileHandlerRegisterThread(); 41 ProfileHandlerRegisterThread();
43 reinterpret_cast<Thread*>(cls)->Run(); 42 reinterpret_cast<Thread*>(cls)->Run();
44 return NULL; 43 return NULL;
45 } 44 }
46 pthread_t thread_; 45 pthread_t thread_;
47 bool joinable_; 46 bool joinable_;
48 }; 47 };
49 48
50 // Sleep interval in nano secs. ITIMER_PROF goes off only afer the specified CPU 49 // Sleep interval in usecs. To ensure a SIGPROF timer interrupt under heavy
51 // time is consumed. Under heavy load this process may no get scheduled in a 50 // load, this is set to a 20x of ProfileHandler timer interval (i.e 100Hz)
52 // timely fashion. Therefore, give enough time (20x of ProfileHandle timer 51 // TODO(nabeelmian) Under very heavy loads, the worker thread may not accumulate
53 // interval 10ms (100Hz)) for this process to accumulate enought CPU time to get 52 // enough cpu usage to get a profile tick.
54 // a profile tick. 53 int kSleepInterval = 200000;
55 int kSleepInterval = 200000000;
56
57 // Sleep interval in nano secs. To ensure that if the timer has expired it is
58 // reset.
59 int kTimerResetInterval = 5000000;
60 54
61 // Whether each thread has separate timers. 55 // Whether each thread has separate timers.
62 static bool timer_separate_ = false; 56 static bool timer_separate_ = false;
63 static int timer_type_ = ITIMER_PROF;
64 static int signal_number_ = SIGPROF;
65
66 // Delays processing by the specified number of nano seconds. 'delay_ns'
67 // must be less than the number of nano seconds in a second (1000000000).
68 void Delay(int delay_ns) {
69 static const int kNumNSecInSecond = 1000000000;
70 EXPECT_LT(delay_ns, kNumNSecInSecond);
71 struct timespec delay = { 0, delay_ns };
72 nanosleep(&delay, 0);
73 }
74 57
75 // Checks whether the profile timer is enabled for the current thread. 58 // Checks whether the profile timer is enabled for the current thread.
76 bool IsTimerEnabled() { 59 bool IsTimerEnabled() {
77 itimerval current_timer; 60 itimerval current_timer;
78 EXPECT_EQ(0, getitimer(timer_type_, &current_timer)); 61 EXPECT_EQ(0, getitimer(ITIMER_PROF, &current_timer));
79 if ((current_timer.it_value.tv_sec == 0) &&
80 (current_timer.it_value.tv_usec != 0)) {
81 // May be the timer has expired. Sleep for a bit and check again.
82 Delay(kTimerResetInterval);
83 EXPECT_EQ(0, getitimer(timer_type_, &current_timer));
84 }
85 return (current_timer.it_value.tv_sec != 0 || 62 return (current_timer.it_value.tv_sec != 0 ||
86 current_timer.it_value.tv_usec != 0); 63 current_timer.it_value.tv_usec != 0);
87 } 64 }
88 65
89 class VirtualTimerGetterThread : public Thread { 66 class VirtualTimerGetterThread : public Thread {
90 public: 67 public:
91 VirtualTimerGetterThread() { 68 VirtualTimerGetterThread() {
92 memset(&virtual_timer_, 0, sizeof virtual_timer_); 69 memset(&virtual_timer_, 0, sizeof virtual_timer_);
93 } 70 }
94 struct itimerval virtual_timer_; 71 struct itimerval virtual_timer_;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 int* counter = static_cast<int*>(tick_counter); 153 int* counter = static_cast<int*>(tick_counter);
177 ++(*counter); 154 ++(*counter);
178 } 155 }
179 156
180 // This class tests the profile-handler.h interface. 157 // This class tests the profile-handler.h interface.
181 class ProfileHandlerTest { 158 class ProfileHandlerTest {
182 protected: 159 protected:
183 160
184 // Determines whether threads have separate timers. 161 // Determines whether threads have separate timers.
185 static void SetUpTestCase() { 162 static void SetUpTestCase() {
186 timer_type_ = (getenv("CPUPROFILE_REALTIME") ? ITIMER_REAL : ITIMER_PROF);
187 signal_number_ = (getenv("CPUPROFILE_REALTIME") ? SIGALRM : SIGPROF);
188
189 timer_separate_ = threads_have_separate_timers(); 163 timer_separate_ = threads_have_separate_timers();
190 Delay(kTimerResetInterval);
191 } 164 }
192 165
193 // Sets up the profile timers and SIGPROF/SIGALRM handler in a known state. 166 // Sets up the profile timers and SIGPROF handler in a known state. It does
194 // It does the following: 167 // the following:
195 // 1. Unregisters all the callbacks, stops the timer (if shared) and 168 // 1. Unregisters all the callbacks, stops the timer (if shared) and
196 // clears out timer_sharing state in the ProfileHandler. This clears 169 // clears out timer_sharing state in the ProfileHandler. This clears
197 // out any state left behind by the previous test or during module 170 // out any state left behind by the previous test or during module
198 // initialization when the test program was started. 171 // initialization when the test program was started.
199 // 2. Spawns two threads which will be registered with the ProfileHandler. 172 // 2. Spawns two threads which will be registered with the ProfileHandler.
200 // At this time ProfileHandler knows if the timers are shared. 173 // At this time ProfileHandler knows if the timers are shared.
201 // 3. Starts a busy worker thread to accumulate CPU usage. 174 // 3. Starts a busy worker thread to accumulate CPU usage.
202 virtual void SetUp() { 175 virtual void SetUp() {
203 // Reset the state of ProfileHandler between each test. This unregisters 176 // Reset the state of ProfileHandler between each test. This unregisters
204 // all callbacks, stops timer (if shared) and clears timer sharing state. 177 // all callbacks, stops timer (if shared) and clears timer sharing state.
205 ProfileHandlerReset(); 178 ProfileHandlerReset();
206 EXPECT_EQ(0, GetCallbackCount()); 179 EXPECT_EQ(GetCallbackCount(), 0);
207 VerifyDisabled(); 180 VerifyDisabled();
208 // ProfileHandler requires at least two threads to be registerd to determine 181 // ProfileHandler requires at least two threads to be registerd to determine
209 // whether timers are shared. 182 // whether timers are shared.
210 RegisterThread(); 183 RegisterThread();
211 RegisterThread(); 184 RegisterThread();
212 // Now that two threads are started, verify that the signal handler is 185 // Now that two threads are started, verify that the signal handler is
213 // disabled and the timers are correctly enabled/disabled. 186 // disabled and the timers are correctly enabled/disabled.
214 VerifyDisabled(); 187 VerifyDisabled();
215 // Start worker to accumulate cpu usage. 188 // Start worker to accumulate cpu usage.
216 StartWorker(); 189 StartWorker();
(...skipping 16 matching lines...) Expand all
233 206
234 // Starts a busy worker thread to accumulate cpu time. There should be only 207 // Starts a busy worker thread to accumulate cpu time. There should be only
235 // one busy worker running. This is required for the case where there are 208 // one busy worker running. This is required for the case where there are
236 // separate timers for each thread. 209 // separate timers for each thread.
237 void StartWorker() { 210 void StartWorker() {
238 busy_worker_ = new BusyThread(); 211 busy_worker_ = new BusyThread();
239 busy_worker_->SetJoinable(true); 212 busy_worker_->SetJoinable(true);
240 busy_worker_->Start(); 213 busy_worker_->Start();
241 // Wait for worker to start up and register with the ProfileHandler. 214 // Wait for worker to start up and register with the ProfileHandler.
242 // TODO(nabeelmian) This may not work under very heavy load. 215 // TODO(nabeelmian) This may not work under very heavy load.
243 Delay(kSleepInterval); 216 usleep(kSleepInterval);
244 } 217 }
245 218
246 // Stops the worker thread. 219 // Stops the worker thread.
247 void StopWorker() { 220 void StopWorker() {
248 busy_worker_->set_stop_work(true); 221 busy_worker_->set_stop_work(true);
249 busy_worker_->Join(); 222 busy_worker_->Join();
250 delete busy_worker_; 223 delete busy_worker_;
251 } 224 }
252 225
253 // Checks whether SIGPROF/SIGALRM signal handler is enabled. 226 // Checks whether SIGPROF signal handler is enabled.
254 bool IsSignalEnabled() { 227 bool IsSignalEnabled() {
255 struct sigaction sa; 228 struct sigaction sa;
256 CHECK_EQ(sigaction(signal_number_, NULL, &sa), 0); 229 CHECK_EQ(sigaction(SIGPROF, NULL, &sa), 0);
257 return ((sa.sa_handler == SIG_IGN) || (sa.sa_handler == SIG_DFL)) ? 230 return ((sa.sa_handler == SIG_IGN) || (sa.sa_handler == SIG_DFL)) ?
258 false : true; 231 false : true;
259 } 232 }
260 233
261 // Gets the number of callbacks registered with the ProfileHandler. 234 // Gets the number of callbacks registered with the ProfileHandler.
262 uint32 GetCallbackCount() { 235 uint32 GetCallbackCount() {
263 ProfileHandlerState state; 236 ProfileHandlerState state;
264 ProfileHandlerGetState(&state); 237 ProfileHandlerGetState(&state);
265 return state.callback_count; 238 return state.callback_count;
266 } 239 }
(...skipping 10 matching lines...) Expand all
277 void VerifyRegistration(const int& tick_counter) { 250 void VerifyRegistration(const int& tick_counter) {
278 // Check the callback count. 251 // Check the callback count.
279 EXPECT_GT(GetCallbackCount(), 0); 252 EXPECT_GT(GetCallbackCount(), 0);
280 // Check that the profile timer is enabled. 253 // Check that the profile timer is enabled.
281 EXPECT_TRUE(IsTimerEnabled()); 254 EXPECT_TRUE(IsTimerEnabled());
282 // Check that the signal handler is enabled. 255 // Check that the signal handler is enabled.
283 EXPECT_TRUE(IsSignalEnabled()); 256 EXPECT_TRUE(IsSignalEnabled());
284 uint64 interrupts_before = GetInterruptCount(); 257 uint64 interrupts_before = GetInterruptCount();
285 // Sleep for a bit and check that tick counter is making progress. 258 // Sleep for a bit and check that tick counter is making progress.
286 int old_tick_count = tick_counter; 259 int old_tick_count = tick_counter;
287 Delay(kSleepInterval); 260 usleep(kSleepInterval);
288 int new_tick_count = tick_counter; 261 int new_tick_count = tick_counter;
289 EXPECT_GT(new_tick_count, old_tick_count); 262 EXPECT_GT(new_tick_count, old_tick_count);
290 uint64 interrupts_after = GetInterruptCount(); 263 uint64 interrupts_after = GetInterruptCount();
291 EXPECT_GT(interrupts_after, interrupts_before); 264 EXPECT_GT(interrupts_after, interrupts_before);
292 } 265 }
293 266
294 // Verifies that a callback is not receiving profile ticks. 267 // Verifies that a callback is not receiving profile ticks.
295 void VerifyUnregistration(const int& tick_counter) { 268 void VerifyUnregistration(const int& tick_counter) {
296 // Sleep for a bit and check that tick counter is not making progress. 269 // Sleep for a bit and check that tick counter is not making progress.
297 int old_tick_count = tick_counter; 270 int old_tick_count = tick_counter;
298 Delay(kSleepInterval); 271 usleep(kSleepInterval);
299 int new_tick_count = tick_counter; 272 int new_tick_count = tick_counter;
300 EXPECT_EQ(old_tick_count, new_tick_count); 273 EXPECT_EQ(new_tick_count, old_tick_count);
301 // If no callbacks, signal handler and shared timer should be disabled. 274 // If no callbacks, signal handler and shared timer should be disabled.
302 if (GetCallbackCount() == 0) { 275 if (GetCallbackCount() == 0) {
303 EXPECT_FALSE(IsSignalEnabled()); 276 EXPECT_FALSE(IsSignalEnabled());
304 if (timer_separate_) { 277 if (timer_separate_) {
305 EXPECT_TRUE(IsTimerEnabled()); 278 EXPECT_TRUE(IsTimerEnabled());
306 } else { 279 } else {
307 EXPECT_FALSE(IsTimerEnabled()); 280 EXPECT_FALSE(IsTimerEnabled());
308 } 281 }
309 } 282 }
310 } 283 }
311 284
312 // Verifies that the SIGPROF/SIGALRM interrupt handler is disabled and the 285 // Verifies that the SIGPROF interrupt handler is disabled and the timer,
313 // timer, if shared, is disabled. Expects the worker to be running. 286 // if shared, is disabled. Expects the worker to be running.
314 void VerifyDisabled() { 287 void VerifyDisabled() {
315 // Check that the signal handler is disabled. 288 // Check that the signal handler is disabled.
316 EXPECT_FALSE(IsSignalEnabled()); 289 EXPECT_FALSE(IsSignalEnabled());
317 // Check that the callback count is 0. 290 // Check that the callback count is 0.
318 EXPECT_EQ(0, GetCallbackCount()); 291 EXPECT_EQ(GetCallbackCount(), 0);
319 // Check that the timer is disabled if shared, enabled otherwise. 292 // Check that the timer is disabled if shared, enabled otherwise.
320 if (timer_separate_) { 293 if (timer_separate_) {
321 EXPECT_TRUE(IsTimerEnabled()); 294 EXPECT_TRUE(IsTimerEnabled());
322 } else { 295 } else {
323 EXPECT_FALSE(IsTimerEnabled()); 296 EXPECT_FALSE(IsTimerEnabled());
324 } 297 }
325 // Verify that the ProfileHandler is not accumulating profile ticks. 298 // Verify that the ProfileHandler is not accumulating profile ticks.
326 uint64 interrupts_before = GetInterruptCount(); 299 uint64 interrupts_before = GetInterruptCount();
327 Delay(kSleepInterval); 300 usleep(kSleepInterval);
328 uint64 interrupts_after = GetInterruptCount(); 301 uint64 interrupts_after = GetInterruptCount();
329 EXPECT_EQ(interrupts_before, interrupts_after); 302 EXPECT_EQ(interrupts_after, interrupts_before);
330 }
331
332 // Registers a callback and waits for kTimerResetInterval for timers to get
333 // reset.
334 ProfileHandlerToken* RegisterCallback(void* callback_arg) {
335 ProfileHandlerToken* token = ProfileHandlerRegisterCallback(
336 TickCounter, callback_arg);
337 Delay(kTimerResetInterval);
338 return token;
339 }
340
341 // Unregisters a callback and waits for kTimerResetInterval for timers to get
342 // reset.
343 void UnregisterCallback(ProfileHandlerToken* token) {
344 ProfileHandlerUnregisterCallback(token);
345 Delay(kTimerResetInterval);
346 } 303 }
347 304
348 // Busy worker thread to accumulate cpu usage. 305 // Busy worker thread to accumulate cpu usage.
349 BusyThread* busy_worker_; 306 BusyThread* busy_worker_;
350 307
351 private: 308 private:
352 // The tests to run 309 // The tests to run
353 void RegisterUnregisterCallback(); 310 void RegisterUnregisterCallback();
354 void MultipleCallbacks(); 311 void MultipleCallbacks();
355 void Reset(); 312 void Reset();
(...skipping 16 matching lines...) Expand all
372 RUN(RegisterCallbackBeforeThread); 329 RUN(RegisterCallbackBeforeThread);
373 printf("Done\n"); 330 printf("Done\n");
374 return 0; 331 return 0;
375 } 332 }
376 }; 333 };
377 334
378 // Verifies ProfileHandlerRegisterCallback and 335 // Verifies ProfileHandlerRegisterCallback and
379 // ProfileHandlerUnregisterCallback. 336 // ProfileHandlerUnregisterCallback.
380 TEST_F(ProfileHandlerTest, RegisterUnregisterCallback) { 337 TEST_F(ProfileHandlerTest, RegisterUnregisterCallback) {
381 int tick_count = 0; 338 int tick_count = 0;
382 ProfileHandlerToken* token = RegisterCallback(&tick_count); 339 ProfileHandlerToken* token = ProfileHandlerRegisterCallback(
340 TickCounter, &tick_count);
383 VerifyRegistration(tick_count); 341 VerifyRegistration(tick_count);
384 UnregisterCallback(token); 342 ProfileHandlerUnregisterCallback(token);
385 VerifyUnregistration(tick_count); 343 VerifyUnregistration(tick_count);
386 } 344 }
387 345
388 // Verifies that multiple callbacks can be registered. 346 // Verifies that multiple callbacks can be registered.
389 TEST_F(ProfileHandlerTest, MultipleCallbacks) { 347 TEST_F(ProfileHandlerTest, MultipleCallbacks) {
390 // Register first callback. 348 // Register first callback.
391 int first_tick_count; 349 int first_tick_count;
392 ProfileHandlerToken* token1 = RegisterCallback(&first_tick_count); 350 ProfileHandlerToken* token1 = ProfileHandlerRegisterCallback(
351 TickCounter, &first_tick_count);
393 // Check that callback was registered correctly. 352 // Check that callback was registered correctly.
394 VerifyRegistration(first_tick_count); 353 VerifyRegistration(first_tick_count);
395 EXPECT_EQ(1, GetCallbackCount()); 354 EXPECT_EQ(GetCallbackCount(), 1);
396 355
397 // Register second callback. 356 // Register second callback.
398 int second_tick_count; 357 int second_tick_count;
399 ProfileHandlerToken* token2 = RegisterCallback(&second_tick_count); 358 ProfileHandlerToken* token2 = ProfileHandlerRegisterCallback(
359 TickCounter, &second_tick_count);
400 // Check that callback was registered correctly. 360 // Check that callback was registered correctly.
401 VerifyRegistration(second_tick_count); 361 VerifyRegistration(second_tick_count);
402 EXPECT_EQ(2, GetCallbackCount()); 362 EXPECT_EQ(GetCallbackCount(), 2);
403 363
404 // Unregister first callback. 364 // Unregister first callback.
405 UnregisterCallback(token1); 365 ProfileHandlerUnregisterCallback(token1);
406 VerifyUnregistration(first_tick_count); 366 VerifyUnregistration(first_tick_count);
407 EXPECT_EQ(1, GetCallbackCount()); 367 EXPECT_EQ(GetCallbackCount(), 1);
408 // Verify that second callback is still registered. 368 // Verify that second callback is still registered.
409 VerifyRegistration(second_tick_count); 369 VerifyRegistration(second_tick_count);
410 370
411 // Unregister second callback. 371 // Unregister second callback.
412 UnregisterCallback(token2); 372 ProfileHandlerUnregisterCallback(token2);
413 VerifyUnregistration(second_tick_count); 373 VerifyUnregistration(second_tick_count);
414 EXPECT_EQ(0, GetCallbackCount()); 374 EXPECT_EQ(GetCallbackCount(), 0);
415 375
416 // Verify that the signal handler and timers are correctly disabled. 376 // Verify that the signal handler and timers are correctly disabled.
417 VerifyDisabled(); 377 VerifyDisabled();
418 } 378 }
419 379
420 // Verifies ProfileHandlerReset 380 // Verifies ProfileHandlerReset
421 TEST_F(ProfileHandlerTest, Reset) { 381 TEST_F(ProfileHandlerTest, Reset) {
422 // Verify that the profile timer interrupt is disabled. 382 // Verify that the profile timer interrupt is disabled.
423 VerifyDisabled(); 383 VerifyDisabled();
424 int first_tick_count; 384 int first_tick_count;
425 RegisterCallback(&first_tick_count); 385 ProfileHandlerRegisterCallback(TickCounter, &first_tick_count);
426 VerifyRegistration(first_tick_count); 386 VerifyRegistration(first_tick_count);
427 EXPECT_EQ(1, GetCallbackCount()); 387 EXPECT_EQ(GetCallbackCount(), 1);
428 388
429 // Register second callback. 389 // Register second callback.
430 int second_tick_count; 390 int second_tick_count;
431 RegisterCallback(&second_tick_count); 391 ProfileHandlerRegisterCallback(TickCounter, &second_tick_count);
432 VerifyRegistration(second_tick_count); 392 VerifyRegistration(second_tick_count);
433 EXPECT_EQ(2, GetCallbackCount()); 393 EXPECT_EQ(GetCallbackCount(), 2);
434 394
435 // Reset the profile handler and verify that callback were correctly 395 // Reset the profile handler and verify that callback were correctly
436 // unregistered and timer/signal are disabled. 396 // unregistered and timer/signal are disabled.
437 ProfileHandlerReset(); 397 ProfileHandlerReset();
438 VerifyUnregistration(first_tick_count); 398 VerifyUnregistration(first_tick_count);
439 VerifyUnregistration(second_tick_count); 399 VerifyUnregistration(second_tick_count);
440 VerifyDisabled(); 400 VerifyDisabled();
441 } 401 }
442 402
443 // Verifies that ProfileHandler correctly handles a case where a callback was 403 // Verifies that ProfileHandler correctly handles a case where a callback was
444 // registered before the second thread started. 404 // registered before the second thread started.
445 TEST_F(ProfileHandlerTest, RegisterCallbackBeforeThread) { 405 TEST_F(ProfileHandlerTest, RegisterCallbackBeforeThread) {
446 // Stop the worker. 406 // Stop the worker.
447 StopWorker(); 407 StopWorker();
448 // Unregister all existing callbacks, stop the timer (if shared), disable 408 // Unregister all existing callbacks, stop the timer (if shared), disable
449 // the signal handler and reset the timer sharing state in the Profile 409 // the signal handler and reset the timer sharing state in the Profile
450 // Handler. 410 // Handler.
451 ProfileHandlerReset(); 411 ProfileHandlerReset();
452 EXPECT_EQ(0, GetCallbackCount()); 412 EXPECT_EQ(GetCallbackCount(), 0);
453 VerifyDisabled(); 413 VerifyDisabled();
454 414
455 // Start the worker. At this time ProfileHandler doesn't know if timers are 415 // Start the worker. At this time ProfileHandler doesn't know if timers are
456 // shared as only one thread has registered so far. 416 // shared as only one thread has registered so far.
457 StartWorker(); 417 StartWorker();
458 // Register a callback and check that profile ticks are being delivered. 418 // Register a callback and check that profile ticks are being delivered.
459 int tick_count; 419 int tick_count;
460 RegisterCallback(&tick_count); 420 ProfileHandlerRegisterCallback(TickCounter, &tick_count);
461 EXPECT_EQ(1, GetCallbackCount()); 421 EXPECT_EQ(GetCallbackCount(), 1);
462 VerifyRegistration(tick_count); 422 VerifyRegistration(tick_count);
463 423
464 // Register a second thread and verify that timer and signal handler are 424 // Register a second thread and verify that timer and signal handler are
465 // correctly enabled. 425 // correctly enabled.
466 RegisterThread(); 426 RegisterThread();
467 EXPECT_EQ(1, GetCallbackCount()); 427 EXPECT_EQ(GetCallbackCount(), 1);
468 EXPECT_TRUE(IsTimerEnabled()); 428 EXPECT_TRUE(IsTimerEnabled());
469 EXPECT_TRUE(IsSignalEnabled()); 429 EXPECT_TRUE(IsSignalEnabled());
470 } 430 }
471 431
472 } // namespace 432 } // namespace
473 433
474 int main(int argc, char** argv) { 434 int main(int argc, char** argv) {
475 return ProfileHandlerTest::RUN_ALL_TESTS(); 435 return ProfileHandlerTest::RUN_ALL_TESTS();
476 } 436 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698