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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/rtp_rtcp/source/ntp_time_unittest.cc
diff --git a/webrtc/modules/rtp_rtcp/source/ntp_time_unittest.cc b/webrtc/modules/rtp_rtcp/source/ntp_time_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e42c481ec6bf515366caadd1baba135b7cd47875
--- /dev/null
+++ b/webrtc/modules/rtp_rtcp/source/ntp_time_unittest.cc
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+#include "webrtc/modules/rtp_rtcp/source/ntp_time.h"
+
+namespace webrtc {
+namespace rtcp {
+
+TEST(NtpTimeTest, MidNtp) {
+ const uint32_t kNtpSec = 0x12345678;
+ const uint32_t kNtpFrac = 0x23456789;
+ const uint32_t kNtpMid = 0x56782345;
+ EXPECT_EQ(kNtpMid, NtpTime(kNtpSec, kNtpFrac).MidNtp());
+}
+
+TEST(NtpTimeTest, NoValue) {
+ NtpTime ntp;
+ EXPECT_FALSE(ntp);
+ EXPECT_TRUE(!ntp);
+}
+
+TEST(NtpTimeTest, HasValue) {
+ const uint32_t kNtpSec = 0x12345678;
+ const uint32_t kNtpFrac = 0x23456789;
+ NtpTime ntp;
+ ntp.Set(kNtpSec, kNtpFrac);
+ EXPECT_TRUE(ntp);
+ EXPECT_EQ(kNtpSec, ntp.seconds());
+ EXPECT_EQ(kNtpFrac, ntp.fractions());
+ ntp.clear();
+ EXPECT_FALSE(ntp);
+}
+
+} // namespace rtcp
+} // namespace webrtc
« 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