Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[browser][tests] Standup System.Net.WebSockets.Client.Tests in CI #44781

Merged
merged 11 commits into from
Nov 21, 2020
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class ClientWebSocketOptionsTests : ClientWebSocketTestBase
public ClientWebSocketOptionsTests(ITestOutputHelper output) : base(output) { }

[ConditionalFact(nameof(WebSocketsSupported))]
[PlatformSpecific(~TestPlatforms.Browser)] // Credentials not supported on browser
public static void UseDefaultCredentials_Roundtrips()
{
var cws = new ClientWebSocket();
Expand All @@ -28,6 +29,7 @@ public static void UseDefaultCredentials_Roundtrips()
}

[ConditionalFact(nameof(WebSocketsSupported))]
[PlatformSpecific(~TestPlatforms.Browser)] // Proxy not supported on browser
public static void Proxy_Roundtrips()
{
var cws = new ClientWebSocket();
Expand Down Expand Up @@ -99,6 +101,7 @@ public async Task Proxy_ConnectThruProxy_Success(Uri server)
}

[ConditionalFact(nameof(WebSocketsSupported))]
[PlatformSpecific(~TestPlatforms.Browser)] // Buffer not supported on browser
public static void SetBuffer_InvalidArgs_Throws()
{
// Recreate the minimum WebSocket buffer size values from the .NET Framework version of WebSocket,
Expand All @@ -120,6 +123,7 @@ public static void SetBuffer_InvalidArgs_Throws()
}

[ConditionalFact(nameof(WebSocketsSupported))]
[PlatformSpecific(~TestPlatforms.Browser)] // KeepAlive not supported on browser
public static void KeepAliveInterval_Roundtrips()
{
var cws = new ClientWebSocket();
Expand All @@ -138,6 +142,7 @@ public static void KeepAliveInterval_Roundtrips()
}

[ConditionalFact(nameof(WebSocketsSupported))]
[PlatformSpecific(~TestPlatforms.Browser)] // Certificates not supported on browser
public void RemoteCertificateValidationCallback_Roundtrips()
{
using (var cws = new ClientWebSocket())
Expand All @@ -157,6 +162,7 @@ public void RemoteCertificateValidationCallback_Roundtrips()
[ConditionalTheory(nameof(WebSocketsSupported))]
[InlineData(false)]
[InlineData(true)]
[PlatformSpecific(~TestPlatforms.Browser)] // Certificates not supported on browser
public async Task RemoteCertificateValidationCallback_PassedRemoteCertificateInfo(bool secure)
{
if (PlatformDetection.IsWindows7)
Expand Down Expand Up @@ -193,6 +199,7 @@ await LoopbackServer.CreateClientAndServerAsync(async uri =>

[OuterLoop("Connects to remote service")]
[ConditionalFact(nameof(WebSocketsSupported))]
[PlatformSpecific(~TestPlatforms.Browser)] // Credentials not supported on browser
public async Task ClientCertificates_ValidCertificate_ServerReceivesCertificateAndConnectAsyncSucceeds()
{
if (PlatformDetection.IsWindows7)
Expand Down Expand Up @@ -230,6 +237,7 @@ await LoopbackServer.CreateClientAndServerAsync(async uri =>
[ActiveIssue("https://github.com/dotnet/runtime/issues/34690", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
[InlineData("ws://")]
[InlineData("wss://")]
[PlatformSpecific(~TestPlatforms.Browser)] // Credentials not supported on browser
public async Task NonSecureConnect_ConnectThruProxy_CONNECTisUsed(string connectionType)
{
if (PlatformDetection.IsWindows7)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ public async Task CloseAsync_DuringConcurrentReceiveAsync_ExpectedStates(Uri ser

[ConditionalFact(nameof(WebSocketsSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/34690", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
[PlatformSpecific(~TestPlatforms.Browser)] // LoopBack not not supported on browser
kjpou1 marked this conversation as resolved.
Show resolved Hide resolved
public async Task CloseAsync_CancelableEvenWhenPendingReceive_Throws()
{
var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public async Task ConnectAsync_AddCustomHeaders_Success(Uri server)

[ConditionalFact(nameof(WebSocketsSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/34690", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
[PlatformSpecific(~TestPlatforms.Browser)] // Loopback not supported on browser
public async Task ConnectAsync_AddHostHeader_Success()
{
string expectedHost = null;
Expand Down Expand Up @@ -208,6 +209,7 @@ public async Task ConnectAsync_PassMultipleSubProtocols_ServerRequires_Connectio

[ConditionalFact(nameof(WebSocketsSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/34690", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
[PlatformSpecific(~TestPlatforms.Browser)] // Loopback not supported on browser
public async Task ConnectAsync_NonStandardRequestHeaders_HeadersAddedWithoutValidation()
{
await LoopbackServer.CreateClientAndServerAsync(async uri =>
Expand All @@ -227,6 +229,7 @@ await LoopbackServer.CreateClientAndServerAsync(async uri =>

[OuterLoop("Uses external servers")]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
[PlatformSpecific(~TestPlatforms.Browser)] // Loopback not supported on browser
public async Task ConnectAndCloseAsync_UseProxyServer_ExpectedClosedState(Uri server)
{
using (var cws = new ClientWebSocket())
Expand All @@ -246,6 +249,7 @@ public async Task ConnectAndCloseAsync_UseProxyServer_ExpectedClosedState(Uri se
}

[ConditionalFact(nameof(WebSocketsSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/44720")]
public async Task ConnectAsync_CancellationRequestedBeforeConnect_ThrowsOperationCanceledException()
{
using (var clientSocket = new ClientWebSocket())
Expand All @@ -259,6 +263,7 @@ public async Task ConnectAsync_CancellationRequestedBeforeConnect_ThrowsOperatio

[ConditionalFact(nameof(WebSocketsSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/34690", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
[PlatformSpecific(~TestPlatforms.Browser)] // Loopback not supported on browser
public async Task ConnectAsync_CancellationRequestedAfterConnect_ThrowsOperationCanceledException()
{
var releaseServer = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ public async Task SendReceive_Concurrent_Success(Uri server)

[OuterLoop("Uses external servers")]
[ConditionalFact(nameof(WebSocketsSupported))]
[PlatformSpecific(~TestPlatforms.Browser)] // LoopBack not not supported on browser
public async Task SendReceive_ConnectionClosedPrematurely_ReceiveAsyncFailsAndWebSocketStateUpdated()
{
var options = new LoopbackServer.Options { WebSocketEndpoint = true };
Expand Down
1 change: 0 additions & 1 deletion src/libraries/tests.proj
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@

<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Linq.Parallel\tests\System.Linq.Parallel.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Net.Http\tests\FunctionalTests\System.Net.Http.Functional.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Net.WebSockets.Client\tests\System.Net.WebSockets.Client.Tests.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down