tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 7031becbfee6bcdaa5c7a096ebb40eda0709237a
parent 8a71d04e1df9168bb16db6ca4be04394478370d3
Author: Michael Froman <mfroman@mozilla.com>
Date:   Wed,  8 Oct 2025 22:00:07 -0500

Bug 1993083 - Vendor libwebrtc from 50aa2d768e

Upstream commit: https://webrtc.googlesource.com/src/+/50aa2d768ecfb5d91e3676a09d9bdb9ef72bf317
    Wrap jsep_session_description_unittest in webrtc namespace

    and remove a lot of webrtc:: prefixes. Follow-up from
      https://webrtc-review.googlesource.com/c/src/+/398220/

    Bug: None
    Change-Id: I670b74828ae860558007ae3c745703c628562ea4
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/398690
    Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
    Reviewed-by: Harald Alvestrand <hta@webrtc.org>
    Commit-Queue: Philipp Hancke <phancke@meta.com>
    Cr-Commit-Position: refs/heads/main@{#45091}

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/pc/jsep_session_description_unittest.cc | 183++++++++++++++++++++++++++++++++++++++-----------------------------------------
2 files changed, 91 insertions(+), 96 deletions(-)

diff --git a/third_party/libwebrtc/README.mozilla.last-vendor b/third_party/libwebrtc/README.mozilla.last-vendor @@ -1,4 +1,4 @@ # ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc -libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-09T02:58:53.442732+00:00. +libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-09T02:59:57.874297+00:00. # base of lastest vendoring -5063e78710 +50aa2d768e diff --git a/third_party/libwebrtc/pc/jsep_session_description_unittest.cc b/third_party/libwebrtc/pc/jsep_session_description_unittest.cc @@ -33,15 +33,10 @@ #include "test/gmock.h" #include "test/gtest.h" +namespace webrtc { + using ::testing::NotNull; using ::testing::Values; -using webrtc::IceCandidate; -using webrtc::IceCandidateCollection; -using webrtc::IceCandidateType; -using webrtc::JsepSessionDescription; -using ::webrtc::MediaProtocolType; -using webrtc::SdpType; -using webrtc::SessionDescriptionInterface; namespace { const char kAudioMid[] = "audio"; @@ -58,30 +53,30 @@ const uint32_t kCandidateGeneration = 2; // This creates a session description with both audio and video media contents. // In SDP this is described by two m lines, one audio and one video. -std::unique_ptr<webrtc::SessionDescription> CreateCricketSessionDescription() { - auto desc = std::make_unique<webrtc::SessionDescription>(); +std::unique_ptr<SessionDescription> CreateCricketSessionDescription() { + auto desc = std::make_unique<SessionDescription>(); // AudioContentDescription - auto audio = std::make_unique<webrtc::AudioContentDescription>(); + auto audio = std::make_unique<AudioContentDescription>(); // VideoContentDescription - auto video = std::make_unique<webrtc::VideoContentDescription>(); + auto video = std::make_unique<VideoContentDescription>(); - audio->AddCodec(webrtc::CreateAudioCodec(103, "ISAC", 16000, 0)); + audio->AddCodec(CreateAudioCodec(103, "ISAC", 16000, 0)); desc->AddContent(kAudioMid, MediaProtocolType::kRtp, std::move(audio)); - video->AddCodec(webrtc::CreateVideoCodec(120, "VP8")); + video->AddCodec(CreateVideoCodec(120, "VP8")); desc->AddContent(kVideoMid, MediaProtocolType::kRtp, std::move(video)); - desc->AddTransportInfo(webrtc::TransportInfo( + desc->AddTransportInfo(TransportInfo( kAudioMid, - webrtc::TransportDescription( - std::vector<std::string>(), kCandidateUfragVoice, kCandidatePwdVoice, - webrtc::ICEMODE_FULL, webrtc::CONNECTIONROLE_NONE, nullptr))); - desc->AddTransportInfo(webrtc::TransportInfo( + TransportDescription(std::vector<std::string>(), kCandidateUfragVoice, + kCandidatePwdVoice, ICEMODE_FULL, + CONNECTIONROLE_NONE, nullptr))); + desc->AddTransportInfo(TransportInfo( kVideoMid, - webrtc::TransportDescription( - std::vector<std::string>(), kCandidateUfragVideo, kCandidatePwdVideo, - webrtc::ICEMODE_FULL, webrtc::CONNECTIONROLE_NONE, nullptr))); + TransportDescription(std::vector<std::string>(), kCandidateUfragVideo, + kCandidatePwdVideo, ICEMODE_FULL, + CONNECTIONROLE_NONE, nullptr))); return desc; } @@ -91,13 +86,12 @@ class JsepSessionDescriptionTest : public ::testing::Test { protected: void SetUp() override { int port = 1234; - webrtc::SocketAddress address("127.0.0.1", port++); - webrtc::Candidate candidate(webrtc::ICE_CANDIDATE_COMPONENT_RTP, "udp", - address, 1, "", "", IceCandidateType::kHost, 0, - "1"); + SocketAddress address("127.0.0.1", port++); + Candidate candidate(ICE_CANDIDATE_COMPONENT_RTP, "udp", address, 1, "", "", + IceCandidateType::kHost, 0, "1"); candidate_ = candidate; - const std::string session_id = absl::StrCat(webrtc::CreateRandomId64()); - const std::string session_version = absl::StrCat(webrtc::CreateRandomId()); + const std::string session_id = absl::StrCat(CreateRandomId64()); + const std::string session_version = absl::StrCat(CreateRandomId()); jsep_desc_ = std::make_unique<JsepSessionDescription>(SdpType::kOffer); ASSERT_TRUE(jsep_desc_->Initialize(CreateCricketSessionDescription(), session_id, session_version)); @@ -113,11 +107,11 @@ class JsepSessionDescriptionTest : public ::testing::Test { std::unique_ptr<SessionDescriptionInterface> DeSerialize( const std::string& sdp) { auto jsep_desc = std::make_unique<JsepSessionDescription>(SdpType::kOffer); - EXPECT_TRUE(webrtc::SdpDeserialize(sdp, jsep_desc.get(), nullptr)); + EXPECT_TRUE(SdpDeserialize(sdp, jsep_desc.get(), nullptr)); return std::move(jsep_desc); } - webrtc::Candidate candidate_; + Candidate candidate_; std::unique_ptr<JsepSessionDescription> jsep_desc_; }; @@ -140,14 +134,14 @@ TEST_F(JsepSessionDescriptionTest, CloneRollback) { } TEST_F(JsepSessionDescriptionTest, CloneWithCandidates) { - webrtc::Candidate candidate_v4( - webrtc::ICE_CANDIDATE_COMPONENT_RTP, "udp", - webrtc::SocketAddress("192.168.1.5", 1234), kCandidatePriority, "", "", - IceCandidateType::kSrflx, kCandidateGeneration, kCandidateFoundation); - webrtc::Candidate candidate_v6( - webrtc::ICE_CANDIDATE_COMPONENT_RTP, "udp", - webrtc::SocketAddress("::1", 1234), kCandidatePriority, "", "", - IceCandidateType::kHost, kCandidateGeneration, kCandidateFoundation); + Candidate candidate_v4(ICE_CANDIDATE_COMPONENT_RTP, "udp", + SocketAddress("192.168.1.5", 1234), kCandidatePriority, + "", "", IceCandidateType::kSrflx, kCandidateGeneration, + kCandidateFoundation); + Candidate candidate_v6(ICE_CANDIDATE_COMPONENT_RTP, "udp", + SocketAddress("::1", 1234), kCandidatePriority, "", "", + IceCandidateType::kHost, kCandidateGeneration, + kCandidateFoundation); IceCandidate jice_v4("audio", 0, candidate_v4); IceCandidate jice_v6("audio", 0, candidate_v6); @@ -232,7 +226,7 @@ TEST_F(JsepSessionDescriptionTest, AddAndRemoveCandidatesWithMid) { // The mline index should have been updated according to mid. EXPECT_EQ(1, ice_candidate->sdp_mline_index()); - std::vector<webrtc::Candidate> candidates(1, candidate_); + std::vector<Candidate> candidates(1, candidate_); candidates[0].set_transport_name(mid); EXPECT_EQ(1u, jsep_desc_->RemoveCandidates(candidates)); EXPECT_EQ(0u, jsep_desc_->candidates(0)->count()); @@ -291,10 +285,10 @@ TEST_F(JsepSessionDescriptionTest, AddCandidateDuplicates) { // Test that the connection address is set to a hostname address after adding a // hostname candidate. TEST_F(JsepSessionDescriptionTest, AddHostnameCandidate) { - webrtc::Candidate c; - c.set_component(webrtc::ICE_CANDIDATE_COMPONENT_RTP); - c.set_protocol(webrtc::UDP_PROTOCOL_NAME); - c.set_address(webrtc::SocketAddress("example.local", 1234)); + Candidate c; + c.set_component(ICE_CANDIDATE_COMPONENT_RTP); + c.set_protocol(UDP_PROTOCOL_NAME); + c.set_address(SocketAddress("example.local", 1234)); c.set_type(IceCandidateType::kHost); const size_t audio_index = 0; IceCandidate hostname_candidate("audio", audio_index, c); @@ -322,10 +316,10 @@ TEST_F(JsepSessionDescriptionTest, SerializeDeserialize) { // is the default destination and deserialize it again. The connection address // in the deserialized description should be the dummy address 0.0.0.0:9. TEST_F(JsepSessionDescriptionTest, SerializeDeserializeWithHostnameCandidate) { - webrtc::Candidate c; - c.set_component(webrtc::ICE_CANDIDATE_COMPONENT_RTP); - c.set_protocol(webrtc::UDP_PROTOCOL_NAME); - c.set_address(webrtc::SocketAddress("example.local", 1234)); + Candidate c; + c.set_component(ICE_CANDIDATE_COMPONENT_RTP); + c.set_protocol(UDP_PROTOCOL_NAME); + c.set_address(SocketAddress("example.local", 1234)); c.set_type(IceCandidateType::kHost); const size_t audio_index = 0; const size_t video_index = 1; @@ -375,14 +369,14 @@ TEST_F(JsepSessionDescriptionTest, SerializeDeserializeWithCandidates) { // is used as default address in c line according to preference. TEST_F(JsepSessionDescriptionTest, SerializeSessionDescriptionWithIPv6Only) { // Stun has a high preference than local host. - webrtc::Candidate candidate1( - webrtc::ICE_CANDIDATE_COMPONENT_RTP, "udp", - webrtc::SocketAddress("::1", 1234), kCandidatePriority, "", "", - IceCandidateType::kSrflx, kCandidateGeneration, kCandidateFoundation); - webrtc::Candidate candidate2( - webrtc::ICE_CANDIDATE_COMPONENT_RTP, "udp", - webrtc::SocketAddress("::2", 1235), kCandidatePriority, "", "", - IceCandidateType::kHost, kCandidateGeneration, kCandidateFoundation); + Candidate candidate1(ICE_CANDIDATE_COMPONENT_RTP, "udp", + SocketAddress("::1", 1234), kCandidatePriority, "", "", + IceCandidateType::kSrflx, kCandidateGeneration, + kCandidateFoundation); + Candidate candidate2(ICE_CANDIDATE_COMPONENT_RTP, "udp", + SocketAddress("::2", 1235), kCandidatePriority, "", "", + IceCandidateType::kHost, kCandidateGeneration, + kCandidateFoundation); IceCandidate jice1("audio", 0, candidate1); IceCandidate jice2("audio", 0, candidate2); @@ -405,14 +399,14 @@ TEST_F(JsepSessionDescriptionTest, SerializeSessionDescriptionWithIPv6Only) { // preference of IPv4 is lower. TEST_F(JsepSessionDescriptionTest, SerializeSessionDescriptionWithBothIPFamilies) { - webrtc::Candidate candidate_v4( - webrtc::ICE_CANDIDATE_COMPONENT_RTP, "udp", - webrtc::SocketAddress("192.168.1.5", 1234), kCandidatePriority, "", "", - IceCandidateType::kSrflx, kCandidateGeneration, kCandidateFoundation); - webrtc::Candidate candidate_v6( - webrtc::ICE_CANDIDATE_COMPONENT_RTP, "udp", - webrtc::SocketAddress("::1", 1234), kCandidatePriority, "", "", - IceCandidateType::kHost, kCandidateGeneration, kCandidateFoundation); + Candidate candidate_v4(ICE_CANDIDATE_COMPONENT_RTP, "udp", + SocketAddress("192.168.1.5", 1234), kCandidatePriority, + "", "", IceCandidateType::kSrflx, kCandidateGeneration, + kCandidateFoundation); + Candidate candidate_v6(ICE_CANDIDATE_COMPONENT_RTP, "udp", + SocketAddress("::1", 1234), kCandidatePriority, "", "", + IceCandidateType::kHost, kCandidateGeneration, + kCandidateFoundation); IceCandidate jice_v4("audio", 0, candidate_v4); IceCandidate jice_v6("audio", 0, candidate_v6); @@ -436,15 +430,14 @@ TEST_F(JsepSessionDescriptionTest, TEST_F(JsepSessionDescriptionTest, SerializeSessionDescriptionWithBothProtocols) { // Stun has a high preference than local host. - webrtc::Candidate candidate1( - webrtc::ICE_CANDIDATE_COMPONENT_RTP, "tcp", - webrtc::SocketAddress("::1", 1234), kCandidatePriority, "", "", - IceCandidateType::kSrflx, kCandidateGeneration, kCandidateFoundation); - webrtc::Candidate candidate2( - webrtc::ICE_CANDIDATE_COMPONENT_RTP, "udp", - webrtc::SocketAddress("fe80::1234:5678:abcd:ef12", 1235), - kCandidatePriority, "", "", IceCandidateType::kHost, kCandidateGeneration, - kCandidateFoundation); + Candidate candidate1(ICE_CANDIDATE_COMPONENT_RTP, "tcp", + SocketAddress("::1", 1234), kCandidatePriority, "", "", + IceCandidateType::kSrflx, kCandidateGeneration, + kCandidateFoundation); + Candidate candidate2(ICE_CANDIDATE_COMPONENT_RTP, "udp", + SocketAddress("fe80::1234:5678:abcd:ef12", 1235), + kCandidatePriority, "", "", IceCandidateType::kHost, + kCandidateGeneration, kCandidateFoundation); IceCandidate jice1("audio", 0, candidate1); IceCandidate jice2("audio", 0, candidate2); @@ -467,14 +460,14 @@ TEST_F(JsepSessionDescriptionTest, // null IPv4 is used as default address in c line. TEST_F(JsepSessionDescriptionTest, SerializeSessionDescriptionWithTCPOnly) { // Stun has a high preference than local host. - webrtc::Candidate candidate1( - webrtc::ICE_CANDIDATE_COMPONENT_RTP, "tcp", - webrtc::SocketAddress("::1", 1234), kCandidatePriority, "", "", - IceCandidateType::kSrflx, kCandidateGeneration, kCandidateFoundation); - webrtc::Candidate candidate2( - webrtc::ICE_CANDIDATE_COMPONENT_RTP, "tcp", - webrtc::SocketAddress("::2", 1235), kCandidatePriority, "", "", - IceCandidateType::kHost, kCandidateGeneration, kCandidateFoundation); + Candidate candidate1(ICE_CANDIDATE_COMPONENT_RTP, "tcp", + SocketAddress("::1", 1234), kCandidatePriority, "", "", + IceCandidateType::kSrflx, kCandidateGeneration, + kCandidateFoundation); + Candidate candidate2(ICE_CANDIDATE_COMPONENT_RTP, "tcp", + SocketAddress("::2", 1235), kCandidatePriority, "", "", + IceCandidateType::kHost, kCandidateGeneration, + kCandidateFoundation); IceCandidate jice1("audio", 0, candidate1); IceCandidate jice2("audio", 0, candidate2); @@ -494,22 +487,22 @@ TEST_F(JsepSessionDescriptionTest, SerializeSessionDescriptionWithTCPOnly) { // Tests that the connection address will be correctly set when the Candidate is // removed. TEST_F(JsepSessionDescriptionTest, RemoveCandidateAndSetConnectionAddress) { - webrtc::Candidate candidate1( - webrtc::ICE_CANDIDATE_COMPONENT_RTP, "udp", - webrtc::SocketAddress("::1", 1234), kCandidatePriority, "", "", - IceCandidateType::kHost, kCandidateGeneration, kCandidateFoundation); + Candidate candidate1(ICE_CANDIDATE_COMPONENT_RTP, "udp", + SocketAddress("::1", 1234), kCandidatePriority, "", "", + IceCandidateType::kHost, kCandidateGeneration, + kCandidateFoundation); candidate1.set_transport_name("audio"); - webrtc::Candidate candidate2( - webrtc::ICE_CANDIDATE_COMPONENT_RTP, "tcp", - webrtc::SocketAddress("::2", 1235), kCandidatePriority, "", "", - IceCandidateType::kHost, kCandidateGeneration, kCandidateFoundation); + Candidate candidate2(ICE_CANDIDATE_COMPONENT_RTP, "tcp", + SocketAddress("::2", 1235), kCandidatePriority, "", "", + IceCandidateType::kHost, kCandidateGeneration, + kCandidateFoundation); candidate2.set_transport_name("audio"); - webrtc::Candidate candidate3( - webrtc::ICE_CANDIDATE_COMPONENT_RTP, "udp", - webrtc::SocketAddress("192.168.1.1", 1236), kCandidatePriority, "", "", - IceCandidateType::kHost, kCandidateGeneration, kCandidateFoundation); + Candidate candidate3(ICE_CANDIDATE_COMPONENT_RTP, "udp", + SocketAddress("192.168.1.1", 1236), kCandidatePriority, + "", "", IceCandidateType::kHost, kCandidateGeneration, + kCandidateFoundation); candidate3.set_transport_name("audio"); IceCandidate jice1("audio", 0, candidate1); @@ -524,7 +517,7 @@ TEST_F(JsepSessionDescriptionTest, RemoveCandidateAndSetConnectionAddress) { ASSERT_TRUE(jsep_desc_->AddCandidate(&jice2)); ASSERT_TRUE(jsep_desc_->AddCandidate(&jice3)); - std::vector<webrtc::Candidate> candidates; + std::vector<Candidate> candidates; EXPECT_EQ("192.168.1.1:1236", media_desc->connection_address().ToString()); candidates.push_back(candidate3); @@ -549,8 +542,8 @@ class EnumerateAllSdpTypesTest : public ::testing::Test, TEST_P(EnumerateAllSdpTypesTest, TestIdentity) { SdpType type = GetParam(); - const char* str = webrtc::SdpTypeToString(type); - EXPECT_EQ(type, webrtc::SdpTypeFromString(str)); + const char* str = SdpTypeToString(type); + EXPECT_EQ(type, SdpTypeFromString(str)); } INSTANTIATE_TEST_SUITE_P(JsepSessionDescriptionTest, @@ -558,3 +551,5 @@ INSTANTIATE_TEST_SUITE_P(JsepSessionDescriptionTest, Values(SdpType::kOffer, SdpType::kPrAnswer, SdpType::kAnswer)); + +} // namespace webrtc