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

Issue 1895933003: Adding the ability to use a simulated clock for unit tests. (Closed)

Created:
4 years, 8 months ago by Taylor Brandstetter
Modified:
4 years, 6 months ago
Reviewers:
pthatcher1
CC:
webrtc-reviews_webrtc.org, tterriberry_mozilla.com
Base URL:
https://chromium.googlesource.com/external/webrtc.git@master
Target Ref:
refs/pending/heads/master
Project:
webrtc
Visibility:
Public.

Description

Adding the ability to use a simulated clock for unit tests. This will be useful for any tests that test objects with time-dependent behavior. It will allow such tests to be written in such a way that their outcome is more repeatable (less flaky), and will also allow such tests to finish quicker. For example, a test for STUN timeout doesn't need to wait the full timeout interval in real time; it can simply advance the simulated clock. BUG=webrtc:4925 R=pthatcher@webrtc.org Committed: https://crrev.com/b3c6810be3283963db5779a50f3df957b5881f91 Cr-Commit-Position: refs/heads/master@{#12950}

Patch Set 1 #

Total comments: 8

Patch Set 2 : Responding to juberti@'s comments and adding myself as owner to ownerless TODOs. #

Total comments: 19

Patch Set 3 : Responding to comments. Introducing TimeDelta, removing MacClock/PosixClock/WindowsClock. #

Patch Set 4 : Removing errant ';' #

Patch Set 5 : Adding TODOs. #

Patch Set 6 : Merge with master #

Patch Set 7 : Moving new file to correct .gyp file. #

Patch Set 8 : Fixing TSAN error. #

Patch Set 9 : Fixing ASan error (MessageQueueHandlers not being destroyed) #

Patch Set 10 : Removing unused code #

Patch Set 11 : Fixing compile warning. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+460 lines, -9 lines) Patch
M webrtc/base/base_tests.gyp View 1 2 3 4 5 6 2 chunks +3 lines, -0 lines 0 comments Download
A webrtc/base/fakeclock.h View 1 2 1 chunk +43 lines, -0 lines 0 comments Download
A webrtc/base/fakeclock.cc View 1 2 1 chunk +40 lines, -0 lines 0 comments Download
M webrtc/base/messagequeue.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +9 lines, -2 lines 0 comments Download
M webrtc/base/messagequeue.cc View 1 2 3 4 5 6 7 8 9 2 chunks +27 lines, -0 lines 0 comments Download
A webrtc/base/timedelta.h View 1 2 1 chunk +128 lines, -0 lines 0 comments Download
M webrtc/base/timeutils.h View 1 2 3 4 5 1 chunk +20 lines, -0 lines 0 comments Download
M webrtc/base/timeutils.cc View 1 2 3 4 5 4 chunks +15 lines, -7 lines 0 comments Download
M webrtc/base/timeutils_unittest.cc View 1 2 3 4 5 6 7 8 2 chunks +174 lines, -0 lines 0 comments Download
M webrtc/base/timing.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 31 (13 generated)
Taylor Brandstetter
Hey Peter. I'm sheriffing this week, and am getting tired of seeing tests fail that ...
4 years, 8 months ago (2016-04-19 19:18:11 UTC) #2
juberti2
https://codereview.webrtc.org/1895933003/diff/1/webrtc/base/simulatedclock.cc File webrtc/base/simulatedclock.cc (right): https://codereview.webrtc.org/1895933003/diff/1/webrtc/base/simulatedclock.cc#newcode29 webrtc/base/simulatedclock.cc:29: MessageQueueManager::WakeAllMessageQueues(); A comment explaining the intent here would be ...
4 years, 8 months ago (2016-04-25 20:18:23 UTC) #4
Taylor Brandstetter
https://codereview.webrtc.org/1895933003/diff/1/webrtc/base/simulatedclock.cc File webrtc/base/simulatedclock.cc (right): https://codereview.webrtc.org/1895933003/diff/1/webrtc/base/simulatedclock.cc#newcode29 webrtc/base/simulatedclock.cc:29: MessageQueueManager::WakeAllMessageQueues(); On 2016/04/25 20:18:22, juberti2 wrote: > A comment ...
4 years, 8 months ago (2016-04-26 01:22:32 UTC) #5
Taylor Brandstetter
It would be great if we could land this. As I worried, the unit tests ...
4 years, 7 months ago (2016-05-24 16:17:56 UTC) #7
pthatcher1
https://codereview.webrtc.org/1895933003/diff/20001/webrtc/base/fakeclock.cc File webrtc/base/fakeclock.cc (right): https://codereview.webrtc.org/1895933003/diff/20001/webrtc/base/fakeclock.cc#newcode41 webrtc/base/fakeclock.cc:41: AdvanceTimeNanos(micros * 1000); You could use kNumNanosecsPerMicrosec. https://codereview.webrtc.org/1895933003/diff/20001/webrtc/base/fakeclock.cc#newcode45 webrtc/base/fakeclock.cc:45: ...
4 years, 7 months ago (2016-05-24 18:05:46 UTC) #8
Taylor Brandstetter
https://codereview.webrtc.org/1895933003/diff/20001/webrtc/base/fakeclock.cc File webrtc/base/fakeclock.cc (right): https://codereview.webrtc.org/1895933003/diff/20001/webrtc/base/fakeclock.cc#newcode41 webrtc/base/fakeclock.cc:41: AdvanceTimeNanos(micros * 1000); On 2016/05/24 18:05:46, pthatcher1 wrote: > ...
4 years, 7 months ago (2016-05-24 21:48:00 UTC) #9
pthatcher1
lgtm https://codereview.webrtc.org/1895933003/diff/20001/webrtc/base/timeutils.h File webrtc/base/timeutils.h (right): https://codereview.webrtc.org/1895933003/diff/20001/webrtc/base/timeutils.h#newcode38 webrtc/base/timeutils.h:38: }; On 2016/05/24 21:48:00, Taylor Brandstetter wrote: > ...
4 years, 7 months ago (2016-05-26 17:48:38 UTC) #10
Taylor Brandstetter
On 2016/05/26 17:48:38, pthatcher1 wrote: > lgtm > > https://codereview.webrtc.org/1895933003/diff/20001/webrtc/base/timeutils.h > File webrtc/base/timeutils.h (right): > ...
4 years, 7 months ago (2016-05-26 21:41:31 UTC) #11
pthatcher1
I think we should do that. ClockInterface looks better than Timing. Please put a TODO ...
4 years, 7 months ago (2016-05-26 21:43:23 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1895933003/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1895933003/100001
4 years, 7 months ago (2016-05-26 22:37:36 UTC) #15
commit-bot: I haz the power
Try jobs failed on following builders: android_compile_x86_dbg on tryserver.webrtc (JOB_FAILED, http://build.chromium.org/p/tryserver.webrtc/builders/android_compile_x86_dbg/builds/4228)
4 years, 7 months ago (2016-05-26 22:42:31 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1895933003/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1895933003/120001
4 years, 7 months ago (2016-05-26 23:06:52 UTC) #20
commit-bot: I haz the power
Try jobs failed on following builders: linux_tsan2 on tryserver.webrtc (JOB_FAILED, http://build.chromium.org/p/tryserver.webrtc/builders/linux_tsan2/builds/12513)
4 years, 7 months ago (2016-05-26 23:26:02 UTC) #22
Taylor Brandstetter
Peter, I submitted a few more patches to fix minor issues; do you want to ...
4 years, 6 months ago (2016-05-27 17:19:09 UTC) #23
pthatcher1
lgtm
4 years, 6 months ago (2016-05-27 17:49:38 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1895933003/180001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1895933003/180001
4 years, 6 months ago (2016-05-27 20:48:43 UTC) #26
commit-bot: I haz the power
Try jobs failed on following builders: mac_gn_rel on tryserver.webrtc (JOB_FAILED, http://build.chromium.org/p/tryserver.webrtc/builders/mac_gn_rel/builds/9746)
4 years, 6 months ago (2016-05-27 20:50:54 UTC) #28
Taylor Brandstetter
4 years, 6 months ago (2016-05-27 21:16:14 UTC) #30
Message was sent while issue was closed.
Committed patchset #11 (id:200001) manually as
b3c6810be3283963db5779a50f3df957b5881f91 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698