diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
commit | fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch) | |
tree | 4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /third_party/libwebrtc/net/dcsctp/common | |
parent | Releasing progress-linux version 124.0.1-1~progress7.99u1. (diff) | |
download | firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/net/dcsctp/common')
-rw-r--r-- | third_party/libwebrtc/net/dcsctp/common/BUILD.gn | 8 | ||||
-rw-r--r-- | third_party/libwebrtc/net/dcsctp/common/str_join.h | 56 | ||||
-rw-r--r-- | third_party/libwebrtc/net/dcsctp/common/str_join_test.cc | 45 |
3 files changed, 0 insertions, 109 deletions
diff --git a/third_party/libwebrtc/net/dcsctp/common/BUILD.gn b/third_party/libwebrtc/net/dcsctp/common/BUILD.gn index 78fa0d307e..d496c64a56 100644 --- a/third_party/libwebrtc/net/dcsctp/common/BUILD.gn +++ b/third_party/libwebrtc/net/dcsctp/common/BUILD.gn @@ -29,12 +29,6 @@ rtc_source_set("sequence_numbers") { sources = [ "sequence_numbers.h" ] } -rtc_source_set("str_join") { - deps = [ "../../../rtc_base:stringutils" ] - sources = [ "str_join.h" ] - absl_deps = [ "//third_party/abseil-cpp/absl/strings" ] -} - if (rtc_include_tests) { rtc_library("dcsctp_common_unittests") { testonly = true @@ -43,7 +37,6 @@ if (rtc_include_tests) { deps = [ ":math", ":sequence_numbers", - ":str_join", "../../../api:array_view", "../../../rtc_base:checks", "../../../rtc_base:gunit_helpers", @@ -52,7 +45,6 @@ if (rtc_include_tests) { sources = [ "math_test.cc", "sequence_numbers_test.cc", - "str_join_test.cc", ] } } diff --git a/third_party/libwebrtc/net/dcsctp/common/str_join.h b/third_party/libwebrtc/net/dcsctp/common/str_join.h deleted file mode 100644 index 04517827b7..0000000000 --- a/third_party/libwebrtc/net/dcsctp/common/str_join.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2021 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. - */ -#ifndef NET_DCSCTP_COMMON_STR_JOIN_H_ -#define NET_DCSCTP_COMMON_STR_JOIN_H_ - -#include <string> - -#include "absl/strings/string_view.h" -#include "rtc_base/strings/string_builder.h" - -namespace dcsctp { - -template <typename Range> -std::string StrJoin(const Range& seq, absl::string_view delimiter) { - rtc::StringBuilder sb; - int idx = 0; - - for (const typename Range::value_type& elem : seq) { - if (idx > 0) { - sb << delimiter; - } - sb << elem; - - ++idx; - } - return sb.Release(); -} - -template <typename Range, typename Functor> -std::string StrJoin(const Range& seq, - absl::string_view delimiter, - const Functor& fn) { - rtc::StringBuilder sb; - int idx = 0; - - for (const typename Range::value_type& elem : seq) { - if (idx > 0) { - sb << delimiter; - } - fn(sb, elem); - - ++idx; - } - return sb.Release(); -} - -} // namespace dcsctp - -#endif // NET_DCSCTP_COMMON_STR_JOIN_H_ diff --git a/third_party/libwebrtc/net/dcsctp/common/str_join_test.cc b/third_party/libwebrtc/net/dcsctp/common/str_join_test.cc deleted file mode 100644 index dbfd92c1cf..0000000000 --- a/third_party/libwebrtc/net/dcsctp/common/str_join_test.cc +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2021 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 "net/dcsctp/common/str_join.h" - -#include <string> -#include <utility> -#include <vector> - -#include "test/gmock.h" - -namespace dcsctp { -namespace { - -TEST(StrJoinTest, CanJoinStringsFromVector) { - std::vector<std::string> strings = {"Hello", "World"}; - std::string s = StrJoin(strings, " "); - EXPECT_EQ(s, "Hello World"); -} - -TEST(StrJoinTest, CanJoinNumbersFromArray) { - std::array<int, 3> numbers = {1, 2, 3}; - std::string s = StrJoin(numbers, ","); - EXPECT_EQ(s, "1,2,3"); -} - -TEST(StrJoinTest, CanFormatElementsWhileJoining) { - std::vector<std::pair<std::string, std::string>> pairs = { - {"hello", "world"}, {"foo", "bar"}, {"fum", "gazonk"}}; - std::string s = StrJoin(pairs, ",", - [&](rtc::StringBuilder& sb, - const std::pair<std::string, std::string>& p) { - sb << p.first << "=" << p.second; - }); - EXPECT_EQ(s, "hello=world,foo=bar,fum=gazonk"); -} - -} // namespace -} // namespace dcsctp |