Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixing WebSocketHelper for tests on browser
  • Loading branch information
Katya Sokolova committed Dec 1, 2022
commit 09533467b8f65053ae01ef742654013240919779
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<StringResourcesPath>../src/Resources/Strings.resx</StringResourcesPath>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppCurrent)-Browser</TargetFrameworks>
Expand Down Expand Up @@ -70,15 +70,16 @@
<Compile Include="LoopbackHelper.cs" />
<Compile Include="ResourceHelper.cs" />
<Compile Include="SendReceiveTest.cs" />
<Compile Include="SendReceiveTest.Http2.cs" Condition="'$(TargetsBrowser)' == 'false'" />
<Compile Include="SendReceiveTest.Http2.cs" />
<Compile Include="WebSocketData.cs" />
<Compile Include="WebSocketHelper.cs" />
<Compile Include="DeflateTests.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Net.TestData" Version="$(SystemNetTestDataVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\System.Net.Http\ref\System.Net.Http.csproj" />
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Test" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,17 @@ public static Task<ClientWebSocket> GetConnectedWebSocket(
cws.Options.KeepAliveInterval = keepAliveInterval;
}

if (invoker == null)
if (!PlatformDetection.IsBrowser)
{
cws.Options.ClientCertificates.Add(Test.Common.Configuration.Certificates.GetClientCertificate());
cws.Options.RemoteCertificateValidationCallback = delegate { return true; };
if (invoker == null)
{
cws.Options.ClientCertificates.Add(Test.Common.Configuration.Certificates.GetClientCertificate());
cws.Options.RemoteCertificateValidationCallback = delegate { return true; };
}
cws.Options.HttpVersion = version;
cws.Options.HttpVersionPolicy = HttpVersionPolicy.RequestVersionExact;
}

cws.Options.HttpVersion = version;
cws.Options.HttpVersionPolicy = HttpVersionPolicy.RequestVersionExact;

using (var cts = new CancellationTokenSource(timeOutMilliseconds))
{
output.WriteLine("GetConnectedWebSocket: ConnectAsync starting.");
Expand All @@ -119,7 +121,7 @@ public static Task<ClientWebSocket> GetConnectedWebSocket(

public static async Task<T> Retry<T>(ITestOutputHelper output, Func<Task<T>> func)
{
const int MaxTries = 1;
const int MaxTries = 5;
int betweenTryDelayMilliseconds = 1000;

for (int i = 1; ; i++)
Expand Down