diff --git a/BUILD.gn b/BUILD.gn index 3aa0ae58f7..66b3c52ec2 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -66,6 +66,7 @@ if (!build_with_chromium) { "net/dcsctp:dcsctp_unittests", "pc:peerconnection_unittests", "pc:rtc_pc_unittests", + "pc:slow_peer_connection_unittests", "rtc_tools:rtp_generator", "rtc_tools:video_replay", "stats:rtc_stats_unittests", diff --git a/infra/specs/client.webrtc.json b/infra/specs/client.webrtc.json index 5df7faa1f7..9d8f620730 100644 --- a/infra/specs/client.webrtc.json +++ b/infra/specs/client.webrtc.json @@ -270,8 +270,7 @@ "device_type": "bullhead", "os": "Android" } - ], - "shards": 4 + ] }, "test": "peerconnection_unittests", "test_id_prefix": "ninja://pc:peerconnection_unittests/" @@ -397,6 +396,36 @@ "test": "rtc_unittests", "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "resultdb": { + "enable": true, + "has_native_resultdb_integration": true + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "android_devices": "1", + "device_os": "MMB29Q", + "device_type": "bullhead", + "os": "Android" + } + ] + }, + "test": "slow_peer_connection_unittests", + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "merge": { "args": [], @@ -871,8 +900,7 @@ "device_type": "bullhead", "os": "Android" } - ], - "shards": 4 + ] }, "test": "peerconnection_unittests", "test_id_prefix": "ninja://pc:peerconnection_unittests/" @@ -998,6 +1026,36 @@ "test": "rtc_unittests", "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "resultdb": { + "enable": true, + "has_native_resultdb_integration": true + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "android_devices": "1", + "device_os": "MMB29Q", + "device_type": "bullhead", + "os": "Android" + } + ] + }, + "test": "slow_peer_connection_unittests", + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "merge": { "args": [], @@ -1230,8 +1288,7 @@ "device_type": "bullhead", "os": "Android" } - ], - "shards": 4 + ] }, "test": "peerconnection_unittests", "test_id_prefix": "ninja://pc:peerconnection_unittests/" @@ -1510,8 +1567,7 @@ "device_type": "bullhead", "os": "Android" } - ], - "shards": 4 + ] }, "test": "peerconnection_unittests", "test_id_prefix": "ninja://pc:peerconnection_unittests/" @@ -1637,6 +1693,36 @@ "test": "rtc_unittests", "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "resultdb": { + "enable": true, + "has_native_resultdb_integration": true + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "android_devices": "1", + "device_os": "MMB29Q", + "device_type": "bullhead", + "os": "Android" + } + ] + }, + "test": "slow_peer_connection_unittests", + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "merge": { "args": [], @@ -2111,8 +2197,7 @@ "device_type": "bullhead", "os": "Android" } - ], - "shards": 4 + ] }, "test": "peerconnection_unittests", "test_id_prefix": "ninja://pc:peerconnection_unittests/" @@ -2238,6 +2323,36 @@ "test": "rtc_unittests", "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "resultdb": { + "enable": true, + "has_native_resultdb_integration": true + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "android_devices": "1", + "device_os": "MMB29Q", + "device_type": "bullhead", + "os": "Android" + } + ] + }, + "test": "slow_peer_connection_unittests", + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "merge": { "args": [], @@ -2464,8 +2579,7 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" } @@ -2642,8 +2756,7 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -2732,6 +2845,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -3032,8 +3166,7 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -3122,6 +3255,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -3422,8 +3576,7 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -3512,6 +3665,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -3812,8 +3986,7 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -3902,6 +4075,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -4202,8 +4396,7 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -4292,6 +4485,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -4592,8 +4806,7 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -4682,6 +4895,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -4983,8 +5217,7 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -5073,6 +5306,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -5375,8 +5629,7 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -5465,6 +5718,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -5766,8 +6040,7 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -5856,6 +6129,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -6188,8 +6482,7 @@ "cpu": "x86-64", "os": "Mac-11" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -6282,6 +6575,28 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cores": "12", + "cpu": "x86-64", + "os": "Mac-11" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -6597,8 +6912,7 @@ "cpu": "x86-64", "os": "Mac-11" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -6691,6 +7005,28 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cores": "12", + "cpu": "x86-64", + "os": "Mac-11" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -6997,8 +7333,7 @@ "cpu": "x86-64", "os": "Mac-11" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -7087,6 +7422,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Mac-11" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -7417,8 +7773,7 @@ "os": "Mac", "pool": "WebRTC-baremetal" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -7511,6 +7866,28 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "arm64-64-Apple_M1", + "os": "Mac", + "pool": "WebRTC-baremetal" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -7665,8 +8042,7 @@ "cpu": "x86-64", "os": "Windows-7-SP1" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" } @@ -7845,8 +8221,7 @@ "cpu": "x86-64", "os": "Windows-7-SP1" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -7935,6 +8310,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-7-SP1" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -8257,8 +8653,7 @@ "cpu": "x86-64", "os": "Windows-10-15063" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -8347,6 +8742,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-10-15063" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { diff --git a/infra/specs/gn_isolate_map.pyl b/infra/specs/gn_isolate_map.pyl index 6446d66410..057e4fe96d 100644 --- a/infra/specs/gn_isolate_map.pyl +++ b/infra/specs/gn_isolate_map.pyl @@ -104,6 +104,10 @@ "label": "//sdk:sdk_unittests", "type": "console_test_launcher", }, + "slow_peer_connection_unittests": { + "label": "//pc:slow_peer_connection_unittests", + "type": "console_test_launcher", + }, "system_wrappers_unittests": { "label": "//system_wrappers:system_wrappers_unittests", "type": "console_test_launcher", diff --git a/infra/specs/test_suites.pyl b/infra/specs/test_suites.pyl index ce153f6f03..e0a3f6df8a 100644 --- a/infra/specs/test_suites.pyl +++ b/infra/specs/test_suites.pyl @@ -44,11 +44,7 @@ 'shards': 6 }, }, - 'peerconnection_unittests': { - 'swarming': { - 'shards': 4 - }, - }, + 'peerconnection_unittests': {}, 'rtc_media_unittests': {}, 'rtc_pc_unittests': {}, 'rtc_stats_unittests': {}, @@ -57,6 +53,7 @@ 'shards': 6 }, }, + 'slow_peer_connection_unittests': {}, 'system_wrappers_unittests': {}, 'test_support_unittests': {}, 'tools_unittests': {}, @@ -104,11 +101,7 @@ 'shards': 6 }, }, - 'peerconnection_unittests': { - 'swarming': { - 'shards': 4 - }, - }, + 'peerconnection_unittests': {}, 'rtc_media_unittests': {}, 'rtc_pc_unittests': {}, 'rtc_stats_unittests': {}, @@ -117,6 +110,7 @@ 'shards': 6 }, }, + 'slow_peer_connection_unittests': {}, 'system_wrappers_unittests': {}, 'test_support_unittests': {}, 'tools_unittests': {}, @@ -229,11 +223,7 @@ } }, 'more_configs_tests': { - 'peerconnection_unittests': { - 'swarming': { - 'shards': 4 - }, - }, + 'peerconnection_unittests': {}, }, 'win_video_capture_tests': { 'video_capture_tests': { diff --git a/infra/specs/tryserver.webrtc.json b/infra/specs/tryserver.webrtc.json index bbafb18299..9c98e37d7f 100644 --- a/infra/specs/tryserver.webrtc.json +++ b/infra/specs/tryserver.webrtc.json @@ -270,8 +270,7 @@ "device_type": "bullhead", "os": "Android" } - ], - "shards": 4 + ] }, "test": "peerconnection_unittests", "test_id_prefix": "ninja://pc:peerconnection_unittests/" @@ -397,6 +396,36 @@ "test": "rtc_unittests", "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "resultdb": { + "enable": true, + "has_native_resultdb_integration": true + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "android_devices": "1", + "device_os": "MMB29Q", + "device_type": "bullhead", + "os": "Android" + } + ] + }, + "test": "slow_peer_connection_unittests", + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "merge": { "args": [], @@ -905,8 +934,7 @@ "device_type": "bullhead", "os": "Android" } - ], - "shards": 4 + ] }, "test": "peerconnection_unittests", "test_id_prefix": "ninja://pc:peerconnection_unittests/" @@ -1032,6 +1060,36 @@ "test": "rtc_unittests", "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "resultdb": { + "enable": true, + "has_native_resultdb_integration": true + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "android_devices": "1", + "device_os": "MMB29Q", + "device_type": "bullhead", + "os": "Android" + } + ] + }, + "test": "slow_peer_connection_unittests", + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "merge": { "args": [], @@ -1540,8 +1598,7 @@ "device_type": "bullhead", "os": "Android" } - ], - "shards": 4 + ] }, "test": "peerconnection_unittests", "test_id_prefix": "ninja://pc:peerconnection_unittests/" @@ -1667,6 +1724,36 @@ "test": "rtc_unittests", "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "resultdb": { + "enable": true, + "has_native_resultdb_integration": true + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "android_devices": "1", + "device_os": "MMB29Q", + "device_type": "bullhead", + "os": "Android" + } + ] + }, + "test": "slow_peer_connection_unittests", + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "merge": { "args": [], @@ -1933,8 +2020,7 @@ "device_type": "bullhead", "os": "Android" } - ], - "shards": 4 + ] }, "test": "peerconnection_unittests", "test_id_prefix": "ninja://pc:peerconnection_unittests/" @@ -2210,8 +2296,7 @@ "device_type": "bullhead", "os": "Android" } - ], - "shards": 4 + ] }, "test": "peerconnection_unittests", "test_id_prefix": "ninja://pc:peerconnection_unittests/" @@ -2337,6 +2422,36 @@ "test": "rtc_unittests", "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "resultdb": { + "enable": true, + "has_native_resultdb_integration": true + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "android_devices": "1", + "device_os": "MMB29Q", + "device_type": "bullhead", + "os": "Android" + } + ] + }, + "test": "slow_peer_connection_unittests", + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "merge": { "args": [], @@ -5778,8 +5893,7 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -5868,6 +5982,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -6174,8 +6309,7 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -6264,6 +6398,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -6565,8 +6720,7 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -6655,6 +6809,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -6803,8 +6978,7 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" } @@ -6981,8 +7155,7 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -7071,6 +7244,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -7371,8 +7565,7 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -7461,6 +7654,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -7811,8 +8025,7 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -7901,6 +8114,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -8201,8 +8435,7 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -8291,6 +8524,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -8591,8 +8845,7 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -8681,6 +8934,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -8981,8 +9255,7 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -9071,6 +9344,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -9371,8 +9665,7 @@ "cpu": "x86-64", "os": "Ubuntu-18.04" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -9461,6 +9754,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -9769,8 +10083,7 @@ "cpu": "x86-64", "os": "Mac-11" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -9863,6 +10176,28 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cores": "12", + "cpu": "x86-64", + "os": "Mac-11" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -10179,8 +10514,7 @@ "cpu": "x86-64", "os": "Mac-11" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -10273,6 +10607,28 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cores": "12", + "cpu": "x86-64", + "os": "Mac-11" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -10587,8 +10943,7 @@ "os": "Mac", "pool": "WebRTC-baremetal-try" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -10681,6 +11036,28 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "arm64-64-Apple_M1", + "os": "Mac", + "pool": "WebRTC-baremetal-try" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -10987,8 +11364,7 @@ "cpu": "x86-64", "os": "Mac-11" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -11077,6 +11453,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Mac-11" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -11435,8 +11832,7 @@ "os": "Mac", "pool": "WebRTC-baremetal-try" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -11529,6 +11925,28 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "arm64-64-Apple_M1", + "os": "Mac", + "pool": "WebRTC-baremetal-try" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -11835,8 +12253,7 @@ "cpu": "x86-64", "os": "Windows-10-15063" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -11925,6 +12342,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-10-15063" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -12229,8 +12667,7 @@ "cpu": "x86-64", "os": "Windows-7-SP1" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -12319,6 +12756,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-7-SP1" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -12619,8 +13077,7 @@ "cpu": "x86-64", "os": "Windows-10-15063" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -12709,6 +13166,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-10-15063" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -13009,8 +13487,7 @@ "cpu": "x86-64", "os": "Windows-7-SP1" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -13099,6 +13576,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-7-SP1" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -13399,8 +13897,7 @@ "cpu": "x86-64", "os": "Windows-7-SP1" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -13489,6 +13986,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-7-SP1" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -13789,8 +14307,7 @@ "cpu": "x86-64", "os": "Windows-7-SP1" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" }, @@ -13879,6 +14396,27 @@ }, "test_id_prefix": "ninja://:rtc_unittests/" }, + { + "isolate_name": "slow_peer_connection_unittests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "slow_peer_connection_unittests", + "resultdb": { + "result_format": "json" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-7-SP1" + } + ] + }, + "test_id_prefix": "ninja://pc:slow_peer_connection_unittests/" + }, { "isolate_name": "system_wrappers_unittests", "merge": { @@ -14077,8 +14615,7 @@ "cpu": "x86-64", "os": "Windows-7-SP1" } - ], - "shards": 4 + ] }, "test_id_prefix": "ninja://pc:peerconnection_unittests/" } diff --git a/pc/BUILD.gn b/pc/BUILD.gn index 98449a3813..1edbd24502 100644 --- a/pc/BUILD.gn +++ b/pc/BUILD.gn @@ -2268,6 +2268,31 @@ if (rtc_include_tests && !build_with_chromium) { ] } + rtc_test("slow_peer_connection_unittests") { + testonly = true + sources = [ "slow_peer_connection_integration_test.cc" ] + deps = [ + ":integration_test_helpers", + ":pc_test_utils", + "../api:libjingle_peerconnection_api", + "../api:scoped_refptr", + "../api/units:time_delta", + "../p2p:p2p_server_utils", + "../p2p:p2p_test_utils", + "../p2p:rtc_p2p", + "../rtc_base", + "../rtc_base:gunit_helpers", + "../rtc_base:logging", + "../rtc_base:rtc_base_tests_utils", + "../rtc_base:socket_address", + "../test:test_main", + "../test:test_support", + "//third_party/abseil-cpp/absl/algorithm:container", + "//third_party/abseil-cpp/absl/strings", + "//third_party/abseil-cpp/absl/types:optional", + ] + } + rtc_test("peerconnection_unittests") { testonly = true sources = [ diff --git a/pc/peer_connection_integrationtest.cc b/pc/peer_connection_integrationtest.cc index 6017f54dd4..940d7fdc74 100644 --- a/pc/peer_connection_integrationtest.cc +++ b/pc/peer_connection_integrationtest.cc @@ -8,17 +8,24 @@ * be found in the AUTHORS file in the root of the source tree. */ +// Integration tests for PeerConnection. +// These tests exercise a full stack over a simulated network. +// +// NOTE: If your test takes a while (guideline: more than 5 seconds), +// do NOT add it here, but instead add it to the file +// slow_peer_connection_integrationtest.cc + #include #include #include #include #include -#include #include #include #include "absl/algorithm/container.h" +#include "absl/strings/string_view.h" #include "absl/types/optional.h" #include "api/async_resolver_factory.h" #include "api/candidate.h" @@ -55,7 +62,6 @@ #include "p2p/base/port.h" #include "p2p/base/port_allocator.h" #include "p2p/base/port_interface.h" -#include "p2p/base/stun_server.h" #include "p2p/base/test_stun_server.h" #include "p2p/base/test_turn_customizer.h" #include "p2p/base/test_turn_server.h" @@ -615,65 +621,6 @@ TEST_P(PeerConnectionIntegrationTest, AddAudioToVideoOnlyCall) { ASSERT_TRUE(ExpectNewFrames(media_expectations)); } -// This test sets up a call that's transferred to a new caller with a different -// DTLS fingerprint. -TEST_P(PeerConnectionIntegrationTest, CallTransferredForCallee) { - ASSERT_TRUE(CreatePeerConnectionWrappers()); - ConnectFakeSignaling(); - caller()->AddAudioVideoTracks(); - callee()->AddAudioVideoTracks(); - caller()->CreateAndSetAndSignalOffer(); - ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); - - // Keep the original peer around which will still send packets to the - // receiving client. These SRTP packets will be dropped. - std::unique_ptr original_peer( - SetCallerPcWrapperAndReturnCurrent( - CreatePeerConnectionWrapperWithAlternateKey().release())); - // TODO(deadbeef): Why do we call Close here? That goes against the comment - // directly above. - original_peer->pc()->Close(); - - ConnectFakeSignaling(); - caller()->AddAudioVideoTracks(); - caller()->CreateAndSetAndSignalOffer(); - ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); - // Wait for some additional frames to be transmitted end-to-end. - MediaExpectations media_expectations; - media_expectations.ExpectBidirectionalAudioAndVideo(); - ASSERT_TRUE(ExpectNewFrames(media_expectations)); -} - -// This test sets up a call that's transferred to a new callee with a different -// DTLS fingerprint. -TEST_P(PeerConnectionIntegrationTest, CallTransferredForCaller) { - ASSERT_TRUE(CreatePeerConnectionWrappers()); - ConnectFakeSignaling(); - caller()->AddAudioVideoTracks(); - callee()->AddAudioVideoTracks(); - caller()->CreateAndSetAndSignalOffer(); - ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); - - // Keep the original peer around which will still send packets to the - // receiving client. These SRTP packets will be dropped. - std::unique_ptr original_peer( - SetCalleePcWrapperAndReturnCurrent( - CreatePeerConnectionWrapperWithAlternateKey().release())); - // TODO(deadbeef): Why do we call Close here? That goes against the comment - // directly above. - original_peer->pc()->Close(); - - ConnectFakeSignaling(); - callee()->AddAudioVideoTracks(); - caller()->SetOfferAnswerOptions(IceRestartOfferAnswerOptions()); - caller()->CreateAndSetAndSignalOffer(); - ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); - // Wait for some additional frames to be transmitted end-to-end. - MediaExpectations media_expectations; - media_expectations.ExpectBidirectionalAudioAndVideo(); - ASSERT_TRUE(ExpectNewFrames(media_expectations)); -} - // This test sets up a non-bundled call and negotiates bundling at the same // time as starting an ICE restart. When bundling is in effect in the restart, // the DTLS-SRTP context should be successfully reset. @@ -1361,31 +1308,6 @@ TEST_P(PeerConnectionIntegrationTest, GetBytesSentStatsWithOldStatsApi) { EXPECT_GT(caller()->OldGetStatsForTrack(video_track.get())->BytesSent(), 0); } -// Test that we can get capture start ntp time. -TEST_P(PeerConnectionIntegrationTest, GetCaptureStartNtpTimeWithOldStatsApi) { - ASSERT_TRUE(CreatePeerConnectionWrappers()); - ConnectFakeSignaling(); - caller()->AddAudioTrack(); - - callee()->AddAudioTrack(); - - // Do offer/answer, wait for the callee to receive some frames. - caller()->CreateAndSetAndSignalOffer(); - ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); - - // Get the remote audio track created on the receiver, so they can be used as - // GetStats filters. - auto receivers = callee()->pc()->GetReceivers(); - ASSERT_EQ(1u, receivers.size()); - auto remote_audio_track = receivers[0]->track(); - - // Get the audio output level stats. Note that the level is not available - // until an RTCP packet has been received. - EXPECT_TRUE_WAIT(callee()->OldGetStatsForTrack(remote_audio_track.get()) - ->CaptureStartNtpTime() > 0, - 2 * kMaxWaitForFramesMs); -} - // Test that the track ID is associated with all local and remote SSRC stats // using the old GetStats() and more than 1 audio and more than 1 video track. // This is a regression test for crbug.com/906988 @@ -2009,106 +1931,6 @@ class PeerConnectionIntegrationIceStatesTestWithFakeClock #if !defined(THREAD_SANITIZER) // This test provokes TSAN errors. bugs.webrtc.org/11282 -// Tests that the PeerConnection goes through all the ICE gathering/connection -// states over the duration of the call. This includes Disconnected and Failed -// states, induced by putting a firewall between the peers and waiting for them -// to time out. -TEST_P(PeerConnectionIntegrationIceStatesTestWithFakeClock, VerifyIceStates) { - const SocketAddress kStunServerAddress = - SocketAddress("99.99.99.1", cricket::STUN_SERVER_PORT); - StartStunServer(kStunServerAddress); - - PeerConnectionInterface::RTCConfiguration config; - PeerConnectionInterface::IceServer ice_stun_server; - ice_stun_server.urls.push_back( - "stun:" + kStunServerAddress.HostAsURIString() + ":" + - kStunServerAddress.PortAsString()); - config.servers.push_back(ice_stun_server); - - ASSERT_TRUE(CreatePeerConnectionWrappersWithConfig(config, config)); - ConnectFakeSignaling(); - SetPortAllocatorFlags(); - SetUpNetworkInterfaces(); - caller()->AddAudioVideoTracks(); - callee()->AddAudioVideoTracks(); - - // Initial state before anything happens. - ASSERT_EQ(PeerConnectionInterface::kIceGatheringNew, - caller()->ice_gathering_state()); - ASSERT_EQ(PeerConnectionInterface::kIceConnectionNew, - caller()->ice_connection_state()); - ASSERT_EQ(PeerConnectionInterface::kIceConnectionNew, - caller()->standardized_ice_connection_state()); - - // Start the call by creating the offer, setting it as the local description, - // then sending it to the peer who will respond with an answer. This happens - // asynchronously so that we can watch the states as it runs in the - // background. - caller()->CreateAndSetAndSignalOffer(); - - ASSERT_EQ_SIMULATED_WAIT(PeerConnectionInterface::kIceConnectionCompleted, - caller()->ice_connection_state(), kDefaultTimeout, - FakeClock()); - ASSERT_EQ_SIMULATED_WAIT(PeerConnectionInterface::kIceConnectionCompleted, - caller()->standardized_ice_connection_state(), - kDefaultTimeout, FakeClock()); - - // Verify that the observer was notified of the intermediate transitions. - EXPECT_THAT(caller()->ice_connection_state_history(), - ElementsAre(PeerConnectionInterface::kIceConnectionChecking, - PeerConnectionInterface::kIceConnectionConnected, - PeerConnectionInterface::kIceConnectionCompleted)); - EXPECT_THAT(caller()->standardized_ice_connection_state_history(), - ElementsAre(PeerConnectionInterface::kIceConnectionChecking, - PeerConnectionInterface::kIceConnectionConnected, - PeerConnectionInterface::kIceConnectionCompleted)); - EXPECT_THAT( - caller()->peer_connection_state_history(), - ElementsAre(PeerConnectionInterface::PeerConnectionState::kConnecting, - PeerConnectionInterface::PeerConnectionState::kConnected)); - EXPECT_THAT(caller()->ice_gathering_state_history(), - ElementsAre(PeerConnectionInterface::kIceGatheringGathering, - PeerConnectionInterface::kIceGatheringComplete)); - - // Block connections to/from the caller and wait for ICE to become - // disconnected. - for (const auto& caller_address : CallerAddresses()) { - firewall()->AddRule(false, rtc::FP_ANY, rtc::FD_ANY, caller_address); - } - RTC_LOG(LS_INFO) << "Firewall rules applied"; - ASSERT_EQ_SIMULATED_WAIT(PeerConnectionInterface::kIceConnectionDisconnected, - caller()->ice_connection_state(), kDefaultTimeout, - FakeClock()); - ASSERT_EQ_SIMULATED_WAIT(PeerConnectionInterface::kIceConnectionDisconnected, - caller()->standardized_ice_connection_state(), - kDefaultTimeout, FakeClock()); - - // Let ICE re-establish by removing the firewall rules. - firewall()->ClearRules(); - RTC_LOG(LS_INFO) << "Firewall rules cleared"; - ASSERT_EQ_SIMULATED_WAIT(PeerConnectionInterface::kIceConnectionCompleted, - caller()->ice_connection_state(), kDefaultTimeout, - FakeClock()); - ASSERT_EQ_SIMULATED_WAIT(PeerConnectionInterface::kIceConnectionCompleted, - caller()->standardized_ice_connection_state(), - kDefaultTimeout, FakeClock()); - - // According to RFC7675, if there is no response within 30 seconds then the - // peer should consider the other side to have rejected the connection. This - // is signaled by the state transitioning to "failed". - constexpr int kConsentTimeout = 30000; - for (const auto& caller_address : CallerAddresses()) { - firewall()->AddRule(false, rtc::FP_ANY, rtc::FD_ANY, caller_address); - } - RTC_LOG(LS_INFO) << "Firewall rules applied again"; - ASSERT_EQ_SIMULATED_WAIT(PeerConnectionInterface::kIceConnectionFailed, - caller()->ice_connection_state(), kConsentTimeout, - FakeClock()); - ASSERT_EQ_SIMULATED_WAIT(PeerConnectionInterface::kIceConnectionFailed, - caller()->standardized_ice_connection_state(), - kConsentTimeout, FakeClock()); -} - // Tests that if the connection doesn't get set up properly we eventually reach // the "failed" iceConnectionState. TEST_P(PeerConnectionIntegrationIceStatesTestWithFakeClock, @@ -2770,71 +2592,6 @@ TEST_P(PeerConnectionIntegrationTest, EXPECT_GT(client_2_cert_verifier->call_count_, 0u); } -TEST_P(PeerConnectionIntegrationTest, - SSLCertificateVerifierFailureUsedForTurnConnectionsFailsConnection) { - static const rtc::SocketAddress turn_server_internal_address{"88.88.88.0", - 3478}; - static const rtc::SocketAddress turn_server_external_address{"88.88.88.1", 0}; - - // Enable TCP-TLS for the fake turn server. We need to pass in 88.88.88.0 so - // that host name verification passes on the fake certificate. - CreateTurnServer(turn_server_internal_address, turn_server_external_address, - cricket::PROTO_TLS, "88.88.88.0"); - - webrtc::PeerConnectionInterface::IceServer ice_server; - ice_server.urls.push_back("turns:88.88.88.0:3478?transport=tcp"); - ice_server.username = "test"; - ice_server.password = "test"; - - PeerConnectionInterface::RTCConfiguration client_1_config; - client_1_config.servers.push_back(ice_server); - client_1_config.type = webrtc::PeerConnectionInterface::kRelay; - - PeerConnectionInterface::RTCConfiguration client_2_config; - client_2_config.servers.push_back(ice_server); - // Setting the type to kRelay forces the connection to go through a TURN - // server. - client_2_config.type = webrtc::PeerConnectionInterface::kRelay; - - // Get a copy to the pointer so we can verify calls later. - rtc::TestCertificateVerifier* client_1_cert_verifier = - new rtc::TestCertificateVerifier(); - client_1_cert_verifier->verify_certificate_ = false; - rtc::TestCertificateVerifier* client_2_cert_verifier = - new rtc::TestCertificateVerifier(); - client_2_cert_verifier->verify_certificate_ = false; - - // Create the dependencies with the test certificate verifier. - webrtc::PeerConnectionDependencies client_1_deps(nullptr); - client_1_deps.tls_cert_verifier = - std::unique_ptr(client_1_cert_verifier); - webrtc::PeerConnectionDependencies client_2_deps(nullptr); - client_2_deps.tls_cert_verifier = - std::unique_ptr(client_2_cert_verifier); - - ASSERT_TRUE(CreatePeerConnectionWrappersWithConfigAndDeps( - client_1_config, std::move(client_1_deps), client_2_config, - std::move(client_2_deps))); - ConnectFakeSignaling(); - - // Set "offer to receive audio/video" without adding any tracks, so we just - // set up ICE/DTLS with no media. - PeerConnectionInterface::RTCOfferAnswerOptions options; - options.offer_to_receive_audio = 1; - options.offer_to_receive_video = 1; - caller()->SetOfferAnswerOptions(options); - caller()->CreateAndSetAndSignalOffer(); - bool wait_res = true; - // TODO(bugs.webrtc.org/9219): When IceConnectionState is implemented - // properly, should be able to just wait for a state of "failed" instead of - // waiting a fixed 10 seconds. - WAIT_(DtlsConnected(), kDefaultTimeout, wait_res); - ASSERT_FALSE(wait_res); - - EXPECT_GT(client_1_cert_verifier->call_count_, 0u); - EXPECT_GT(client_2_cert_verifier->call_count_, 0u); -} - // Test that the injected ICE transport factory is used to create ICE transports // for WebRTC connections. TEST_P(PeerConnectionIntegrationTest, IceTransportFactoryUsedForConnections) { diff --git a/pc/slow_peer_connection_integration_test.cc b/pc/slow_peer_connection_integration_test.cc new file mode 100644 index 0000000000..b45571ec22 --- /dev/null +++ b/pc/slow_peer_connection_integration_test.cc @@ -0,0 +1,512 @@ +/* + * Copyright 2022 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. + */ + +// This file is intended for PeerConnection integration tests that are +// slow to execute (currently defined as more than 5 seconds per test). + +#include + +#include +#include +#include +#include +#include + +#include "absl/algorithm/container.h" +#include "absl/strings/string_view.h" +#include "absl/types/optional.h" +#include "api/dtmf_sender_interface.h" +#include "api/peer_connection_interface.h" +#include "api/rtp_receiver_interface.h" +#include "api/scoped_refptr.h" +#include "api/units/time_delta.h" +#include "p2p/base/port_allocator.h" +#include "p2p/base/port_interface.h" +#include "p2p/base/stun_server.h" +#include "p2p/base/test_stun_server.h" +#include "pc/test/integration_test_helpers.h" +#include "pc/test/mock_peer_connection_observers.h" +#include "rtc_base/fake_clock.h" +#include "rtc_base/fake_network.h" +#include "rtc_base/firewall_socket_server.h" +#include "rtc_base/gunit.h" +#include "rtc_base/logging.h" +#include "rtc_base/socket_address.h" +#include "rtc_base/ssl_certificate.h" +#include "rtc_base/test_certificate_verifier.h" +#include "test/gmock.h" +#include "test/gtest.h" + +namespace webrtc { + +namespace { + +class PeerConnectionIntegrationTest + : public PeerConnectionIntegrationBaseTest, + public ::testing::WithParamInterface< + std::tuple> { + protected: + PeerConnectionIntegrationTest() + : PeerConnectionIntegrationBaseTest(std::get<0>(GetParam()), + std::get<1>(GetParam())) {} +}; + +// Fake clock must be set before threads are started to prevent race on +// Set/GetClockForTesting(). +// To achieve that, multiple inheritance is used as a mixin pattern +// where order of construction is finely controlled. +// This also ensures peerconnection is closed before switching back to non-fake +// clock, avoiding other races and DCHECK failures such as in rtp_sender.cc. +class FakeClockForTest : public rtc::ScopedFakeClock { + protected: + FakeClockForTest() { + // Some things use a time of "0" as a special value, so we need to start out + // the fake clock at a nonzero time. + // TODO(deadbeef): Fix this. + AdvanceTime(webrtc::TimeDelta::Seconds(1)); + } + + // Explicit handle. + ScopedFakeClock& FakeClock() { return *this; } +}; + +// Ensure FakeClockForTest is constructed first (see class for rationale). +class PeerConnectionIntegrationTestWithFakeClock + : public FakeClockForTest, + public PeerConnectionIntegrationTest {}; + +class PeerConnectionIntegrationTestPlanB + : public PeerConnectionIntegrationBaseTest { + protected: + PeerConnectionIntegrationTestPlanB() + : PeerConnectionIntegrationBaseTest(SdpSemantics::kPlanB_DEPRECATED) {} +}; + +class PeerConnectionIntegrationTestUnifiedPlan + : public PeerConnectionIntegrationBaseTest { + protected: + PeerConnectionIntegrationTestUnifiedPlan() + : PeerConnectionIntegrationBaseTest(SdpSemantics::kUnifiedPlan) {} +}; + +// Test the OnFirstPacketReceived callback from audio/video RtpReceivers. This +// includes testing that the callback is invoked if an observer is connected +// after the first packet has already been received. +TEST_P(PeerConnectionIntegrationTest, + RtpReceiverObserverOnFirstPacketReceived) { + ASSERT_TRUE(CreatePeerConnectionWrappers()); + ConnectFakeSignaling(); + caller()->AddAudioVideoTracks(); + callee()->AddAudioVideoTracks(); + // Start offer/answer exchange and wait for it to complete. + caller()->CreateAndSetAndSignalOffer(); + ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); + // Should be one receiver each for audio/video. + EXPECT_EQ(2U, caller()->rtp_receiver_observers().size()); + EXPECT_EQ(2U, callee()->rtp_receiver_observers().size()); + // Wait for all "first packet received" callbacks to be fired. + EXPECT_TRUE_WAIT( + absl::c_all_of(caller()->rtp_receiver_observers(), + [](const std::unique_ptr& o) { + return o->first_packet_received(); + }), + kMaxWaitForFramesMs); + EXPECT_TRUE_WAIT( + absl::c_all_of(callee()->rtp_receiver_observers(), + [](const std::unique_ptr& o) { + return o->first_packet_received(); + }), + kMaxWaitForFramesMs); + // If new observers are set after the first packet was already received, the + // callback should still be invoked. + caller()->ResetRtpReceiverObservers(); + callee()->ResetRtpReceiverObservers(); + EXPECT_EQ(2U, caller()->rtp_receiver_observers().size()); + EXPECT_EQ(2U, callee()->rtp_receiver_observers().size()); + EXPECT_TRUE( + absl::c_all_of(caller()->rtp_receiver_observers(), + [](const std::unique_ptr& o) { + return o->first_packet_received(); + })); + EXPECT_TRUE( + absl::c_all_of(callee()->rtp_receiver_observers(), + [](const std::unique_ptr& o) { + return o->first_packet_received(); + })); +} + +class DummyDtmfObserver : public DtmfSenderObserverInterface { + public: + DummyDtmfObserver() : completed_(false) {} + + // Implements DtmfSenderObserverInterface. + void OnToneChange(const std::string& tone) override { + tones_.push_back(tone); + if (tone.empty()) { + completed_ = true; + } + } + + const std::vector& tones() const { return tones_; } + bool completed() const { return completed_; } + + private: + bool completed_; + std::vector tones_; +}; + +TEST_P(PeerConnectionIntegrationTest, + SSLCertificateVerifierFailureUsedForTurnConnectionsFailsConnection) { + static const rtc::SocketAddress turn_server_internal_address{"88.88.88.0", + 3478}; + static const rtc::SocketAddress turn_server_external_address{"88.88.88.1", 0}; + + // Enable TCP-TLS for the fake turn server. We need to pass in 88.88.88.0 so + // that host name verification passes on the fake certificate. + CreateTurnServer(turn_server_internal_address, turn_server_external_address, + cricket::PROTO_TLS, "88.88.88.0"); + + webrtc::PeerConnectionInterface::IceServer ice_server; + ice_server.urls.push_back("turns:88.88.88.0:3478?transport=tcp"); + ice_server.username = "test"; + ice_server.password = "test"; + + PeerConnectionInterface::RTCConfiguration client_1_config; + client_1_config.servers.push_back(ice_server); + client_1_config.type = webrtc::PeerConnectionInterface::kRelay; + + PeerConnectionInterface::RTCConfiguration client_2_config; + client_2_config.servers.push_back(ice_server); + // Setting the type to kRelay forces the connection to go through a TURN + // server. + client_2_config.type = webrtc::PeerConnectionInterface::kRelay; + + // Get a copy to the pointer so we can verify calls later. + rtc::TestCertificateVerifier* client_1_cert_verifier = + new rtc::TestCertificateVerifier(); + client_1_cert_verifier->verify_certificate_ = false; + rtc::TestCertificateVerifier* client_2_cert_verifier = + new rtc::TestCertificateVerifier(); + client_2_cert_verifier->verify_certificate_ = false; + + // Create the dependencies with the test certificate verifier. + webrtc::PeerConnectionDependencies client_1_deps(nullptr); + client_1_deps.tls_cert_verifier = + std::unique_ptr(client_1_cert_verifier); + webrtc::PeerConnectionDependencies client_2_deps(nullptr); + client_2_deps.tls_cert_verifier = + std::unique_ptr(client_2_cert_verifier); + + ASSERT_TRUE(CreatePeerConnectionWrappersWithConfigAndDeps( + client_1_config, std::move(client_1_deps), client_2_config, + std::move(client_2_deps))); + ConnectFakeSignaling(); + + // Set "offer to receive audio/video" without adding any tracks, so we just + // set up ICE/DTLS with no media. + PeerConnectionInterface::RTCOfferAnswerOptions options; + options.offer_to_receive_audio = 1; + options.offer_to_receive_video = 1; + caller()->SetOfferAnswerOptions(options); + caller()->CreateAndSetAndSignalOffer(); + bool wait_res = true; + // TODO(bugs.webrtc.org/9219): When IceConnectionState is implemented + // properly, should be able to just wait for a state of "failed" instead of + // waiting a fixed 10 seconds. + WAIT_(DtlsConnected(), kDefaultTimeout, wait_res); + ASSERT_FALSE(wait_res); + + EXPECT_GT(client_1_cert_verifier->call_count_, 0u); + EXPECT_GT(client_2_cert_verifier->call_count_, 0u); +} + +// Test that we can get capture start ntp time. +TEST_P(PeerConnectionIntegrationTest, GetCaptureStartNtpTimeWithOldStatsApi) { + ASSERT_TRUE(CreatePeerConnectionWrappers()); + ConnectFakeSignaling(); + caller()->AddAudioTrack(); + + callee()->AddAudioTrack(); + + // Do offer/answer, wait for the callee to receive some frames. + caller()->CreateAndSetAndSignalOffer(); + ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); + + // Get the remote audio track created on the receiver, so they can be used as + // GetStats filters. + auto receivers = callee()->pc()->GetReceivers(); + ASSERT_EQ(1u, receivers.size()); + auto remote_audio_track = receivers[0]->track(); + + // Get the audio output level stats. Note that the level is not available + // until an RTCP packet has been received. + EXPECT_TRUE_WAIT(callee()->OldGetStatsForTrack(remote_audio_track.get()) + ->CaptureStartNtpTime() > 0, + 2 * kMaxWaitForFramesMs); +} + +// Test that firewalling the ICE connection causes the clients to identify the +// disconnected state and then removing the firewall causes them to reconnect. +class PeerConnectionIntegrationIceStatesTest + : public PeerConnectionIntegrationBaseTest, + public ::testing::WithParamInterface< + std::tuple>> { + protected: + PeerConnectionIntegrationIceStatesTest() + : PeerConnectionIntegrationBaseTest(std::get<0>(GetParam())) { + port_allocator_flags_ = std::get<1>(std::get<1>(GetParam())); + } + + void StartStunServer(const SocketAddress& server_address) { + stun_server_.reset( + cricket::TestStunServer::Create(firewall(), server_address)); + } + + bool TestIPv6() { + return (port_allocator_flags_ & cricket::PORTALLOCATOR_ENABLE_IPV6); + } + + void SetPortAllocatorFlags() { + PeerConnectionIntegrationBaseTest::SetPortAllocatorFlags( + port_allocator_flags_, port_allocator_flags_); + } + + std::vector CallerAddresses() { + std::vector addresses; + addresses.push_back(SocketAddress("1.1.1.1", 0)); + if (TestIPv6()) { + addresses.push_back(SocketAddress("1111:0:a:b:c:d:e:f", 0)); + } + return addresses; + } + + std::vector CalleeAddresses() { + std::vector addresses; + addresses.push_back(SocketAddress("2.2.2.2", 0)); + if (TestIPv6()) { + addresses.push_back(SocketAddress("2222:0:a:b:c:d:e:f", 0)); + } + return addresses; + } + + void SetUpNetworkInterfaces() { + // Remove the default interfaces added by the test infrastructure. + caller()->network_manager()->RemoveInterface(kDefaultLocalAddress); + callee()->network_manager()->RemoveInterface(kDefaultLocalAddress); + + // Add network addresses for test. + for (const auto& caller_address : CallerAddresses()) { + caller()->network_manager()->AddInterface(caller_address); + } + for (const auto& callee_address : CalleeAddresses()) { + callee()->network_manager()->AddInterface(callee_address); + } + } + + private: + uint32_t port_allocator_flags_; + std::unique_ptr stun_server_; +}; + +// Ensure FakeClockForTest is constructed first (see class for rationale). +class PeerConnectionIntegrationIceStatesTestWithFakeClock + : public FakeClockForTest, + public PeerConnectionIntegrationIceStatesTest {}; + +#if !defined(THREAD_SANITIZER) +// This test provokes TSAN errors. bugs.webrtc.org/11282 + +// Tests that the PeerConnection goes through all the ICE gathering/connection +// states over the duration of the call. This includes Disconnected and Failed +// states, induced by putting a firewall between the peers and waiting for them +// to time out. +TEST_P(PeerConnectionIntegrationIceStatesTestWithFakeClock, VerifyIceStates) { + const SocketAddress kStunServerAddress = + SocketAddress("99.99.99.1", cricket::STUN_SERVER_PORT); + StartStunServer(kStunServerAddress); + + PeerConnectionInterface::RTCConfiguration config; + PeerConnectionInterface::IceServer ice_stun_server; + ice_stun_server.urls.push_back( + "stun:" + kStunServerAddress.HostAsURIString() + ":" + + kStunServerAddress.PortAsString()); + config.servers.push_back(ice_stun_server); + + ASSERT_TRUE(CreatePeerConnectionWrappersWithConfig(config, config)); + ConnectFakeSignaling(); + SetPortAllocatorFlags(); + SetUpNetworkInterfaces(); + caller()->AddAudioVideoTracks(); + callee()->AddAudioVideoTracks(); + + // Initial state before anything happens. + ASSERT_EQ(PeerConnectionInterface::kIceGatheringNew, + caller()->ice_gathering_state()); + ASSERT_EQ(PeerConnectionInterface::kIceConnectionNew, + caller()->ice_connection_state()); + ASSERT_EQ(PeerConnectionInterface::kIceConnectionNew, + caller()->standardized_ice_connection_state()); + + // Start the call by creating the offer, setting it as the local description, + // then sending it to the peer who will respond with an answer. This happens + // asynchronously so that we can watch the states as it runs in the + // background. + caller()->CreateAndSetAndSignalOffer(); + + ASSERT_EQ_SIMULATED_WAIT(PeerConnectionInterface::kIceConnectionCompleted, + caller()->ice_connection_state(), kDefaultTimeout, + FakeClock()); + ASSERT_EQ_SIMULATED_WAIT(PeerConnectionInterface::kIceConnectionCompleted, + caller()->standardized_ice_connection_state(), + kDefaultTimeout, FakeClock()); + + // Verify that the observer was notified of the intermediate transitions. + EXPECT_THAT(caller()->ice_connection_state_history(), + ElementsAre(PeerConnectionInterface::kIceConnectionChecking, + PeerConnectionInterface::kIceConnectionConnected, + PeerConnectionInterface::kIceConnectionCompleted)); + EXPECT_THAT(caller()->standardized_ice_connection_state_history(), + ElementsAre(PeerConnectionInterface::kIceConnectionChecking, + PeerConnectionInterface::kIceConnectionConnected, + PeerConnectionInterface::kIceConnectionCompleted)); + EXPECT_THAT( + caller()->peer_connection_state_history(), + ElementsAre(PeerConnectionInterface::PeerConnectionState::kConnecting, + PeerConnectionInterface::PeerConnectionState::kConnected)); + EXPECT_THAT(caller()->ice_gathering_state_history(), + ElementsAre(PeerConnectionInterface::kIceGatheringGathering, + PeerConnectionInterface::kIceGatheringComplete)); + + // Block connections to/from the caller and wait for ICE to become + // disconnected. + for (const auto& caller_address : CallerAddresses()) { + firewall()->AddRule(false, rtc::FP_ANY, rtc::FD_ANY, caller_address); + } + RTC_LOG(LS_INFO) << "Firewall rules applied"; + ASSERT_EQ_SIMULATED_WAIT(PeerConnectionInterface::kIceConnectionDisconnected, + caller()->ice_connection_state(), kDefaultTimeout, + FakeClock()); + ASSERT_EQ_SIMULATED_WAIT(PeerConnectionInterface::kIceConnectionDisconnected, + caller()->standardized_ice_connection_state(), + kDefaultTimeout, FakeClock()); + + // Let ICE re-establish by removing the firewall rules. + firewall()->ClearRules(); + RTC_LOG(LS_INFO) << "Firewall rules cleared"; + ASSERT_EQ_SIMULATED_WAIT(PeerConnectionInterface::kIceConnectionCompleted, + caller()->ice_connection_state(), kDefaultTimeout, + FakeClock()); + ASSERT_EQ_SIMULATED_WAIT(PeerConnectionInterface::kIceConnectionCompleted, + caller()->standardized_ice_connection_state(), + kDefaultTimeout, FakeClock()); + + // According to RFC7675, if there is no response within 30 seconds then the + // peer should consider the other side to have rejected the connection. This + // is signaled by the state transitioning to "failed". + constexpr int kConsentTimeout = 30000; + for (const auto& caller_address : CallerAddresses()) { + firewall()->AddRule(false, rtc::FP_ANY, rtc::FD_ANY, caller_address); + } + RTC_LOG(LS_INFO) << "Firewall rules applied again"; + ASSERT_EQ_SIMULATED_WAIT(PeerConnectionInterface::kIceConnectionFailed, + caller()->ice_connection_state(), kConsentTimeout, + FakeClock()); + ASSERT_EQ_SIMULATED_WAIT(PeerConnectionInterface::kIceConnectionFailed, + caller()->standardized_ice_connection_state(), + kConsentTimeout, FakeClock()); +} +#endif + +// This test sets up a call that's transferred to a new caller with a different +// DTLS fingerprint. +TEST_P(PeerConnectionIntegrationTest, CallTransferredForCallee) { + ASSERT_TRUE(CreatePeerConnectionWrappers()); + ConnectFakeSignaling(); + caller()->AddAudioVideoTracks(); + callee()->AddAudioVideoTracks(); + caller()->CreateAndSetAndSignalOffer(); + ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); + + // Keep the original peer around which will still send packets to the + // receiving client. These SRTP packets will be dropped. + std::unique_ptr original_peer( + SetCallerPcWrapperAndReturnCurrent( + CreatePeerConnectionWrapperWithAlternateKey().release())); + // TODO(deadbeef): Why do we call Close here? That goes against the comment + // directly above. + original_peer->pc()->Close(); + + ConnectFakeSignaling(); + caller()->AddAudioVideoTracks(); + caller()->CreateAndSetAndSignalOffer(); + ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); + // Wait for some additional frames to be transmitted end-to-end. + MediaExpectations media_expectations; + media_expectations.ExpectBidirectionalAudioAndVideo(); + ASSERT_TRUE(ExpectNewFrames(media_expectations)); +} + +// This test sets up a call that's transferred to a new callee with a different +// DTLS fingerprint. +TEST_P(PeerConnectionIntegrationTest, CallTransferredForCaller) { + ASSERT_TRUE(CreatePeerConnectionWrappers()); + ConnectFakeSignaling(); + caller()->AddAudioVideoTracks(); + callee()->AddAudioVideoTracks(); + caller()->CreateAndSetAndSignalOffer(); + ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); + + // Keep the original peer around which will still send packets to the + // receiving client. These SRTP packets will be dropped. + std::unique_ptr original_peer( + SetCalleePcWrapperAndReturnCurrent( + CreatePeerConnectionWrapperWithAlternateKey().release())); + // TODO(deadbeef): Why do we call Close here? That goes against the comment + // directly above. + original_peer->pc()->Close(); + + ConnectFakeSignaling(); + callee()->AddAudioVideoTracks(); + caller()->SetOfferAnswerOptions(IceRestartOfferAnswerOptions()); + caller()->CreateAndSetAndSignalOffer(); + ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); + // Wait for some additional frames to be transmitted end-to-end. + MediaExpectations media_expectations; + media_expectations.ExpectBidirectionalAudioAndVideo(); + ASSERT_TRUE(ExpectNewFrames(media_expectations)); +} + +INSTANTIATE_TEST_SUITE_P( + PeerConnectionIntegrationTest, + PeerConnectionIntegrationTest, + Combine(Values(SdpSemantics::kPlanB_DEPRECATED, SdpSemantics::kUnifiedPlan), + Values("WebRTC-FrameBuffer3/arm:FrameBuffer2/", + "WebRTC-FrameBuffer3/arm:FrameBuffer3/", + "WebRTC-FrameBuffer3/arm:SyncDecoding/"))); + +constexpr uint32_t kFlagsIPv4NoStun = cricket::PORTALLOCATOR_DISABLE_TCP | + cricket::PORTALLOCATOR_DISABLE_STUN | + cricket::PORTALLOCATOR_DISABLE_RELAY; +constexpr uint32_t kFlagsIPv6NoStun = + cricket::PORTALLOCATOR_DISABLE_TCP | cricket::PORTALLOCATOR_DISABLE_STUN | + cricket::PORTALLOCATOR_ENABLE_IPV6 | cricket::PORTALLOCATOR_DISABLE_RELAY; +constexpr uint32_t kFlagsIPv4Stun = + cricket::PORTALLOCATOR_DISABLE_TCP | cricket::PORTALLOCATOR_DISABLE_RELAY; + +INSTANTIATE_TEST_SUITE_P( + PeerConnectionIntegrationTest, + PeerConnectionIntegrationIceStatesTestWithFakeClock, + Combine(Values(SdpSemantics::kPlanB_DEPRECATED, SdpSemantics::kUnifiedPlan), + Values(std::make_pair("IPv4 no STUN", kFlagsIPv4NoStun), + std::make_pair("IPv6 no STUN", kFlagsIPv6NoStun), + std::make_pair("IPv4 with STUN", kFlagsIPv4Stun)))); + +} // namespace +} // namespace webrtc