tor-browser

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

commit 280cfdbc030546453221f8d6b97699bf182ef0b4
parent b57de3573ed0ed29dae8c6f1243b56a9f7f98996
Author: Dan Baker <dbaker@mozilla.com>
Date:   Wed, 22 Oct 2025 15:46:37 -0600

Bug 1995393 - Vendor libwebrtc from 7acf831822

Upstream commit: https://webrtc.googlesource.com/src/+/7acf831822281cc7d5e20568ab734cf31635f0e4
    Deflake P2PTransportChannelTest.TestIceConfigWillPassDownToPort test

    This test currently pass, but is brittle: It claims and relies on 1st
    endpoint to have higher tiebreaker value, however those values are
    randomly generated and thus there is no guarantee that 1st endpoint
    would always have higher tiebreaker. The test pass because it currently
    doesn't hit OnRoleConflict callback, but with unrelated refactoring it
    can start hitting it and then would start to fail.

    While changing this test, also rewrite expectations to be concise.

    Bug: None
    Change-Id: Ice8e0026e9ee81bcd00c810e1f170136d1e2a771
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/403680
    Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
    Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#45316}

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/p2p/base/p2p_transport_channel_unittest.cc | 32++++++++++++++++----------------
2 files changed, 18 insertions(+), 18 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 /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc -libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-22T21:43:05.832067+00:00. +libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-22T21:46:17.788142+00:00. # base of lastest vendoring -d121734ee7 +7acf831822 diff --git a/third_party/libwebrtc/p2p/base/p2p_transport_channel_unittest.cc b/third_party/libwebrtc/p2p/base/p2p_transport_channel_unittest.cc @@ -112,6 +112,7 @@ using ::testing::Gt; using ::testing::MockFunction; using ::testing::Ne; using ::testing::NotNull; +using ::testing::Property; using ::testing::Return; using ::testing::ReturnRef; using ::testing::SetArgPointee; @@ -387,7 +388,6 @@ class P2PTransportChannelTestBase : public ::testing::Test, struct Endpoint : public sigslot::has_slots<> { Endpoint() : role_(ICEROLE_UNKNOWN), - tiebreaker_(0), role_conflict_(false), save_candidates_(false) {} bool HasTransport(const PacketTransportInternal* transport) { @@ -427,7 +427,6 @@ class P2PTransportChannelTestBase : public ::testing::Test, ChannelData cd1_; ChannelData cd2_; IceRole role_; - uint64_t tiebreaker_; bool role_conflict_; bool save_candidates_; std::vector<CandidateData> saved_candidates_; @@ -1949,28 +1948,30 @@ TEST_F(P2PTransportChannelTest, TestIceConfigWillPassDownToPort) { AddAddress(0, kPublicAddrs[0]); AddAddress(1, kPublicAddrs[1]); - // Give the first connection the higher tiebreaker so its role won't - // change unless we tell it to. SetIceRole(0, ICEROLE_CONTROLLING); SetIceRole(1, ICEROLE_CONTROLLING); CreateChannels(env); - EXPECT_THAT(WaitUntil([&] { return ep1_ch1()->ports().size(); }, Eq(2u), + // Pick channel with the higher tiebreaker so its role won't change unless we + // tell it to. + P2PTransportChannel* channel = + GetEndpoint(0)->allocator_->ice_tiebreaker() > + GetEndpoint(1)->allocator_->ice_tiebreaker() + ? ep1_ch1() + : ep2_ch1(); + + EXPECT_THAT(WaitUntil([&] { return channel->ports(); }, SizeIs(2), {.timeout = kShortTimeout, .clock = &clock}), IsRtcOk()); - const std::vector<PortInterface*> ports_before = ep1_ch1()->ports(); - for (size_t i = 0; i < ports_before.size(); ++i) { - EXPECT_EQ(ICEROLE_CONTROLLING, ports_before[i]->GetIceRole()); - } + EXPECT_THAT(channel->ports(), Each(Property(&PortInterface::GetIceRole, + Eq(ICEROLE_CONTROLLING)))); - ep1_ch1()->SetIceRole(ICEROLE_CONTROLLED); + channel->SetIceRole(ICEROLE_CONTROLLED); - const std::vector<PortInterface*> ports_after = ep1_ch1()->ports(); - for (size_t i = 0; i < ports_after.size(); ++i) { - EXPECT_EQ(ICEROLE_CONTROLLED, ports_before[i]->GetIceRole()); - } + EXPECT_THAT(channel->ports(), Each(Property(&PortInterface::GetIceRole, + Eq(ICEROLE_CONTROLLED)))); EXPECT_TRUE(WaitUntil([&] { return CheckConnected(ep1_ch1(), ep2_ch1()); }, {.timeout = kShortTimeout, .clock = &clock})); @@ -2380,8 +2381,7 @@ TEST_F(P2PTransportChannelTest, kDefaultPortAllocatorFlags | PORTALLOCATOR_DISABLE_UDP | PORTALLOCATOR_DISABLE_STUN | PORTALLOCATOR_DISABLE_TCP); - // With conflicting ICE roles, endpoint 1 has the higher tie breaker and will - // send a binding error response. + SetIceRole(0, ICEROLE_CONTROLLING); SetIceRole(1, ICEROLE_CONTROLLING); // We want the remote TURN candidate to show up as prflx. To do this we need