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

Side by Side Diff: webrtc/base/timeutils_unittest.cc

Issue 2019423006: Adding more detail to MessageQueue::Dispatch logging. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing one more place where RTC_FROM_HERE wasn't used. Created 4 years, 6 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 | « webrtc/base/thread_unittest.cc ('k') | webrtc/base/virtualsocket_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 352
353 Thread worker; 353 Thread worker;
354 worker.Start(); 354 worker.Start();
355 355
356 // Post an event that won't be executed for 10 seconds. 356 // Post an event that won't be executed for 10 seconds.
357 Event message_handler_dispatched(false, false); 357 Event message_handler_dispatched(false, false);
358 auto functor = [&message_handler_dispatched] { 358 auto functor = [&message_handler_dispatched] {
359 message_handler_dispatched.Set(); 359 message_handler_dispatched.Set();
360 }; 360 };
361 FunctorMessageHandler<void, decltype(functor)> handler(functor); 361 FunctorMessageHandler<void, decltype(functor)> handler(functor);
362 worker.PostDelayed(60000, &handler); 362 worker.PostDelayed(RTC_FROM_HERE, 60000, &handler);
363 363
364 // Wait for a bit for the worker thread to be started and enter its socket 364 // Wait for a bit for the worker thread to be started and enter its socket
365 // select(). Otherwise this test would be trivial since the worker thread 365 // select(). Otherwise this test would be trivial since the worker thread
366 // would process the event as soon as it was started. 366 // would process the event as soon as it was started.
367 Thread::Current()->SleepMs(1000); 367 Thread::Current()->SleepMs(1000);
368 368
369 // Advance the fake clock, expecting the worker thread to wake up 369 // Advance the fake clock, expecting the worker thread to wake up
370 // and dispatch the message instantly. 370 // and dispatch the message instantly.
371 clock.AdvanceTime(TimeDelta::FromSeconds(60u)); 371 clock.AdvanceTime(TimeDelta::FromSeconds(60u));
372 EXPECT_TRUE(message_handler_dispatched.Wait(0)); 372 EXPECT_TRUE(message_handler_dispatched.Wait(0));
373 worker.Stop(); 373 worker.Stop();
374 374
375 SetClockForTesting(nullptr); 375 SetClockForTesting(nullptr);
376 376
377 // The message should have been dispatched long before the 60 seconds fully 377 // The message should have been dispatched long before the 60 seconds fully
378 // elapsed (just a sanity check). 378 // elapsed (just a sanity check).
379 int64_t real_end_time_ms = TimeMillis(); 379 int64_t real_end_time_ms = TimeMillis();
380 EXPECT_LT(real_end_time_ms - real_start_time_ms, 10000); 380 EXPECT_LT(real_end_time_ms - real_start_time_ms, 10000);
381 } 381 }
382 382
383 } // namespace rtc 383 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/thread_unittest.cc ('k') | webrtc/base/virtualsocket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698