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

Side by Side Diff: webrtc/base/gunit.h

Issue 1835053002: Change default timestamp to 64 bits in all webrtc directories. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Add TODO for timestamp. Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « webrtc/base/fileutils.cc ('k') | webrtc/base/logging.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef WEBRTC_BASE_GUNIT_H_ 11 #ifndef WEBRTC_BASE_GUNIT_H_
12 #define WEBRTC_BASE_GUNIT_H_ 12 #define WEBRTC_BASE_GUNIT_H_
13 13
14 #include "webrtc/base/logging.h" 14 #include "webrtc/base/logging.h"
15 #include "webrtc/base/thread.h" 15 #include "webrtc/base/thread.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 17
18 // Wait until "ex" is true, or "timeout" expires. 18 // Wait until "ex" is true, or "timeout" expires.
19 #define WAIT(ex, timeout) \ 19 #define WAIT(ex, timeout) \
20 for (uint32_t start = rtc::Time(); !(ex) && rtc::Time() < start + timeout;) \ 20 for (int64_t start = rtc::TimeMillis(); \
21 !(ex) && rtc::TimeMillis() < start + timeout;) \
21 rtc::Thread::Current()->ProcessMessages(1); 22 rtc::Thread::Current()->ProcessMessages(1);
22 23
23 // This returns the result of the test in res, so that we don't re-evaluate 24 // This returns the result of the test in res, so that we don't re-evaluate
24 // the expression in the XXXX_WAIT macros below, since that causes problems 25 // the expression in the XXXX_WAIT macros below, since that causes problems
25 // when the expression is only true the first time you check it. 26 // when the expression is only true the first time you check it.
26 #define WAIT_(ex, timeout, res) \ 27 #define WAIT_(ex, timeout, res) \
27 do { \ 28 do { \
28 uint32_t start = rtc::Time(); \ 29 int64_t start = rtc::TimeMillis(); \
29 res = (ex); \ 30 res = (ex); \
30 while (!res && rtc::Time() < start + timeout) { \ 31 while (!res && rtc::TimeMillis() < start + timeout) { \
31 rtc::Thread::Current()->ProcessMessages(1); \ 32 rtc::Thread::Current()->ProcessMessages(1); \
32 res = (ex); \ 33 res = (ex); \
33 } \ 34 } \
34 } while (0) 35 } while (0)
35 36
36 // The typical EXPECT_XXXX and ASSERT_XXXXs, but done until true or a timeout. 37 // The typical EXPECT_XXXX and ASSERT_XXXXs, but done until true or a timeout.
37 #define EXPECT_TRUE_WAIT(ex, timeout) \ 38 #define EXPECT_TRUE_WAIT(ex, timeout) \
38 do { \ 39 do { \
39 bool res; \ 40 bool res; \
40 WAIT_(ex, timeout, res); \ 41 WAIT_(ex, timeout, res); \
41 if (!res) EXPECT_TRUE(ex); \ 42 if (!res) EXPECT_TRUE(ex); \
42 } while (0) 43 } while (0)
43 44
(...skipping 30 matching lines...) Expand all
74 } \ 75 } \
75 LOG(LS_WARNING) << "Expression " << #ex << " still not true after " << \ 76 LOG(LS_WARNING) << "Expression " << #ex << " still not true after " << \
76 timeout << "ms; waiting an additional " << margin << "ms"; \ 77 timeout << "ms; waiting an additional " << margin << "ms"; \
77 WAIT_(ex, margin, res); \ 78 WAIT_(ex, margin, res); \
78 if (!res) { \ 79 if (!res) { \
79 EXPECT_TRUE(ex); \ 80 EXPECT_TRUE(ex); \
80 } \ 81 } \
81 } while (0) 82 } while (0)
82 83
83 #endif // WEBRTC_BASE_GUNIT_H_ 84 #endif // WEBRTC_BASE_GUNIT_H_
OLDNEW
« no previous file with comments | « webrtc/base/fileutils.cc ('k') | webrtc/base/logging.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698