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

Side by Side Diff: webrtc/base/timeutils_unittest.cc

Issue 2611663002: Refactor rtc_unittests into several targets. (Closed)
Patch Set: Nit. Created 3 years, 11 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/refcountedobject_unittest.cc ('k') | webrtc/base/win32window_unittest.cc » ('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
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 EXPECT_EQ(ts, 111 EXPECT_EQ(ts,
112 wraparound_handler_.Unwrap(static_cast<uint32_t>(ts & 0xffffffff))); 112 wraparound_handler_.Unwrap(static_cast<uint32_t>(ts & 0xffffffff)));
113 } 113 }
114 114
115 class TmToSeconds : public testing::Test { 115 class TmToSeconds : public testing::Test {
116 public: 116 public:
117 TmToSeconds() { 117 TmToSeconds() {
118 // Set use of the test RNG to get deterministic expiration timestamp. 118 // Set use of the test RNG to get deterministic expiration timestamp.
119 rtc::SetRandomTestMode(true); 119 rtc::SetRandomTestMode(true);
120 } 120 }
121 ~TmToSeconds() { 121 ~TmToSeconds() override {
122 // Put it back for the next test. 122 // Put it back for the next test.
123 rtc::SetRandomTestMode(false); 123 rtc::SetRandomTestMode(false);
124 } 124 }
125 125
126 void TestTmToSeconds(int times) { 126 void TestTmToSeconds(int times) {
127 static char mdays[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; 127 static char mdays[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
128 for (int i = 0; i < times; i++) { 128 for (int i = 0; i < times; i++) {
129 129
130 // First generate something correct and check that TmToSeconds is happy. 130 // First generate something correct and check that TmToSeconds is happy.
131 int year = rtc::CreateRandomId() % 400 + 1970; 131 int year = rtc::CreateRandomId() % 400 + 1970;
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 374
375 SetClockForTesting(nullptr); 375 SetClockForTesting(nullptr);
376 376
377 // The message should have been dispatched long before the 60 seconds fully 377 // The message should have been dispatched long before the 60 seconds fully
378 // elapsed (just a sanity check). 378 // elapsed (just a sanity check).
379 int64_t real_end_time_ms = TimeMillis(); 379 int64_t real_end_time_ms = TimeMillis();
380 EXPECT_LT(real_end_time_ms - real_start_time_ms, 10000); 380 EXPECT_LT(real_end_time_ms - real_start_time_ms, 10000);
381 } 381 }
382 382
383 } // namespace rtc 383 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/refcountedobject_unittest.cc ('k') | webrtc/base/win32window_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698