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:
Martin Thomson 2015-03-31 16:01:51 -07:00
Родитель 44f66f35a7
Коммит 5eb8a74765
1 изменённых файлов: 18 добавлений и 18 удалений

Просмотреть файл

@ -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