Fix handling of partial match for GetVpnUnderlyingAdapterType

This is a followup to https://webrtc-review.googlesource.com/c/src/+/211003
and fixes the problem pointed out by deadbeef@, thanks!

Bug: webrtc:10707
Change-Id: I8dea842b25ba15416353ce4002356183087873c7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211344
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33436}
This commit is contained in:
Jonas Oreland
2021-03-11 12:52:52 +01:00
committed by Commit Bot
parent fd1e9d1af4
commit b7227a5a10
3 changed files with 28 additions and 1 deletions

View File

@ -149,5 +149,19 @@ TEST_F(AndroidNetworkMonitorTest, TestFindNetworkHandleUsingIfName) {
EXPECT_EQ(ipv6_handle, *network_handle2);
}
TEST_F(AndroidNetworkMonitorTest, TestUnderlyingVpnType) {
ScopedFieldTrials field_trials("WebRTC-BindUsingInterfaceName/Enabled/");
jni::NetworkHandle ipv4_handle = 100;
rtc::IPAddress ipv4_address(kTestIpv4Address);
jni::NetworkInformation net_info =
CreateNetworkInformation("wlan0", ipv4_handle, ipv4_address);
net_info.type = jni::NETWORK_VPN;
net_info.underlying_type_for_vpn = jni::NETWORK_WIFI;
network_monitor_->SetNetworkInfos({net_info});
EXPECT_EQ(rtc::ADAPTER_TYPE_WIFI,
network_monitor_->GetVpnUnderlyingAdapterType("v4-wlan0"));
}
} // namespace test
} // namespace webrtc