diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs index df828e0f7eeff7..a17d3eebce28dc 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs @@ -24,6 +24,8 @@ public static partial class PlatformDetection public static bool IsMonoInterpreter => GetIsRunningOnMonoInterpreter(); public static bool IsFreeBSD => RuntimeInformation.IsOSPlatform(OSPlatform.Create("FREEBSD")); public static bool IsNetBSD => RuntimeInformation.IsOSPlatform(OSPlatform.Create("NETBSD")); + public static bool IsiOS => RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS")); + public static bool IstvOS => RuntimeInformation.IsOSPlatform(OSPlatform.Create("TVOS")); public static bool IsArmProcess => RuntimeInformation.ProcessArchitecture == Architecture.Arm; public static bool IsNotArmProcess => !IsArmProcess; @@ -109,11 +111,13 @@ public static bool IsNonZeroLowerBoundArraySupported // Windows - Schannel supports alpn from win8.1/2012 R2 and higher. // Linux - OpenSsl supports alpn from openssl 1.0.2 and higher. // OSX - SecureTransport doesn't expose alpn APIs. TODO https://github.com/dotnet/runtime/issues/27727 + public static bool IsOpenSslSupported => IsLinux || IsFreeBSD; + public static bool SupportsAlpn => (IsWindows && !IsWindows7) || - ((!IsOSX && !IsWindows) && + (IsOpenSslSupported && (OpenSslVersion.Major >= 1 && (OpenSslVersion.Minor >= 1 || OpenSslVersion.Build >= 2))); - public static bool SupportsClientAlpn => SupportsAlpn || (IsOSX && Environment.OSVersion.Version > new Version(10, 12)); + public static bool SupportsClientAlpn => SupportsAlpn || IsOSX || IsiOS || IstvOS; // OpenSSL 1.1.1 and above. public static bool SupportsTls13 => GetTls13Support(); @@ -261,16 +265,18 @@ private static bool GetTls13Support() // assume no if key is missing or on error. return false; } - else if (IsOSX) + else if (IsOSX || IsiOS || IstvOS) { // [ActiveIssue("https://github.com/dotnet/runtime/issues/1979")] return false; } - else + else if (IsOpenSslSupported) { // Covers Linux and FreeBSD return OpenSslVersion >= new Version(1,1,1); } + + return false; } private static bool GetIsRunningOnMonoInterpreter()