summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/api/candidate_unittest.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
commit8dd16259287f58f9273002717ec4d27e97127719 (patch)
tree3863e62a53829a84037444beab3abd4ed9dfc7d0 /third_party/libwebrtc/api/candidate_unittest.cc
parentReleasing progress-linux version 126.0.1-1~progress7.99u1. (diff)
downloadfirefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz
firefox-8dd16259287f58f9273002717ec4d27e97127719.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/api/candidate_unittest.cc')
-rw-r--r--third_party/libwebrtc/api/candidate_unittest.cc56
1 files changed, 56 insertions, 0 deletions
diff --git a/third_party/libwebrtc/api/candidate_unittest.cc b/third_party/libwebrtc/api/candidate_unittest.cc
new file mode 100644
index 0000000000..e52d448e72
--- /dev/null
+++ b/third_party/libwebrtc/api/candidate_unittest.cc
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2024 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 "api/candidate.h"
+
+#include <string>
+
+#include "p2p/base/p2p_constants.h"
+#include "rtc_base/gunit.h"
+
+namespace cricket {
+
+TEST(CandidateTest, Id) {
+ Candidate c;
+ EXPECT_EQ(c.id().size(), 8u);
+ std::string current_id = c.id();
+ // Generate a new ID.
+ c.generate_id();
+ EXPECT_EQ(c.id().size(), 8u);
+ EXPECT_NE(current_id, c.id());
+}
+
+TEST(CandidateTest, Component) {
+ Candidate c;
+ EXPECT_EQ(c.component(), 0);
+ c.set_component(ICE_CANDIDATE_COMPONENT_DEFAULT);
+ EXPECT_EQ(c.component(), ICE_CANDIDATE_COMPONENT_DEFAULT);
+}
+
+TEST(CandidateTest, TypeName) {
+ Candidate c;
+ // The `type_name()` property defaults to "host".
+ EXPECT_EQ(c.type_name(), "host");
+ EXPECT_EQ(c.type(), LOCAL_PORT_TYPE);
+
+ c.set_type(STUN_PORT_TYPE);
+ EXPECT_EQ(c.type_name(), "srflx");
+ EXPECT_EQ(c.type(), STUN_PORT_TYPE);
+
+ c.set_type(PRFLX_PORT_TYPE);
+ EXPECT_EQ(c.type_name(), "prflx");
+ EXPECT_EQ(c.type(), PRFLX_PORT_TYPE);
+
+ c.set_type(RELAY_PORT_TYPE);
+ EXPECT_EQ(c.type_name(), "relay");
+ EXPECT_EQ(c.type(), RELAY_PORT_TYPE);
+}
+
+} // namespace cricket