зеркало из https://github.com/mozilla/gecko-dev.git
Bug 996238 - Reformat gtest_utils.h. r=ekr
--HG-- extra : transplant_source : %D5G%1D%2BK%D3%24%01%A6%92%A5%E6q%9A%88%F5%CA98%D9
This commit is contained in:
Родитель
44f66f35a7
Коммит
5eb8a74765
|
@ -51,36 +51,36 @@
|
|||
// Wait up to timeout seconds for expression to be true
|
||||
#define WAIT(expression, timeout) \
|
||||
do { \
|
||||
for (PRIntervalTime start = PR_IntervalNow(); !(expression) && \
|
||||
! ((PR_IntervalNow() - start) > PR_MillisecondsToInterval(timeout));) \
|
||||
PR_Sleep(10); \
|
||||
for (PRIntervalTime start = PR_IntervalNow(); !(expression) && \
|
||||
! ((PR_IntervalNow() - start) > PR_MillisecondsToInterval(timeout));) { \
|
||||
PR_Sleep(10); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
// Same as GTEST_WAIT, but stores the result in res. Used when
|
||||
// you also want the result of expression but wish to avoid
|
||||
// double evaluation.
|
||||
#define WAIT_(expression, timeout, res) \
|
||||
#define WAIT_(expression, timeout, res) \
|
||||
do { \
|
||||
for (PRIntervalTime start = PR_IntervalNow(); !(res = (expression)) && \
|
||||
! ((PR_IntervalNow() - start) > PR_MillisecondsToInterval(timeout));) \
|
||||
PR_Sleep(10); \
|
||||
for (PRIntervalTime start = PR_IntervalNow(); !(res = (expression)) && \
|
||||
! ((PR_IntervalNow() - start) > PR_MillisecondsToInterval(timeout));) { \
|
||||
PR_Sleep(10); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define ASSERT_TRUE_WAIT(expression, timeout) \
|
||||
do { \
|
||||
bool res; \
|
||||
WAIT_(expression, timeout, res); \
|
||||
ASSERT_TRUE(res); \
|
||||
} while(0);
|
||||
bool res; \
|
||||
WAIT_(expression, timeout, res); \
|
||||
ASSERT_TRUE(res); \
|
||||
} while(0)
|
||||
|
||||
#define EXPECT_TRUE_WAIT(expression, timeout) \
|
||||
do { \
|
||||
bool res; \
|
||||
WAIT_(expression, timeout, res); \
|
||||
EXPECT_TRUE(res); \
|
||||
} while(0);
|
||||
bool res; \
|
||||
WAIT_(expression, timeout, res); \
|
||||
EXPECT_TRUE(res); \
|
||||
} while(0)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче