Index: webrtc/base/thread.cc |
diff --git a/webrtc/base/thread.cc b/webrtc/base/thread.cc |
index 1be5196c7dffbf8325b679c1504f19df1eb7f2b3..9174cd1bd6de531f80d6a200bf3c4afd4498c521 100644 |
--- a/webrtc/base/thread.cc |
+++ b/webrtc/base/thread.cc |
@@ -471,6 +471,11 @@ void Thread::Clear(MessageHandler* phandler, |
// Note that these methods have a separate implementation for mac and ios |
// defined in webrtc/base/thread_darwin.mm. |
bool Thread::ProcessMessages(int cmsLoop) { |
+ // Using ProcessMessages with a custom clock for testing and a time greater |
+ // than 0 doesn't work, since it's not guaranteed to advance the custom |
+ // clock's time, and may get stuck in an infinite loop. |
+ RTC_DCHECK(GetClockForTesting() == nullptr || cmsLoop == 0 || |
+ cmsLoop == kForever); |
int64_t msEnd = (kForever == cmsLoop) ? 0 : TimeAfter(cmsLoop); |
int cmsNext = cmsLoop; |