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

Unified Diff: webrtc/base/gunit.h

Issue 2038213002: Revert of Improving the fake clock and using it to fix a flaky STUN timeout test. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/fakeclock.cc ('k') | webrtc/base/messagequeue.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/gunit.h
diff --git a/webrtc/base/gunit.h b/webrtc/base/gunit.h
index 5ba0bd916e6632a50c8754b4fe07c061a69b12dc..e705322e6f827fd3dac94c2bb75a474376be977f 100644
--- a/webrtc/base/gunit.h
+++ b/webrtc/base/gunit.h
@@ -11,7 +11,6 @@
#ifndef WEBRTC_BASE_GUNIT_H_
#define WEBRTC_BASE_GUNIT_H_
-#include "webrtc/base/fakeclock.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/thread.h"
#if defined(GTEST_RELATIVE_PATH)
@@ -21,12 +20,10 @@
#endif
// Wait until "ex" is true, or "timeout" expires.
-#define WAIT(ex, timeout) \
- for (int64_t start = rtc::TimeMillis(); \
- !(ex) && rtc::TimeMillis() < start + timeout;) { \
- rtc::Thread::Current()->ProcessMessages(0); \
- rtc::Thread::Current()->SleepMs(1); \
- }
+#define WAIT(ex, timeout) \
+ for (int64_t start = rtc::TimeMillis(); \
+ !(ex) && rtc::TimeMillis() < start + timeout;) \
+ rtc::Thread::Current()->ProcessMessages(1);
// This returns the result of the test in res, so that we don't re-evaluate
// the expression in the XXXX_WAIT macros below, since that causes problems
@@ -36,8 +33,7 @@
int64_t start = rtc::TimeMillis(); \
res = (ex); \
while (!res && rtc::TimeMillis() < start + timeout) { \
- rtc::Thread::Current()->ProcessMessages(0); \
- rtc::Thread::Current()->SleepMs(1); \
+ rtc::Thread::Current()->ProcessMessages(1); \
res = (ex); \
} \
} while (0)
@@ -89,44 +85,4 @@
} \
} while (0)
-// Wait until "ex" is true, or "timeout" expires, using fake clock where
-// messages are processed every millisecond.
-#define SIMULATED_WAIT(ex, timeout, clock) \
- for (int64_t start = rtc::TimeMillis(); \
- !(ex) && rtc::TimeMillis() < start + timeout;) { \
- clock.AdvanceTime(rtc::TimeDelta::FromMilliseconds(1)); \
- }
-
-// This returns the result of the test in res, so that we don't re-evaluate
-// the expression in the XXXX_WAIT macros below, since that causes problems
-// when the expression is only true the first time you check it.
-#define SIMULATED_WAIT_(ex, timeout, res, clock) \
- do { \
- int64_t start = rtc::TimeMillis(); \
- res = (ex); \
- while (!res && rtc::TimeMillis() < start + timeout) { \
- clock.AdvanceTime(rtc::TimeDelta::FromMilliseconds(1)); \
- res = (ex); \
- } \
- } while (0)
-
-// The typical EXPECT_XXXX, but done until true or a timeout with a fake clock.
-#define EXPECT_TRUE_SIMULATED_WAIT(ex, timeout, clock) \
- do { \
- bool res; \
- SIMULATED_WAIT_(ex, timeout, res, clock); \
- if (!res) { \
- EXPECT_TRUE(ex); \
- } \
- } while (0)
-
-#define EXPECT_EQ_SIMULATED_WAIT(v1, v2, timeout, clock) \
- do { \
- bool res; \
- SIMULATED_WAIT_(v1 == v2, timeout, res, clock); \
- if (!res) { \
- EXPECT_EQ(v1, v2); \
- } \
- } while (0)
-
#endif // WEBRTC_BASE_GUNIT_H_
« no previous file with comments | « webrtc/base/fakeclock.cc ('k') | webrtc/base/messagequeue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698