Improve testing in stun_port_unittest
Before this cl, the test only used local addresses
(i.e. no NAT) and therefor could not really distinguish
between a server reflexive address and a host address.
Consequently, there were multiple errors in the test
that compared against "wrong ip", (which happened to
pass since there was really onyy 1 ip used).
I noticed the totally bogus testing when adding a feature to StunPort.
BONUS: Create a binary rtc_p2p_unittest that run only the
p2p/ unittests :)
BUG=b/378415408
Change-Id: I19fb0b556efca1053a23eccc3129670395a95d48
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/378823
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Auto-Submit: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43987}
diff --git a/BUILD.gn b/BUILD.gn
index 0d4c96d..689de89 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -47,6 +47,7 @@
}
if (rtc_include_tests) {
deps += [
+ ":rtc_p2p_unittests",
":rtc_unittests",
":video_engine_tests",
":voip_unittests",
@@ -646,8 +647,6 @@
"api/video_codecs/test:video_codecs_api_unittests",
"api/voip:compile_all_headers",
"call:fake_network_pipe_unittests",
- "p2p:libstunprober_unittests",
- "p2p:rtc_p2p_unittests",
"rtc_base:async_dns_resolver_unittests",
"rtc_base:async_packet_socket_unittest",
"rtc_base:async_udp_socket_unittest",
@@ -697,6 +696,16 @@
}
}
+ rtc_test("rtc_p2p_unittests") {
+ testonly = true
+
+ deps = [
+ "p2p:libstunprober_unittests",
+ "p2p:rtc_p2p_unittests",
+ "test:test_main",
+ ]
+ }
+
if (rtc_enable_google_benchmarks) {
rtc_test("benchmarks") {
testonly = true
diff --git a/infra/specs/client.webrtc.json b/infra/specs/client.webrtc.json
index 2b1e795..d48747f 100644
--- a/infra/specs/client.webrtc.json
+++ b/infra/specs/client.webrtc.json
@@ -210,6 +210,26 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "enable": true,
+ "has_native_resultdb_integration": true
+ },
+ "swarming": {
+ "dimensions": {
+ "android_devices": "1",
+ "device_type": "walleye",
+ "os": "Android"
+ },
+ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_gtest_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"enable": true,
@@ -685,6 +705,26 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "enable": true,
+ "has_native_resultdb_integration": true
+ },
+ "swarming": {
+ "dimensions": {
+ "android_devices": "1",
+ "device_type": "walleye",
+ "os": "Android"
+ },
+ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_gtest_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"enable": true,
@@ -1188,6 +1228,26 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "enable": true,
+ "has_native_resultdb_integration": true
+ },
+ "swarming": {
+ "dimensions": {
+ "android_devices": "1",
+ "device_type": "walleye",
+ "os": "Android"
+ },
+ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_gtest_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"enable": true,
@@ -1663,6 +1723,26 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "enable": true,
+ "has_native_resultdb_integration": true
+ },
+ "swarming": {
+ "dimensions": {
+ "android_devices": "1",
+ "device_type": "walleye",
+ "os": "Android"
+ },
+ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_gtest_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"enable": true,
@@ -2064,6 +2144,30 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_file": "${ISOLATED_OUTDIR}/gtest_output.json",
+ "result_format": "gtest_json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Ubuntu-22.04"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "args": [
+ "--test-launcher-summary-output=${ISOLATED_OUTDIR}/gtest_output.json",
+ "--test-arg=--gtest_output=json:/custom_artifacts/gtest_output.json",
+ "--test-arg=--undefok=test_launcher_summary_output",
+ "--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
+ ],
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_file": "${ISOLATED_OUTDIR}/gtest_output.json",
@@ -2369,6 +2473,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Ubuntu-20.04"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -2719,6 +2840,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Ubuntu-20.04"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -3052,6 +3190,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Ubuntu-20.04"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -3385,6 +3540,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Ubuntu-20.04"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -3735,6 +3907,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Ubuntu-20.04"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -4085,6 +4274,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Ubuntu-22.04"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -4419,6 +4625,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Ubuntu-22.04"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -4754,6 +4977,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Ubuntu-22.04"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -5105,6 +5345,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Ubuntu-22.04"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -5465,6 +5722,24 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cores": "12",
+ "cpu": "x86-64",
+ "os": "Mac-14"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -5818,6 +6093,24 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cores": "12",
+ "cpu": "x86-64",
+ "os": "Mac-14"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -6162,6 +6455,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Mac-14"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -6495,6 +6805,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "arm64-64-Apple_M1",
+ "os": "Mac-14"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -6853,6 +7180,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Windows-10-19045"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -7186,6 +7530,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Windows-10-19045"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -7519,6 +7880,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Windows-10-19045"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -7852,6 +8230,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Windows-10-19045"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -9221,6 +9616,150 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests iPhone 14 17.5",
+ "resultdb": {
+ "enable": true,
+ "has_native_resultdb_integration": true
+ },
+ "swarming": {
+ "cipd_packages": [
+ {
+ "cipd_package": "infra/tools/mac_toolchain/${platform}",
+ "location": ".",
+ "revision": "git_revision:a18b7d95d26f3c6bf9591978b19cf0ca8268ac7d"
+ }
+ ],
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Mac-14"
+ },
+ "named_caches": [
+ {
+ "name": "xcode_ios_16a5230g",
+ "path": "Xcode.app"
+ },
+ {
+ "name": "runtime_ios_17_5",
+ "path": "Runtime-ios-17.5"
+ }
+ ],
+ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/",
+ "variant_id": "iPhone 14 17.5"
+ },
+ {
+ "args": [
+ "--platform",
+ "iPhone 15",
+ "--version",
+ "18.0",
+ "--xcode-build-version",
+ "16a5230g",
+ "--out-dir",
+ "${ISOLATED_OUTDIR}",
+ "--xctest"
+ ],
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
+ "name": "rtc_p2p_unittests iPhone 15 18.0",
+ "resultdb": {
+ "enable": true,
+ "has_native_resultdb_integration": true
+ },
+ "swarming": {
+ "cipd_packages": [
+ {
+ "cipd_package": "infra/tools/mac_toolchain/${platform}",
+ "location": ".",
+ "revision": "git_revision:a18b7d95d26f3c6bf9591978b19cf0ca8268ac7d"
+ }
+ ],
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Mac-14"
+ },
+ "named_caches": [
+ {
+ "name": "xcode_ios_16a5230g",
+ "path": "Xcode.app"
+ },
+ {
+ "name": "runtime_ios_18_0",
+ "path": "Runtime-ios-18.0"
+ }
+ ],
+ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/",
+ "variant_id": "iPhone 15 18.0"
+ },
+ {
+ "args": [
+ "--platform",
+ "iPhone X",
+ "--version",
+ "16.4",
+ "--xcode-build-version",
+ "16a5230g",
+ "--out-dir",
+ "${ISOLATED_OUTDIR}",
+ "--xctest"
+ ],
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
+ "name": "rtc_p2p_unittests iPhone X 16.4",
+ "resultdb": {
+ "enable": true,
+ "has_native_resultdb_integration": true
+ },
+ "swarming": {
+ "cipd_packages": [
+ {
+ "cipd_package": "infra/tools/mac_toolchain/${platform}",
+ "location": ".",
+ "revision": "git_revision:a18b7d95d26f3c6bf9591978b19cf0ca8268ac7d"
+ }
+ ],
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Mac-14"
+ },
+ "named_caches": [
+ {
+ "name": "xcode_ios_16a5230g",
+ "path": "Xcode.app"
+ },
+ {
+ "name": "runtime_ios_16_4",
+ "path": "Runtime-ios-16.4"
+ }
+ ],
+ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/",
+ "variant_id": "iPhone X 16.4"
+ },
+ {
+ "args": [
+ "--platform",
+ "iPhone 14",
+ "--version",
+ "17.5",
+ "--xcode-build-version",
+ "16a5230g",
+ "--out-dir",
+ "${ISOLATED_OUTDIR}",
+ "--xctest"
+ ],
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests iPhone 14 17.5",
"resultdb": {
"enable": true,
diff --git a/infra/specs/gn_isolate_map.pyl b/infra/specs/gn_isolate_map.pyl
index 4031b4d..20de759 100644
--- a/infra/specs/gn_isolate_map.pyl
+++ b/infra/specs/gn_isolate_map.pyl
@@ -84,6 +84,10 @@
"label": "//media:rtc_media_unittests",
"type": "console_test_launcher",
},
+ "rtc_p2p_unittests": {
+ "label": "//:rtc_p2p_unittests",
+ "type": "console_test_launcher",
+ },
"rtc_pc_unittests": {
"label": "//pc:rtc_pc_unittests",
"type": "console_test_launcher",
diff --git a/infra/specs/internal.client.webrtc.json b/infra/specs/internal.client.webrtc.json
index 0e3336d..87ae7fc 100644
--- a/infra/specs/internal.client.webrtc.json
+++ b/infra/specs/internal.client.webrtc.json
@@ -175,6 +175,45 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "enable": true,
+ "has_native_resultdb_integration": true
+ },
+ "swarming": {
+ "cipd_packages": [
+ {
+ "cipd_package": "infra/tools/mac_toolchain/${platform}",
+ "location": ".",
+ "revision": "git_revision:a18b7d95d26f3c6bf9591978b19cf0ca8268ac7d"
+ }
+ ],
+ "dimensions": {
+ "os": "iOS-18",
+ "pool": "chrome.tests"
+ },
+ "named_caches": [
+ {
+ "name": "xcode_ios_15f31d",
+ "path": "Xcode.app"
+ }
+ ],
+ "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com"
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "args": [
+ "--xctest",
+ "--xcode-build-version",
+ "15f31d",
+ "--out-dir",
+ "${ISOLATED_OUTDIR}"
+ ],
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"enable": true,
@@ -628,6 +667,45 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "enable": true,
+ "has_native_resultdb_integration": true
+ },
+ "swarming": {
+ "cipd_packages": [
+ {
+ "cipd_package": "infra/tools/mac_toolchain/${platform}",
+ "location": ".",
+ "revision": "git_revision:a18b7d95d26f3c6bf9591978b19cf0ca8268ac7d"
+ }
+ ],
+ "dimensions": {
+ "os": "iOS-18",
+ "pool": "chrome.tests"
+ },
+ "named_caches": [
+ {
+ "name": "xcode_ios_15f31d",
+ "path": "Xcode.app"
+ }
+ ],
+ "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com"
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "args": [
+ "--xctest",
+ "--xcode-build-version",
+ "15f31d",
+ "--out-dir",
+ "${ISOLATED_OUTDIR}"
+ ],
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"enable": true,
diff --git a/infra/specs/test_suites.pyl b/infra/specs/test_suites.pyl
index 2680fc0..051ae50 100644
--- a/infra/specs/test_suites.pyl
+++ b/infra/specs/test_suites.pyl
@@ -35,6 +35,7 @@
'mixins': ['shards-4'],
},
'rtc_media_unittests': {},
+ 'rtc_p2p_unittests': {},
'rtc_pc_unittests': {},
'rtc_stats_unittests': {},
'rtc_unittests': {
@@ -77,6 +78,7 @@
'mixins': ['shards-4'],
},
'rtc_media_unittests': {},
+ 'rtc_p2p_unittests': {},
'rtc_pc_unittests': {},
'rtc_stats_unittests': {},
'rtc_unittests': {
@@ -117,6 +119,7 @@
# TODO(bugs.webrtc.org/14705): Enable when NonGlobalFieldTrialsInstanceDoesNotModifyGlobalString is fixed.
# TODO(bugs.webrtc.org/14700): Enable when NetworkTest tests are fixed.
# 'rtc_unittests': {},
+ 'rtc_p2p_unittests': {},
'rtc_pc_unittests': {},
'svc_tests': {
'mixins': ['shards-4'],
@@ -150,6 +153,7 @@
'modules_unittests': {
'mixins': ['shards-6'],
},
+ 'rtc_p2p_unittests': {},
'rtc_pc_unittests': {},
'rtc_stats_unittests': {},
# TODO(bugs.webrtc.org/11362): Real XCTests fail to start on devices.
@@ -177,6 +181,7 @@
'mixins': ['shards-6', 'cores-12'],
},
'rtc_media_unittests': {},
+ 'rtc_p2p_unittests': {},
'rtc_pc_unittests': {},
'rtc_stats_unittests': {},
'rtc_unittests': {
diff --git a/infra/specs/tryserver.webrtc.json b/infra/specs/tryserver.webrtc.json
index 2bb6d1a..43cc488 100644
--- a/infra/specs/tryserver.webrtc.json
+++ b/infra/specs/tryserver.webrtc.json
@@ -210,6 +210,26 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "enable": true,
+ "has_native_resultdb_integration": true
+ },
+ "swarming": {
+ "dimensions": {
+ "android_devices": "1",
+ "device_type": "walleye",
+ "os": "Android"
+ },
+ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_gtest_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"enable": true,
@@ -734,6 +754,26 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "enable": true,
+ "has_native_resultdb_integration": true
+ },
+ "swarming": {
+ "dimensions": {
+ "android_devices": "1",
+ "device_type": "walleye",
+ "os": "Android"
+ },
+ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_gtest_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"enable": true,
@@ -1258,6 +1298,26 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "enable": true,
+ "has_native_resultdb_integration": true
+ },
+ "swarming": {
+ "dimensions": {
+ "android_devices": "1",
+ "device_type": "walleye",
+ "os": "Android"
+ },
+ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_gtest_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"enable": true,
@@ -1807,6 +1867,26 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "enable": true,
+ "has_native_resultdb_integration": true
+ },
+ "swarming": {
+ "dimensions": {
+ "android_devices": "1",
+ "device_type": "walleye",
+ "os": "Android"
+ },
+ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_gtest_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"enable": true,
@@ -2262,6 +2342,30 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_file": "${ISOLATED_OUTDIR}/gtest_output.json",
+ "result_format": "gtest_json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Ubuntu-22.04"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "args": [
+ "--test-launcher-summary-output=${ISOLATED_OUTDIR}/gtest_output.json",
+ "--test-arg=--gtest_output=json:/custom_artifacts/gtest_output.json",
+ "--test-arg=--undefok=test_launcher_summary_output",
+ "--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
+ ],
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_file": "${ISOLATED_OUTDIR}/gtest_output.json",
@@ -3583,6 +3687,150 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests iPhone 14 17.5",
+ "resultdb": {
+ "enable": true,
+ "has_native_resultdb_integration": true
+ },
+ "swarming": {
+ "cipd_packages": [
+ {
+ "cipd_package": "infra/tools/mac_toolchain/${platform}",
+ "location": ".",
+ "revision": "git_revision:a18b7d95d26f3c6bf9591978b19cf0ca8268ac7d"
+ }
+ ],
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Mac-14"
+ },
+ "named_caches": [
+ {
+ "name": "xcode_ios_16a5230g",
+ "path": "Xcode.app"
+ },
+ {
+ "name": "runtime_ios_17_5",
+ "path": "Runtime-ios-17.5"
+ }
+ ],
+ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/",
+ "variant_id": "iPhone 14 17.5"
+ },
+ {
+ "args": [
+ "--platform",
+ "iPhone 15",
+ "--version",
+ "18.0",
+ "--xcode-build-version",
+ "16a5230g",
+ "--out-dir",
+ "${ISOLATED_OUTDIR}",
+ "--xctest"
+ ],
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
+ "name": "rtc_p2p_unittests iPhone 15 18.0",
+ "resultdb": {
+ "enable": true,
+ "has_native_resultdb_integration": true
+ },
+ "swarming": {
+ "cipd_packages": [
+ {
+ "cipd_package": "infra/tools/mac_toolchain/${platform}",
+ "location": ".",
+ "revision": "git_revision:a18b7d95d26f3c6bf9591978b19cf0ca8268ac7d"
+ }
+ ],
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Mac-14"
+ },
+ "named_caches": [
+ {
+ "name": "xcode_ios_16a5230g",
+ "path": "Xcode.app"
+ },
+ {
+ "name": "runtime_ios_18_0",
+ "path": "Runtime-ios-18.0"
+ }
+ ],
+ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/",
+ "variant_id": "iPhone 15 18.0"
+ },
+ {
+ "args": [
+ "--platform",
+ "iPhone X",
+ "--version",
+ "16.4",
+ "--xcode-build-version",
+ "16a5230g",
+ "--out-dir",
+ "${ISOLATED_OUTDIR}",
+ "--xctest"
+ ],
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
+ "name": "rtc_p2p_unittests iPhone X 16.4",
+ "resultdb": {
+ "enable": true,
+ "has_native_resultdb_integration": true
+ },
+ "swarming": {
+ "cipd_packages": [
+ {
+ "cipd_package": "infra/tools/mac_toolchain/${platform}",
+ "location": ".",
+ "revision": "git_revision:a18b7d95d26f3c6bf9591978b19cf0ca8268ac7d"
+ }
+ ],
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Mac-14"
+ },
+ "named_caches": [
+ {
+ "name": "xcode_ios_16a5230g",
+ "path": "Xcode.app"
+ },
+ {
+ "name": "runtime_ios_16_4",
+ "path": "Runtime-ios-16.4"
+ }
+ ],
+ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/",
+ "variant_id": "iPhone X 16.4"
+ },
+ {
+ "args": [
+ "--platform",
+ "iPhone 14",
+ "--version",
+ "17.5",
+ "--xcode-build-version",
+ "16a5230g",
+ "--out-dir",
+ "${ISOLATED_OUTDIR}",
+ "--xctest"
+ ],
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests iPhone 14 17.5",
"resultdb": {
"enable": true,
@@ -5462,6 +5710,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Ubuntu-20.04"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -5827,6 +6092,24 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Ubuntu-22.04"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "isolate_profile_data": true,
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -6236,6 +6519,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Ubuntu-22.04"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -6609,6 +6909,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Ubuntu-20.04"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -6942,6 +7259,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Ubuntu-22.04"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -7338,6 +7672,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Ubuntu-20.04"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -7671,6 +8022,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Ubuntu-20.04"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -8021,6 +8389,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Ubuntu-20.04"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -8371,6 +8756,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Ubuntu-22.04"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -8704,6 +9106,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Ubuntu-22.04"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -9045,6 +9464,24 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cores": "12",
+ "cpu": "x86-64",
+ "os": "Mac-14"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -9399,6 +9836,24 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cores": "12",
+ "cpu": "x86-64",
+ "os": "Mac-14"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -9743,6 +10198,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "arm64-64-Apple_M1",
+ "os": "Mac-14"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -10076,6 +10548,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Mac-14"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -10455,6 +10944,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "arm64-64-Apple_M1",
+ "os": "Mac-14"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -10788,6 +11294,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Windows-11-22000"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -11121,6 +11644,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Windows-11-22000"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -11500,6 +12040,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Windows-10-19045"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -11837,6 +12394,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Windows-10-19045"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -12170,6 +12744,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Windows-10-19045"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -12503,6 +13094,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Windows-10-19045"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
@@ -12836,6 +13444,23 @@
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
+ "name": "rtc_p2p_unittests",
+ "resultdb": {
+ "result_format": "json"
+ },
+ "swarming": {
+ "dimensions": {
+ "cpu": "x86-64",
+ "os": "Windows-10-19045"
+ }
+ },
+ "test": "rtc_p2p_unittests",
+ "test_id_prefix": "ninja://:rtc_p2p_unittests/"
+ },
+ {
+ "merge": {
+ "script": "//testing/merge_scripts/standard_isolated_script_merge.py"
+ },
"name": "rtc_pc_unittests",
"resultdb": {
"result_format": "json"
diff --git a/p2p/base/stun_port_unittest.cc b/p2p/base/stun_port_unittest.cc
index ac812da..512061e 100644
--- a/p2p/base/stun_port_unittest.cc
+++ b/p2p/base/stun_port_unittest.cc
@@ -14,7 +14,9 @@
#include <cstdint>
#include <memory>
#include <optional>
+#include <set>
#include <string>
+#include <vector>
#include "absl/functional/any_invocable.h"
#include "api/candidate.h"
@@ -33,9 +35,11 @@
#include "rtc_base/crypto_random.h"
#include "rtc_base/dscp.h"
#include "rtc_base/fake_clock.h"
+#include "rtc_base/fake_network.h"
#include "rtc_base/gunit.h"
#include "rtc_base/ip_address.h"
#include "rtc_base/mdns_responder_interface.h"
+#include "rtc_base/nat_socket_factory.h"
#include "rtc_base/net_helpers.h"
#include "rtc_base/network.h"
#include "rtc_base/network/received_packet.h"
@@ -63,12 +67,21 @@
using ::testing::SetArgPointee;
using webrtc::IceCandidateType;
-static const SocketAddress kLocalAddr("127.0.0.1", 0);
-static const SocketAddress kIPv6LocalAddr("::1", 0);
-static const SocketAddress kStunAddr1("127.0.0.1", 5000);
-static const SocketAddress kStunAddr2("127.0.0.1", 4000);
-static const SocketAddress kStunAddr3("127.0.0.1", 3000);
-static const SocketAddress kIPv6StunAddr1("::1", 5000);
+static const SocketAddress kPrivateIP("192.168.1.12", 0);
+static const SocketAddress kMsdnAddress("unittest-mdns-host-name.local", 0);
+static const SocketAddress kPublicIP("212.116.91.133", 0);
+static const SocketAddress kNatAddr(kPublicIP.ipaddr(),
+ rtc::NAT_SERVER_UDP_PORT);
+static const SocketAddress kStunServerAddr1("34.38.54.120", 5000);
+static const SocketAddress kStunServerAddr2("34.38.54.120", 4000);
+
+static const SocketAddress kPrivateIPv6("2001:4860:4860::8844", 0);
+static const SocketAddress kPublicIPv6("2002:4860:4860::8844", 5000);
+static const SocketAddress kNatAddrIPv6(kPublicIPv6.ipaddr(),
+ rtc::NAT_SERVER_UDP_PORT);
+static const SocketAddress kStunServerAddrIPv6Addr("2003:4860:4860::8844",
+ 5000);
+
static const SocketAddress kBadAddr("0.0.0.1", 5000);
static const SocketAddress kIPv6BadAddr("::ffff:0:1", 5000);
static const SocketAddress kValidHostnameAddr("valid-hostname", 5000);
@@ -79,9 +92,9 @@
// stun prio = 100 (srflx) << 24 | 30 (IPv4) << 8 | 256 - 1 (component)
static const uint32_t kStunCandidatePriority =
(100 << 24) | (30 << 8) | (256 - 1);
-// stun prio = 100 (srflx) << 24 | 60 (loopback IPv6) << 8 | 256 - 1 (component)
+// stun prio = 100 (srflx) << 24 | 40 (IPv6) << 8 | 256 - 1 (component)
static const uint32_t kIPv6StunCandidatePriority =
- (100 << 24) | (60 << 8) | (256 - 1);
+ (100 << 24) | (40 << 8) | (256 - 1);
static const int kInfiniteLifetime = -1;
static const int kHighCostPortKeepaliveLifetimeMs = 2 * 60 * 1000;
@@ -91,7 +104,7 @@
public:
void CreateNameForAddress(const rtc::IPAddress& addr,
NameCreatedCallback callback) override {
- callback(addr, std::string("unittest-mdns-host-name.local"));
+ callback(addr, kMsdnAddress.HostAsSensitiveURIString());
}
void RemoveNameForAddress(const rtc::IPAddress& addr,
@@ -115,32 +128,43 @@
class StunPortTestBase : public ::testing::Test, public sigslot::has_slots<> {
public:
StunPortTestBase()
- : StunPortTestBase(
- rtc::Network("unittest", "unittest", kLocalAddr.ipaddr(), 32),
- kLocalAddr.ipaddr()) {}
+ : StunPortTestBase(kPrivateIP.ipaddr(),
+ {kStunServerAddr1, kStunServerAddr2},
+ kNatAddr) {}
- StunPortTestBase(rtc::Network network, const rtc::IPAddress address)
+ StunPortTestBase(const rtc::IPAddress address,
+ const std::set<rtc::SocketAddress>& stun_server_addresses,
+ const rtc::SocketAddress& nat_server_address)
: ss_(new rtc::VirtualSocketServer()),
thread_(ss_.get()),
- network_(network),
- socket_factory_(ss_.get()),
- stun_server_1_(
- cricket::TestStunServer::Create(ss_.get(), kStunAddr1, thread_)),
- stun_server_2_(
- cricket::TestStunServer::Create(ss_.get(), kStunAddr2, thread_)),
+ nat_factory_(ss_.get(), nat_server_address, nat_server_address),
+ nat_socket_factory_(&nat_factory_),
mdns_responder_provider_(new FakeMdnsResponderProvider()),
+ nat_server_(CreateNatServer(nat_server_address, rtc::NAT_OPEN_CONE)),
done_(false),
error_(false),
stun_keepalive_delay_(1),
stun_keepalive_lifetime_(-1) {
- network_.AddIP(address);
+ network_ = MakeNetwork(address);
+ RTC_CHECK(address.family() == nat_server_address.family());
+ for (const auto& addr : stun_server_addresses) {
+ RTC_CHECK(addr.family() == address.family());
+ stun_servers_.push_back(
+ cricket::TestStunServer::Create(ss_.get(), addr, thread_));
+ }
+ }
+
+ std::unique_ptr<rtc::NATServer> CreateNatServer(const SocketAddress& addr,
+ rtc::NATType type) {
+ return std::make_unique<rtc::NATServer>(type, thread_, ss_.get(), addr,
+ addr, thread_, ss_.get(), addr);
}
virtual rtc::PacketSocketFactory* socket_factory() {
- return &socket_factory_;
+ return &nat_socket_factory_;
}
- rtc::VirtualSocketServer* ss() const { return ss_.get(); }
+ rtc::SocketServer* ss() const { return ss_.get(); }
cricket::UDPPort* port() const { return stun_port_.get(); }
rtc::AsyncPacketSocket* socket() const { return socket_.get(); }
bool done() const { return done_; }
@@ -151,7 +175,7 @@
}
void SetNetworkType(rtc::AdapterType adapter_type) {
- network_.set_type(adapter_type);
+ network_->set_type(adapter_type);
}
void CreateStunPort(const rtc::SocketAddress& server_addr,
@@ -164,9 +188,9 @@
void CreateStunPort(const ServerAddresses& stun_servers,
const webrtc::FieldTrialsView* field_trials = nullptr) {
stun_port_ = cricket::StunPort::Create(
- {.network_thread = rtc::Thread::Current(),
+ {.network_thread = &thread_,
.socket_factory = socket_factory(),
- .network = &network_,
+ .network = network_,
.ice_username_fragment = rtc::CreateRandomString(16),
.ice_password = rtc::CreateRandomString(22),
.field_trials = field_trials},
@@ -193,26 +217,26 @@
socket_.reset(socket);
} else {
socket_.reset(socket_factory()->CreateUdpSocket(
- rtc::SocketAddress(kLocalAddr.ipaddr(), 0), 0, 0));
+ rtc::SocketAddress(kPrivateIP.ipaddr(), 0), 0, 0));
}
ASSERT_TRUE(socket_ != NULL);
socket_->RegisterReceivedPacketCallback(
[&](rtc::AsyncPacketSocket* socket, const rtc::ReceivedPacket& packet) {
OnReadPacket(socket, packet);
});
+ ServerAddresses stun_servers;
+ stun_servers.insert(server_addr);
stun_port_ = cricket::UDPPort::Create(
- {.network_thread = rtc::Thread::Current(),
+ {.network_thread = &thread_,
.socket_factory = socket_factory(),
- .network = &network_,
+ .network = network_,
.ice_username_fragment = rtc::CreateRandomString(16),
.ice_password = rtc::CreateRandomString(22),
.field_trials = field_trials},
socket_.get(), false, std::nullopt);
+ stun_port_->set_server_addresses(stun_servers);
ASSERT_TRUE(stun_port_ != NULL);
stun_port_->SetIceTiebreaker(kTiebreakerDefault);
- ServerAddresses stun_servers;
- stun_servers.insert(server_addr);
- stun_port_->set_server_addresses(stun_servers);
stun_port_->SignalPortComplete.connect(this,
&StunPortTestBase::OnPortComplete);
stun_port_->SignalPortError.connect(this, &StunPortTestBase::OnPortError);
@@ -233,7 +257,7 @@
}
void EnableMdnsObfuscation() {
- network_.set_mdns_responder_provider(mdns_responder_provider_.get());
+ network_->set_mdns_responder_provider(mdns_responder_provider_.get());
}
protected:
@@ -261,21 +285,31 @@
stun_keepalive_lifetime_ = lifetime;
}
- cricket::TestStunServer* stun_server_1() { return stun_server_1_.get(); }
- cricket::TestStunServer* stun_server_2() { return stun_server_2_.get(); }
+ rtc::Network* MakeNetwork(const rtc::IPAddress& addr) {
+ networks_.emplace_back("unittest", "unittest", addr, 32);
+ networks_.back().AddIP(addr);
+ return &networks_.back();
+ }
+
+ cricket::TestStunServer* stun_server_1() { return stun_servers_[0].get(); }
+ cricket::TestStunServer* stun_server_2() { return stun_servers_[1].get(); }
rtc::AutoSocketServerThread& thread() { return thread_; }
+ rtc::SocketFactory* nat_factory() { return &nat_factory_; }
private:
+ std::vector<rtc::Network> networks_;
+ rtc::Network* network_;
+
std::unique_ptr<rtc::VirtualSocketServer> ss_;
rtc::AutoSocketServerThread thread_;
- rtc::Network network_;
- rtc::BasicPacketSocketFactory socket_factory_;
+ rtc::NATSocketFactory nat_factory_;
+ rtc::BasicPacketSocketFactory nat_socket_factory_;
std::unique_ptr<cricket::UDPPort> stun_port_;
- cricket::TestStunServer::StunServerPtr stun_server_1_;
- cricket::TestStunServer::StunServerPtr stun_server_2_;
+ std::vector<cricket::TestStunServer::StunServerPtr> stun_servers_;
std::unique_ptr<rtc::AsyncPacketSocket> socket_;
std::unique_ptr<rtc::MdnsResponderProvider> mdns_responder_provider_;
+ std::unique_ptr<rtc::NATServer> nat_server_;
bool done_;
bool error_;
int stun_keepalive_delay_;
@@ -296,21 +330,21 @@
// Test that we can create a STUN port.
TEST_F(StunPortTest, TestCreateStunPort) {
- CreateStunPort(kStunAddr1);
+ CreateStunPort(kStunServerAddr1);
EXPECT_EQ(IceCandidateType::kSrflx, port()->Type());
EXPECT_EQ(0U, port()->Candidates().size());
}
// Test that we can create a UDP port.
TEST_F(StunPortTest, TestCreateUdpPort) {
- CreateSharedUdpPort(kStunAddr1, nullptr);
+ CreateSharedUdpPort(kStunServerAddr1, nullptr, nullptr);
EXPECT_EQ(IceCandidateType::kHost, port()->Type());
EXPECT_EQ(0U, port()->Candidates().size());
}
// Test that we can get an address from a STUN server.
TEST_F(StunPortTest, TestPrepareAddress) {
- CreateStunPort(kStunAddr1);
+ CreateStunPort(kStunServerAddr1);
PrepareAddress();
EXPECT_THAT(
webrtc::WaitUntil([&] { return done(); }, IsTrue(),
@@ -318,8 +352,8 @@
.clock = &fake_clock}),
webrtc::IsRtcOk());
ASSERT_EQ(1U, port()->Candidates().size());
- EXPECT_TRUE(kLocalAddr.EqualIPs(port()->Candidates()[0].address()));
- std::string expected_server_url = "stun:127.0.0.1:5000";
+ EXPECT_TRUE(kPublicIP.EqualIPs(port()->Candidates()[0].address()));
+ std::string expected_server_url = "stun:" + kStunServerAddr1.ToString();
EXPECT_EQ(port()->Candidates()[0].url(), expected_server_url);
}
@@ -341,7 +375,7 @@
.clock = &fake_clock}),
webrtc::IsRtcOk());
EXPECT_NE(error_event_.error_text.find('.'), std::string::npos);
- EXPECT_NE(error_event_.address.find(kLocalAddr.HostAsSensitiveURIString()),
+ EXPECT_NE(error_event_.address.find(kPrivateIP.HostAsSensitiveURIString()),
std::string::npos);
std::string server_url = "stun:" + kBadAddr.ToString();
EXPECT_EQ(error_event_.url, server_url);
@@ -350,7 +384,7 @@
// Test that we fail without emitting an error if we try to get an address from
// a STUN server with a different address family. IPv4 local, IPv6 STUN.
TEST_F(StunPortTest, TestServerAddressFamilyMismatch) {
- CreateStunPort(kIPv6StunAddr1);
+ CreateStunPort(kStunServerAddrIPv6Addr);
PrepareAddress();
EXPECT_THAT(
webrtc::WaitUntil([&] { return done(); }, IsTrue(),
@@ -364,7 +398,8 @@
class StunPortWithMockDnsResolverTest : public StunPortTest {
public:
- StunPortWithMockDnsResolverTest() : StunPortTest(), socket_factory_(ss()) {}
+ StunPortWithMockDnsResolverTest()
+ : StunPortTest(), socket_factory_(nat_factory()) {}
rtc::PacketSocketFactory* socket_factory() override {
return &socket_factory_;
@@ -392,8 +427,7 @@
.WillRepeatedly(ReturnPointee(resolver_result));
EXPECT_CALL(*resolver_result, GetError).WillOnce(Return(0));
EXPECT_CALL(*resolver_result, GetResolvedAddress(AF_INET, _))
- .WillOnce(DoAll(SetArgPointee<1>(SocketAddress("127.0.0.1", 5000)),
- Return(true)));
+ .WillOnce(DoAll(SetArgPointee<1>(kStunServerAddr1), Return(true)));
});
CreateStunPort(kValidHostnameAddr);
PrepareAddress();
@@ -403,7 +437,7 @@
.clock = &fake_clock}),
webrtc::IsRtcOk());
ASSERT_EQ(1U, port()->Candidates().size());
- EXPECT_TRUE(kLocalAddr.EqualIPs(port()->Candidates()[0].address()));
+ EXPECT_TRUE(kPublicIP.EqualIPs(port()->Candidates()[0].address()));
EXPECT_EQ(kStunCandidatePriority, port()->Candidates()[0].priority());
}
@@ -421,8 +455,7 @@
.WillRepeatedly(ReturnPointee(resolver_result));
EXPECT_CALL(*resolver_result, GetError).WillOnce(Return(0));
EXPECT_CALL(*resolver_result, GetResolvedAddress(AF_INET, _))
- .WillOnce(DoAll(SetArgPointee<1>(SocketAddress("127.0.0.1", 5000)),
- Return(true)));
+ .WillOnce(DoAll(SetArgPointee<1>(kStunServerAddr1), Return(true)));
});
CreateStunPort(kValidHostnameAddr);
PrepareAddress();
@@ -432,7 +465,7 @@
.clock = &fake_clock}),
webrtc::IsRtcOk());
ASSERT_EQ(1U, port()->Candidates().size());
- EXPECT_TRUE(kLocalAddr.EqualIPs(port()->Candidates()[0].address()));
+ EXPECT_TRUE(kPublicIP.EqualIPs(port()->Candidates()[0].address()));
EXPECT_EQ(kStunCandidatePriority + (cricket::kMaxTurnServers << 8),
port()->Candidates()[0].priority());
}
@@ -458,7 +491,7 @@
// additional candidate generation.
TEST_F(StunPortTest, TestKeepAliveResponse) {
SetKeepaliveDelay(500); // 500ms of keepalive delay.
- CreateStunPort(kStunAddr1);
+ CreateStunPort(kStunServerAddr1);
PrepareAddress();
EXPECT_THAT(
webrtc::WaitUntil([&] { return done(); }, IsTrue(),
@@ -466,22 +499,25 @@
.clock = &fake_clock}),
webrtc::IsRtcOk());
ASSERT_EQ(1U, port()->Candidates().size());
- EXPECT_TRUE(kLocalAddr.EqualIPs(port()->Candidates()[0].address()));
+ EXPECT_TRUE(kPublicIP.EqualIPs(port()->Candidates()[0].address()));
SIMULATED_WAIT(false, 1000, fake_clock);
EXPECT_EQ(1U, port()->Candidates().size());
}
// Test that a local candidate can be generated using a shared socket.
TEST_F(StunPortTest, TestSharedSocketPrepareAddress) {
- CreateSharedUdpPort(kStunAddr1, nullptr);
+ CreateSharedUdpPort(kStunServerAddr1, nullptr, nullptr);
PrepareAddress();
EXPECT_THAT(
webrtc::WaitUntil([&] { return done(); }, IsTrue(),
{.timeout = webrtc::TimeDelta::Millis(kTimeoutMs),
.clock = &fake_clock}),
webrtc::IsRtcOk());
- ASSERT_EQ(1U, port()->Candidates().size());
- EXPECT_TRUE(kLocalAddr.EqualIPs(port()->Candidates()[0].address()));
+ ASSERT_EQ(2U, port()->Candidates().size());
+ EXPECT_EQ(port()->Candidates()[0].type(), IceCandidateType::kHost);
+ EXPECT_TRUE(kPrivateIP.EqualIPs(port()->Candidates()[0].address()));
+ EXPECT_EQ(port()->Candidates()[1].type(), IceCandidateType::kSrflx);
+ EXPECT_TRUE(kPublicIP.EqualIPs(port()->Candidates()[1].address()));
}
// Test that we still get a local candidate with invalid stun server hostname.
@@ -496,7 +532,7 @@
{.timeout = webrtc::TimeDelta::Millis(kTimeoutMs)}),
webrtc::IsRtcOk());
ASSERT_EQ(1U, port()->Candidates().size());
- EXPECT_TRUE(kLocalAddr.EqualIPs(port()->Candidates()[0].address()));
+ EXPECT_TRUE(kPrivateIP.EqualIPs(port()->Candidates()[0].address()));
// Send data to port after it's ready. This is to make sure, UDP port can
// handle data with unresolved stun server address.
@@ -505,26 +541,11 @@
// No crash is success.
}
-// Test that a stun candidate (srflx candidate) is discarded whose address is
-// equal to that of a local candidate if mDNS obfuscation is not enabled.
-TEST_F(StunPortTest, TestStunCandidateDiscardedWithMdnsObfuscationNotEnabled) {
- CreateSharedUdpPort(kStunAddr1, nullptr);
- PrepareAddress();
- EXPECT_THAT(
- webrtc::WaitUntil([&] { return done(); }, IsTrue(),
- {.timeout = webrtc::TimeDelta::Millis(kTimeoutMs),
- .clock = &fake_clock}),
- webrtc::IsRtcOk());
- ASSERT_EQ(1U, port()->Candidates().size());
- EXPECT_TRUE(kLocalAddr.EqualIPs(port()->Candidates()[0].address()));
- EXPECT_TRUE(port()->Candidates()[0].is_local());
-}
-
// Test that a stun candidate (srflx candidate) is generated whose address is
// equal to that of a local candidate if mDNS obfuscation is enabled.
TEST_F(StunPortTest, TestStunCandidateGeneratedWithMdnsObfuscationEnabled) {
EnableMdnsObfuscation();
- CreateSharedUdpPort(kStunAddr1, nullptr);
+ CreateSharedUdpPort(kStunServerAddr1, nullptr);
PrepareAddress();
EXPECT_THAT(
webrtc::WaitUntil([&] { return done(); }, IsTrue(),
@@ -533,18 +554,20 @@
webrtc::IsRtcOk());
ASSERT_EQ(2U, port()->Candidates().size());
- // The addresses of the candidates are both equal to kLocalAddr.
- EXPECT_TRUE(kLocalAddr.EqualIPs(port()->Candidates()[0].address()));
- EXPECT_TRUE(kLocalAddr.EqualIPs(port()->Candidates()[1].address()));
-
// One of the generated candidates is a local candidate and the other is a
// stun candidate.
EXPECT_NE(port()->Candidates()[0].type(), port()->Candidates()[1].type());
if (port()->Candidates()[0].is_local()) {
+ EXPECT_EQ(kMsdnAddress.HostAsSensitiveURIString(),
+ port()->Candidates()[0].address().HostAsSensitiveURIString());
EXPECT_TRUE(port()->Candidates()[1].is_stun());
+ EXPECT_TRUE(kPublicIP.EqualIPs(port()->Candidates()[1].address()));
} else {
EXPECT_TRUE(port()->Candidates()[0].is_stun());
+ EXPECT_TRUE(kPublicIP.EqualIPs(port()->Candidates()[0].address()));
EXPECT_TRUE(port()->Candidates()[1].is_local());
+ EXPECT_EQ(kMsdnAddress.HostAsSensitiveURIString(),
+ port()->Candidates()[1].address().HostAsSensitiveURIString());
}
}
@@ -552,8 +575,8 @@
// use.
TEST_F(StunPortTest, TestNoDuplicatedAddressWithTwoStunServers) {
ServerAddresses stun_servers;
- stun_servers.insert(kStunAddr1);
- stun_servers.insert(kStunAddr2);
+ stun_servers.insert(kStunServerAddr1);
+ stun_servers.insert(kStunServerAddr2);
CreateStunPort(stun_servers);
EXPECT_EQ(IceCandidateType::kSrflx, port()->Type());
PrepareAddress();
@@ -570,7 +593,7 @@
// which is not reachable.
TEST_F(StunPortTest, TestMultipleStunServersWithBadServer) {
ServerAddresses stun_servers;
- stun_servers.insert(kStunAddr1);
+ stun_servers.insert(kStunServerAddr1);
stun_servers.insert(kBadAddr);
CreateStunPort(stun_servers);
EXPECT_EQ(IceCandidateType::kSrflx, port()->Type());
@@ -598,8 +621,8 @@
stun_server_2()->set_fake_stun_addr(kStunMappedAddr2);
ServerAddresses stun_servers;
- stun_servers.insert(kStunAddr1);
- stun_servers.insert(kStunAddr2);
+ stun_servers.insert(kStunServerAddr1);
+ stun_servers.insert(kStunServerAddr2);
CreateStunPort(stun_servers);
EXPECT_EQ(IceCandidateType::kSrflx, port()->Type());
PrepareAddress();
@@ -618,7 +641,7 @@
// changes.
TEST_F(StunPortTest, TestStunPortGetStunKeepaliveLifetime) {
// Lifetime for the default (unknown) network type is `kInfiniteLifetime`.
- CreateStunPort(kStunAddr1);
+ CreateStunPort(kStunServerAddr1);
EXPECT_EQ(kInfiniteLifetime, port()->stun_keepalive_lifetime());
// Lifetime for the cellular network is `kHighCostPortKeepaliveLifetimeMs`
SetNetworkType(rtc::ADAPTER_TYPE_CELLULAR);
@@ -627,7 +650,7 @@
// Lifetime for the wifi network is `kInfiniteLifetime`.
SetNetworkType(rtc::ADAPTER_TYPE_WIFI);
- CreateStunPort(kStunAddr2);
+ CreateStunPort(kStunServerAddr2);
EXPECT_EQ(kInfiniteLifetime, port()->stun_keepalive_lifetime());
}
@@ -636,7 +659,7 @@
// if the network type changes.
TEST_F(StunPortTest, TestUdpPortGetStunKeepaliveLifetime) {
// Lifetime for the default (unknown) network type is `kInfiniteLifetime`.
- CreateSharedUdpPort(kStunAddr1, nullptr);
+ CreateSharedUdpPort(kStunServerAddr1, nullptr);
EXPECT_EQ(kInfiniteLifetime, port()->stun_keepalive_lifetime());
// Lifetime for the cellular network is `kHighCostPortKeepaliveLifetimeMs`.
SetNetworkType(rtc::ADAPTER_TYPE_CELLULAR);
@@ -645,7 +668,7 @@
// Lifetime for the wifi network type is `kInfiniteLifetime`.
SetNetworkType(rtc::ADAPTER_TYPE_WIFI);
- CreateSharedUdpPort(kStunAddr2, nullptr);
+ CreateSharedUdpPort(kStunServerAddr2, nullptr);
EXPECT_EQ(kInfiniteLifetime, port()->stun_keepalive_lifetime());
}
@@ -654,7 +677,7 @@
TEST_F(StunPortTest, TestStunBindingRequestShortLifetime) {
SetKeepaliveDelay(101);
SetKeepaliveLifetime(100);
- CreateStunPort(kStunAddr1);
+ CreateStunPort(kStunServerAddr1);
PrepareAddress();
EXPECT_THAT(
webrtc::WaitUntil([&] { return done(); }, IsTrue(),
@@ -671,7 +694,7 @@
// Test that by default, the STUN binding requests will last for a long time.
TEST_F(StunPortTest, TestStunBindingRequestLongLifetime) {
SetKeepaliveDelay(101);
- CreateStunPort(kStunAddr1);
+ CreateStunPort(kStunServerAddr1);
PrepareAddress();
EXPECT_THAT(
webrtc::WaitUntil([&] { return done(); }, IsTrue(),
@@ -717,8 +740,8 @@
// Test that outbound packets inherit the dscp value assigned to the socket.
TEST_F(StunPortTest, TestStunPacketsHaveDscpPacketOption) {
MockAsyncPacketSocket* socket = new MockAsyncPacketSocket();
- CreateSharedUdpPort(kStunAddr1, socket);
- EXPECT_CALL(*socket, GetLocalAddress()).WillRepeatedly(Return(kLocalAddr));
+ CreateSharedUdpPort(kStunServerAddr1, socket);
+ EXPECT_CALL(*socket, GetLocalAddress()).WillRepeatedly(Return(kPrivateIP));
EXPECT_CALL(*socket, GetState())
.WillRepeatedly(Return(rtc::AsyncPacketSocket::STATE_BOUND));
EXPECT_CALL(*socket, SetOption(_, _)).WillRepeatedly(Return(0));
@@ -746,17 +769,9 @@
class StunIPv6PortTestBase : public StunPortTestBase {
public:
StunIPv6PortTestBase()
- : StunPortTestBase(rtc::Network("unittestipv6",
- "unittestipv6",
- kIPv6LocalAddr.ipaddr(),
- 128),
- kIPv6LocalAddr.ipaddr()) {
- stun_server_ipv6_1_ =
- cricket::TestStunServer::Create(ss(), kIPv6StunAddr1, thread());
- }
-
- protected:
- cricket::TestStunServer::StunServerPtr stun_server_ipv6_1_;
+ : StunPortTestBase(kPrivateIPv6.ipaddr(),
+ {kStunServerAddrIPv6Addr},
+ kNatAddrIPv6) {}
};
class StunIPv6PortTestWithRealClock : public StunIPv6PortTestBase {};
@@ -765,7 +780,7 @@
// Test that we can get an address from a STUN server.
TEST_F(StunIPv6PortTest, TestPrepareAddress) {
- CreateStunPort(kIPv6StunAddr1);
+ CreateStunPort(kStunServerAddrIPv6Addr);
PrepareAddress();
EXPECT_THAT(
webrtc::WaitUntil([&] { return done(); }, IsTrue(),
@@ -773,8 +788,8 @@
.clock = &fake_clock}),
webrtc::IsRtcOk());
ASSERT_EQ(1U, port()->Candidates().size());
- EXPECT_TRUE(kIPv6LocalAddr.EqualIPs(port()->Candidates()[0].address()));
- std::string expected_server_url = "stun:::1:5000";
+ EXPECT_TRUE(kPublicIPv6.EqualIPs(port()->Candidates()[0].address()));
+ std::string expected_server_url = "stun:2003:4860:4860::8844:5000";
EXPECT_EQ(port()->Candidates()[0].url(), expected_server_url);
}
@@ -796,9 +811,8 @@
.clock = &fake_clock}),
webrtc::IsRtcOk());
EXPECT_NE(error_event_.error_text.find('.'), std::string::npos);
- EXPECT_NE(
- error_event_.address.find(kIPv6LocalAddr.HostAsSensitiveURIString()),
- std::string::npos);
+ EXPECT_NE(error_event_.address.find(kPrivateIPv6.HostAsSensitiveURIString()),
+ std::string::npos);
std::string server_url = "stun:" + kIPv6BadAddr.ToString();
EXPECT_EQ(error_event_.url, server_url);
}
@@ -806,7 +820,7 @@
// Test that we fail without emitting an error if we try to get an address from
// a STUN server with a different address family. IPv6 local, IPv4 STUN.
TEST_F(StunIPv6PortTest, TestServerAddressFamilyMismatch) {
- CreateStunPort(kStunAddr1);
+ CreateStunPort(kStunServerAddr1);
PrepareAddress();
EXPECT_THAT(
webrtc::WaitUntil([&] { return done(); }, IsTrue(),
@@ -867,8 +881,8 @@
.WillRepeatedly(ReturnPointee(resolver_result));
EXPECT_CALL(*resolver_result, GetError).WillOnce(Return(0));
EXPECT_CALL(*resolver_result, GetResolvedAddress(AF_INET6, _))
- .WillOnce(DoAll(SetArgPointee<1>(SocketAddress("::1", 5000)),
- Return(true)));
+ .WillOnce(
+ DoAll(SetArgPointee<1>(kStunServerAddrIPv6Addr), Return(true)));
});
CreateStunPort(kValidHostnameAddr);
PrepareAddress();
@@ -878,7 +892,7 @@
.clock = &fake_clock}),
webrtc::IsRtcOk());
ASSERT_EQ(1U, port()->Candidates().size());
- EXPECT_TRUE(kIPv6LocalAddr.EqualIPs(port()->Candidates()[0].address()));
+ EXPECT_TRUE(kPrivateIPv6.EqualIPs(port()->Candidates()[0].address()));
EXPECT_EQ(kIPv6StunCandidatePriority, port()->Candidates()[0].priority());
}
@@ -898,8 +912,8 @@
.WillRepeatedly(ReturnPointee(resolver_result));
EXPECT_CALL(*resolver_result, GetError).WillOnce(Return(0));
EXPECT_CALL(*resolver_result, GetResolvedAddress(AF_INET6, _))
- .WillOnce(DoAll(SetArgPointee<1>(SocketAddress("::1", 5000)),
- Return(true)));
+ .WillOnce(
+ DoAll(SetArgPointee<1>(kStunServerAddrIPv6Addr), Return(true)));
});
CreateStunPort(kValidHostnameAddr, &field_trials);
PrepareAddress();
@@ -909,7 +923,7 @@
.clock = &fake_clock}),
webrtc::IsRtcOk());
ASSERT_EQ(1U, port()->Candidates().size());
- EXPECT_TRUE(kIPv6LocalAddr.EqualIPs(port()->Candidates()[0].address()));
+ EXPECT_TRUE(kPrivateIPv6.EqualIPs(port()->Candidates()[0].address()));
EXPECT_EQ(kIPv6StunCandidatePriority + (cricket::kMaxTurnServers << 8),
port()->Candidates()[0].priority());
}
diff --git a/p2p/base/test_stun_server.cc b/p2p/base/test_stun_server.cc
index a8a5c46..2272ce0 100644
--- a/p2p/base/test_stun_server.cc
+++ b/p2p/base/test_stun_server.cc
@@ -22,7 +22,9 @@
const rtc::SocketAddress& addr,
rtc::Thread& network_thread) {
rtc::Socket* socket = ss->CreateSocket(addr.family(), SOCK_DGRAM);
+ RTC_CHECK(socket != nullptr) << "Failed to create socket";
rtc::AsyncUDPSocket* udp_socket = rtc::AsyncUDPSocket::Create(socket, addr);
+ RTC_CHECK(udp_socket != nullptr) << "Failed to create AsyncUDPSocket";
TestStunServer* server = nullptr;
network_thread.BlockingCall(
[&]() { server = new TestStunServer(udp_socket, network_thread); });