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

Side by Side Diff: webrtc/system_wrappers/source/ntp_time_unittest.cc

Issue 2393723004: replace NtpTime->Clock with Clock->NtpTime dependency (Closed)
Patch Set: . Created 3 years, 10 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/system_wrappers/source/clock.cc ('k') | no next file » | 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 (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 #include "webrtc/system_wrappers/include/clock.h"
11 #include "webrtc/system_wrappers/include/ntp_time.h" 12 #include "webrtc/system_wrappers/include/ntp_time.h"
12 #include "webrtc/test/gtest.h" 13 #include "webrtc/test/gtest.h"
13 14
14 namespace webrtc { 15 namespace webrtc {
15 namespace { 16 namespace {
16 17
17 const uint32_t kNtpSec = 0x12345678; 18 const uint32_t kNtpSec = 0x12345678;
18 const uint32_t kNtpFrac = 0x23456789; 19 const uint32_t kNtpFrac = 0x23456789;
19 20
20 TEST(NtpTimeTest, NoValueMeansInvalid) { 21 TEST(NtpTimeTest, NoValueMeansInvalid) {
(...skipping 17 matching lines...) Expand all
38 39
39 TEST(NtpTimeTest, SetIsSameAs2ParameterConstructor) { 40 TEST(NtpTimeTest, SetIsSameAs2ParameterConstructor) {
40 NtpTime ntp1(kNtpSec, kNtpFrac); 41 NtpTime ntp1(kNtpSec, kNtpFrac);
41 NtpTime ntp2; 42 NtpTime ntp2;
42 EXPECT_NE(ntp1, ntp2); 43 EXPECT_NE(ntp1, ntp2);
43 44
44 ntp2.Set(kNtpSec, kNtpFrac); 45 ntp2.Set(kNtpSec, kNtpFrac);
45 EXPECT_EQ(ntp1, ntp2); 46 EXPECT_EQ(ntp1, ntp2);
46 } 47 }
47 48
48 TEST(NtpTimeTest, SetCurrentIsSameAs1ParameterConstructor) {
49 SimulatedClock clock(0x0123456789abcdef);
50
51 NtpTime ntp1(clock);
52 NtpTime ntp2;
53 EXPECT_NE(ntp1, ntp2);
54
55 ntp2.SetCurrent(clock);
56 EXPECT_EQ(ntp1, ntp2);
57 }
58
59 TEST(NtpTimeTest, ToMsMeansToNtpMilliseconds) { 49 TEST(NtpTimeTest, ToMsMeansToNtpMilliseconds) {
60 SimulatedClock clock(0x123456789abc); 50 SimulatedClock clock(0x123456789abc);
61 51
62 NtpTime ntp(clock); 52 NtpTime ntp = clock.CurrentNtpTime();
63 EXPECT_EQ(ntp.ToMs(), Clock::NtpToMs(ntp.seconds(), ntp.fractions())); 53 EXPECT_EQ(ntp.ToMs(), Clock::NtpToMs(ntp.seconds(), ntp.fractions()));
64 EXPECT_EQ(ntp.ToMs(), clock.CurrentNtpInMilliseconds()); 54 EXPECT_EQ(ntp.ToMs(), clock.CurrentNtpInMilliseconds());
65 } 55 }
66 56
67 } // namespace 57 } // namespace
68 } // namespace webrtc 58 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/system_wrappers/source/clock.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698