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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/ntp_time_unittest.cc

Issue 1435833003: Introduce helper class NtpTime (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 1 month 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
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "testing/gtest/include/gtest/gtest.h"
12
13 #include "webrtc/modules/rtp_rtcp/source/ntp_time.h"
14
15 namespace webrtc {
16 namespace rtcp {
17
18 TEST(NtpTimeTest, MidNtp) {
19 const uint32_t kNtpSec = 0x12345678;
20 const uint32_t kNtpFrac = 0x23456789;
21 const uint32_t kNtpMid = 0x56782345;
22 EXPECT_EQ(kNtpMid, NtpTime(kNtpSec, kNtpFrac).MidNtp());
23 }
24
25 TEST(NtpTimeTest, NoValue) {
26 NtpTime ntp;
27 EXPECT_FALSE(ntp);
28 EXPECT_TRUE(!ntp);
29 }
30
31 TEST(NtpTimeTest, HasValue) {
32 const uint32_t kNtpSec = 0x12345678;
33 const uint32_t kNtpFrac = 0x23456789;
34 NtpTime ntp;
35 ntp.Set(kNtpSec, kNtpFrac);
36 EXPECT_TRUE(ntp);
37 EXPECT_EQ(kNtpSec, ntp.seconds());
38 EXPECT_EQ(kNtpFrac, ntp.fractions());
39 ntp.clear();
40 EXPECT_FALSE(ntp);
41 }
42
43 } // namespace rtcp
44 } // namespace webrtc
OLDNEW
« webrtc/modules/rtp_rtcp/source/ntp_time.h ('K') | « webrtc/modules/rtp_rtcp/source/ntp_time.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698