未验证 提交 fb61be47 编写于 作者: P Pavel Savara 提交者: GitHub

[wasm][testing] hosting echo server in xharness process (#52923)

- move tests to inner loop
- include echo middleware in xharness server
- improve doc
- more granular ActiveIssue https://github.com/dotnet/runtime/issues/53592 for lack of TRACE
- more granular ActiveIssue https://github.com/dotnet/runtime/issues/53591 for content on GET/HEAD
- more granular ActiveIssue https://github.com/dotnet/runtime/issues/53874 for HttpRequestMessage.Headers.Host
- more granular ActiveIssue https://github.com/dotnet/runtime/issues/53872 for NPE on System.Net.Http.BrowserHttpHandler
- more granular ActiveIssue https://github.com/dotnet/runtime/issues/53876
- include middleware in Helix correlation payload
上级 78579ef0
......@@ -100,11 +100,11 @@ The following shows how to run tests for a specific library
- `$(WasmXHarnessArgs)` - xharness command arguments
Example: `WasmXHarnessArgs="--xyz"` -> becomes `dotnet xharness wasm test --xyz`
Example: `WasmXHarnessArgs="--set-web-server-http-env=DOTNET_TEST_WEBSOCKETHOST"` -> becomes `dotnet xharness wasm test --set-web-server-http-env=DOTNET_TEST_WEBSOCKETHOST`
- `$(WasmXHarnessMonoArgs)` - arguments to mono
- `$(WasmXHarnessMonoArgs)` - arguments and variables for mono
Example: `WasmXHarnessMonoArgs="--runtime-arg=--trace=E"`
Example: `WasmXHarnessMonoArgs="--runtime-arg=--trace=E --setenv=MONO_LOG_LEVEL=debug"`
- `$(WasmTestAppArgs)` - arguments for the test app itself
......
......@@ -12,11 +12,12 @@ public static partial class Http
{
private static readonly string DefaultHttp2AzureServer = "corefx-net-http2.azurewebsites.net";
// for the local server hosted in XHarness we are passing also port as part of the environment variables, because it's bound to random port number
public static string Host => GetValue("DOTNET_TEST_HTTPHOST", DefaultAzureServer);
public static string SecureHost => GetValue("DOTNET_TEST_SECUREHTTPHOST", DefaultAzureServer);
public static string Http2Host => GetValue("DOTNET_TEST_HTTP2HOST", DefaultHttp2AzureServer);
public static int Port = GetPortValue("DOTNET_TEST_HTTPHOST", 80);
public static int SecurePort = GetPortValue("DOTNET_TEST_SECUREHTTPHOST", 443);
// This server doesn't use HTTP/2 server push (push promise) feature. Some HttpClient implementations
// don't support servers that use push right now.
......
......@@ -21,6 +21,25 @@ private static string GetValue(string envName, string defaultValue=null)
return Environment.ExpandEnvironmentVariables(envValue);
}
private static int GetPortValue(string envName, int defaultValue)
{
string envValue = Environment.GetEnvironmentVariable(envName);
if (string.IsNullOrWhiteSpace(envValue))
{
return defaultValue;
}
envValue = Environment.ExpandEnvironmentVariables(envValue);
var split = envValue.Split(':');
if (split.Length<2)
{
return defaultValue;
}
return int.Parse(split[1]);
}
private static Uri GetUriValue(string envName, Uri defaultValue=null)
{
string envValue = GetValue(envName, null);
......
......@@ -77,9 +77,9 @@ public async Task UseDefaultCredentials_SetToFalseAndServerNeedsAuth_StatusCodeU
}
}
[OuterLoop("Uses external servers")]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task SendAsync_SimpleGet_Success(Configuration.Http.RemoteServer remoteServer)
{
using (HttpClient client = CreateHttpClientForRemoteServer(remoteServer))
......@@ -95,9 +95,8 @@ public async Task SendAsync_SimpleGet_Success(Configuration.Http.RemoteServer re
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
public async Task SendAsync_MultipleRequestsReusingSameClient_Success(Configuration.Http.RemoteServer remoteServer)
{
using (HttpClient client = CreateHttpClientForRemoteServer(remoteServer))
......@@ -112,9 +111,9 @@ public async Task SendAsync_MultipleRequestsReusingSameClient_Success(Configurat
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task GetAsync_ResponseContentAfterClientAndHandlerDispose_Success(Configuration.Http.RemoteServer remoteServer)
{
using (HttpClient client = CreateHttpClientForRemoteServer(remoteServer))
......@@ -162,9 +161,8 @@ public async Task GetAsync_ServerNeedsAuthAndSetCredential_StatusCodeOK(Configur
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
public async Task GetAsync_ServerNeedsAuthAndNoCredential_StatusCodeUnauthorized(Configuration.Http.RemoteServer remoteServer)
{
using (HttpClient client = CreateHttpClientForRemoteServer(remoteServer))
......@@ -177,10 +175,10 @@ public async Task GetAsync_ServerNeedsAuthAndNoCredential_StatusCodeUnauthorized
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory]
[MemberData(nameof(RemoteServersAndHeaderEchoUrisMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53872", TestPlatforms.Browser)]
public async Task GetAsync_RequestHeadersAddCustomHeaders_HeaderAndEmptyValueSent(Configuration.Http.RemoteServer remoteServer, Uri uri)
{
if (IsWinHttpHandler && !PlatformDetection.IsWindows10Version1709OrGreater)
......@@ -204,9 +202,8 @@ public async Task GetAsync_RequestHeadersAddCustomHeaders_HeaderAndEmptyValueSen
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersHeaderValuesAndUris))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
public async Task GetAsync_RequestHeadersAddCustomHeaders_HeaderAndValueSent(Configuration.Http.RemoteServer remoteServer, string name, string value, Uri uri)
{
using (HttpClient client = CreateHttpClientForRemoteServer(remoteServer))
......@@ -223,9 +220,8 @@ public async Task GetAsync_RequestHeadersAddCustomHeaders_HeaderAndValueSent(Con
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersAndHeaderEchoUrisMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
public async Task GetAsync_LargeRequestHeader_HeadersAndValuesSent(Configuration.Http.RemoteServer remoteServer, Uri uri)
{
// Unfortunately, our remote servers seem to have pretty strict limits (around 16K?)
......@@ -291,9 +287,9 @@ public static IEnumerable<(Configuration.Http.RemoteServer remoteServer, Uri uri
public static IEnumerable<object[]> RemoteServersAndHeaderEchoUrisMemberData() => RemoteServersAndHeaderEchoUris().Select(x => new object[] { x.remoteServer, x.uri });
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task GetAsync_ResponseHeadersRead_ReadFromEachIterativelyDoesntDeadlock(Configuration.Http.RemoteServer remoteServer)
{
using (HttpClient client = CreateHttpClientForRemoteServer(remoteServer))
......@@ -317,9 +313,9 @@ public async Task GetAsync_ResponseHeadersRead_ReadFromEachIterativelyDoesntDead
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task SendAsync_HttpRequestMsgResponseHeadersRead_StatusCodeOK(Configuration.Http.RemoteServer remoteServer)
{
// Sync API supported only up to HTTP/1.1
......@@ -344,7 +340,7 @@ public async Task SendAsync_HttpRequestMsgResponseHeadersRead_StatusCodeOK(Confi
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task PostAsync_CallMethodTwice_StringContent(Configuration.Http.RemoteServer remoteServer)
......@@ -370,7 +366,7 @@ public async Task PostAsync_CallMethodTwice_StringContent(Configuration.Http.Rem
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task PostAsync_CallMethod_UnicodeStringContent(Configuration.Http.RemoteServer remoteServer)
......@@ -388,7 +384,7 @@ public async Task PostAsync_CallMethod_UnicodeStringContent(Configuration.Http.R
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(VerifyUploadServersStreamsAndExpectedData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task PostAsync_CallMethod_StreamContent(Configuration.Http.RemoteServer remoteServer, HttpContent content, byte[] expectedData)
......@@ -528,9 +524,9 @@ public static IEnumerable<object[]> VerifyUploadServersStreamsAndExpectedData
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task PostAsync_CallMethod_NullContent(Configuration.Http.RemoteServer remoteServer)
{
using (HttpClient client = CreateHttpClientForRemoteServer(remoteServer))
......@@ -550,9 +546,9 @@ public async Task PostAsync_CallMethod_NullContent(Configuration.Http.RemoteServ
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task PostAsync_CallMethod_EmptyContent(Configuration.Http.RemoteServer remoteServer)
{
using (HttpClient client = CreateHttpClientForRemoteServer(remoteServer))
......@@ -581,10 +577,10 @@ public static IEnumerable<object[]> ExpectContinueVersion()
select new object[] {expect, version};
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory]
[MemberData(nameof(ExpectContinueVersion))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53876", TestPlatforms.Browser)]
public async Task PostAsync_ExpectContinue_Success(bool? expectContinue, Version version)
{
// Sync API supported only up to HTTP/1.1
......@@ -622,9 +618,8 @@ public async Task PostAsync_ExpectContinue_Success(bool? expectContinue, Version
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
public async Task PostAsync_Redirect_ResultingGetFormattedCorrectly(Configuration.Http.RemoteServer remoteServer)
{
const string ContentString = "This is the content string.";
......@@ -644,7 +639,7 @@ public async Task PostAsync_Redirect_ResultingGetFormattedCorrectly(Configuratio
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task PostAsync_RedirectWith307_LargePayload(Configuration.Http.RemoteServer remoteServer)
......@@ -660,7 +655,7 @@ public async Task PostAsync_RedirectWith307_LargePayload(Configuration.Http.Remo
await PostAsync_Redirect_LargePayload_Helper(remoteServer, 307, true);
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task PostAsync_RedirectWith302_LargePayload(Configuration.Http.RemoteServer remoteServer)
......@@ -716,9 +711,9 @@ private async Task PostAsync_Redirect_LargePayload_Helper(Configuration.Http.Rem
}
#if !NETFRAMEWORK
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task PostAsync_ReuseRequestContent_Success(Configuration.Http.RemoteServer remoteServer)
{
const string ContentString = "This is the content string.";
......@@ -737,14 +732,17 @@ public async Task PostAsync_ReuseRequestContent_Success(Configuration.Http.Remot
}
#endif
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(HttpMethods))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53592", TestPlatforms.Browser)]
public async Task SendAsync_SendRequestUsingMethodToEchoServerWithNoContent_MethodCorrectlySent(
string method,
Uri serverUri)
{
if (method == "TRACE" && PlatformDetection.IsBrowser)
{
// [ActiveIssue("https://github.com/dotnet/runtime/issues/53592", TestPlatforms.Browser)]
return;
}
using (HttpClient client = CreateHttpClient())
{
var request = new HttpRequestMessage(
......@@ -759,9 +757,10 @@ public async Task PostAsync_ReuseRequestContent_Success(Configuration.Http.Remot
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(HttpMethodsThatAllowContent))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53591", TestPlatforms.Browser)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task SendAsync_SendRequestUsingMethodToEchoServerWithContent_Success(
string method,
Uri serverUri)
......@@ -789,14 +788,23 @@ public async Task PostAsync_ReuseRequestContent_Success(Configuration.Http.Remot
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(HttpMethodsThatDontAllowContent))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53591", TestPlatforms.Browser)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53592", TestPlatforms.Browser)]
public async Task SendAsync_SendRequestUsingNoBodyMethodToEchoServerWithContent_NoBodySent(
string method,
Uri serverUri)
{
if (method == "TRACE" && PlatformDetection.IsBrowser)
{
// [ActiveIssue("https://github.com/dotnet/runtime/issues/53592", TestPlatforms.Browser)]
return;
}
if (method == "HEAD" && PlatformDetection.IsBrowser)
{
// [ActiveIssue("https://github.com/dotnet/runtime/issues/53591", TestPlatforms.Browser)]
return;
}
using (HttpClient client = CreateHttpClient())
{
var request = new HttpRequestMessage(
......@@ -836,9 +844,8 @@ public static IEnumerable<object[]> SendAsync_SendSameRequestMultipleTimesDirect
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(SendAsync_SendSameRequestMultipleTimesDirectlyOnHandler_Success_MemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
public async Task SendAsync_SendSameRequestMultipleTimesDirectlyOnHandler_Success(Configuration.Http.RemoteServer remoteServer, string stringContent, int startingPosition)
{
using (var handler = new HttpMessageInvoker(CreateHttpClientHandler()))
......@@ -869,10 +876,9 @@ public async Task SendAsync_SendSameRequestMultipleTimesDirectlyOnHandler_Succes
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory]
[MemberData(nameof(Http2Servers))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
public async Task SendAsync_RequestVersion20_ResponseVersion20IfHttp2Supported(Uri server)
{
// Sync API supported only up to HTTP/1.1
......
......@@ -28,9 +28,9 @@ public abstract class PostScenarioTest : HttpClientHandlerTestBase
public PostScenarioTest(ITestOutputHelper output) : base(output) { }
#if !NETFRAMEWORK
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task PostRewindableStreamContentMultipleTimes_StreamContentFullySent(Configuration.Http.RemoteServer remoteServer)
{
const string requestBody = "ABC";
......@@ -53,17 +53,17 @@ public async Task PostRewindableStreamContentMultipleTimes_StreamContentFullySen
}
#endif
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[MemberData(nameof(RemoteServersMemberData))]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsBrowserDomSupportedOrNotBrowser))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task PostNoContentUsingContentLengthSemantics_Success(Configuration.Http.RemoteServer remoteServer)
{
await PostHelper(remoteServer, string.Empty, null,
useContentLengthUpload: true, useChunkedEncodingUpload: false);
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task PostEmptyContentUsingContentLengthSemantics_Success(Configuration.Http.RemoteServer remoteServer)
......@@ -72,7 +72,7 @@ public async Task PostEmptyContentUsingContentLengthSemantics_Success(Configurat
useContentLengthUpload: true, useChunkedEncodingUpload: false);
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task PostEmptyContentUsingChunkedEncoding_Success(Configuration.Http.RemoteServer remoteServer)
......@@ -81,7 +81,7 @@ public async Task PostEmptyContentUsingChunkedEncoding_Success(Configuration.Htt
useContentLengthUpload: false, useChunkedEncodingUpload: true);
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task PostEmptyContentUsingConflictingSemantics_Success(Configuration.Http.RemoteServer remoteServer)
......@@ -90,7 +90,7 @@ public async Task PostEmptyContentUsingConflictingSemantics_Success(Configuratio
useContentLengthUpload: true, useChunkedEncodingUpload: true);
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task PostUsingContentLengthSemantics_Success(Configuration.Http.RemoteServer remoteServer)
......@@ -99,7 +99,7 @@ public async Task PostUsingContentLengthSemantics_Success(Configuration.Http.Rem
useContentLengthUpload: true, useChunkedEncodingUpload: false);
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task PostUsingChunkedEncoding_Success(Configuration.Http.RemoteServer remoteServer)
......@@ -108,7 +108,7 @@ public async Task PostUsingChunkedEncoding_Success(Configuration.Http.RemoteServ
useContentLengthUpload: false, useChunkedEncodingUpload: true);
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task PostSyncBlockingContentUsingChunkedEncoding_Success(Configuration.Http.RemoteServer remoteServer)
......@@ -117,7 +117,7 @@ public async Task PostSyncBlockingContentUsingChunkedEncoding_Success(Configurat
useContentLengthUpload: false, useChunkedEncodingUpload: true);
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task PostRepeatedFlushContentUsingChunkedEncoding_Success(Configuration.Http.RemoteServer remoteServer)
......@@ -126,7 +126,7 @@ public async Task PostRepeatedFlushContentUsingChunkedEncoding_Success(Configura
useContentLengthUpload: false, useChunkedEncodingUpload: true);
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task PostUsingUsingConflictingSemantics_UsesChunkedSemantics(Configuration.Http.RemoteServer remoteServer)
......@@ -135,7 +135,7 @@ public async Task PostUsingUsingConflictingSemantics_UsesChunkedSemantics(Config
useContentLengthUpload: true, useChunkedEncodingUpload: true);
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task PostUsingNoSpecifiedSemantics_UsesChunkedSemantics(Configuration.Http.RemoteServer remoteServer)
......@@ -154,7 +154,7 @@ public static IEnumerable<object[]> RemoteServersAndLargeContentSizes()
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory]
[MemberData(nameof(RemoteServersAndLargeContentSizes))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
......@@ -223,10 +223,10 @@ public async Task PostNonRewindableContentUsingAuth_PreAuthenticate_Success(Conf
await PostUsingAuthHelper(remoteServer, ExpectedContent, content, credential, preAuthenticate: true);
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[MemberData(nameof(RemoteServersMemberData))]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsBrowserDomSupportedOrNotBrowser))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task PostAsync_EmptyContent_ContentTypeHeaderNotSent(Configuration.Http.RemoteServer remoteServer)
{
using (HttpClient client = CreateHttpClientForRemoteServer(remoteServer))
......
......@@ -30,9 +30,9 @@ public static IEnumerable<object[]> RemoteServersAndReadModes()
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersAndReadModes))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
public async Task GetStreamAsync_ReadToEnd_Success(Configuration.Http.RemoteServer remoteServer, int readMode)
{
using (HttpClient client = CreateHttpClientForRemoteServer(remoteServer))
......@@ -126,9 +126,9 @@ public async Task GetStreamAsync_ReadToEnd_Success(Configuration.Http.RemoteServ
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task GetAsync_UseResponseHeadersReadAndCallLoadIntoBuffer_Success(Configuration.Http.RemoteServer remoteServer)
{
using (HttpClient client = CreateHttpClientForRemoteServer(remoteServer))
......@@ -146,9 +146,9 @@ public async Task GetAsync_UseResponseHeadersReadAndCallLoadIntoBuffer_Success(C
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task GetAsync_UseResponseHeadersReadAndCopyToMemoryStream_Success(Configuration.Http.RemoteServer remoteServer)
{
using (HttpClient client = CreateHttpClientForRemoteServer(remoteServer))
......@@ -171,9 +171,8 @@ public async Task GetAsync_UseResponseHeadersReadAndCopyToMemoryStream_Success(C
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
public async Task GetStreamAsync_ReadZeroBytes_Success(Configuration.Http.RemoteServer remoteServer)
{
using (HttpClient client = CreateHttpClientForRemoteServer(remoteServer))
......@@ -187,9 +186,8 @@ public async Task GetStreamAsync_ReadZeroBytes_Success(Configuration.Http.Remote
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
public async Task ReadAsStreamAsync_Cancel_TaskIsCanceled(Configuration.Http.RemoteServer remoteServer)
{
var cts = new CancellationTokenSource();
......
<Project>
<PropertyGroup Condition="'$(TargetOS)' == 'Browser'">
<Scenario>WasmTestOnBrowser</Scenario>
<TestArchiveTestsRoot>$(TestArchiveRoot)browseronly/</TestArchiveTestsRoot>
<TestArchiveTestsDir>$(TestArchiveTestsRoot)$(OSPlatformConfig)/</TestArchiveTestsDir>
<!-- handle different path to middleware in Helix -->
<_TestEchoMiddleware Condition="'$(ContinuousIntegrationBuild)' == 'true' and '$(OS)' == 'Windows_NT'">%HELIX_CORRELATION_PAYLOAD%/xharness/TestEchoMiddleware</_TestEchoMiddleware>
<_TestEchoMiddleware Condition="'$(ContinuousIntegrationBuild)' == 'true' and '$(OS)' != 'Windows_NT'">$HELIX_CORRELATION_PAYLOAD/xharness/TestEchoMiddleware</_TestEchoMiddleware>
<_TestEchoMiddleware Condition="'$(ContinuousIntegrationBuild)' != 'true'">$(ArtifactsDir)bin/NetCoreServer/$(NetCoreAppCurrent)-$(Configuration)</_TestEchoMiddleware>
<WasmXHarnessArgs>$(WasmXHarnessArgs) --web-server-use-cors --web-server-use-https</WasmXHarnessArgs>
<WasmXHarnessArgs>$(WasmXHarnessArgs) --set-web-server-http-env=DOTNET_TEST_WEBSOCKETHOST,DOTNET_TEST_HTTPHOST</WasmXHarnessArgs>
<WasmXHarnessArgs>$(WasmXHarnessArgs) --set-web-server-https-env=DOTNET_TEST_SECUREWEBSOCKETHOST,DOTNET_TEST_SECUREHTTPHOST,DOTNET_TEST_HTTP2HOST</WasmXHarnessArgs>
<WasmXHarnessArgs>$(WasmXHarnessArgs) --web-server-middleware=$(_TestEchoMiddleware)/NetCoreServer.dll,GenericHandler</WasmXHarnessArgs>
</PropertyGroup>
</Project>
......@@ -13,7 +13,7 @@ public class GenericHandler
// Must have constructor with this signature, otherwise exception at run time.
public GenericHandler(RequestDelegate next)
{
// This is an HTTP Handler, so no need to store next.
// This catch all HTTP Handler, so no need to store next.
}
public async Task Invoke(HttpContext context)
......
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>$(AspNetCoreAppCurrent)</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<OutputType>Exe</OutputType>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
......
......@@ -11,11 +11,20 @@ public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddCors(o => o.AddPolicy("AnyCors", builder =>
{
builder.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
.WithExposedHeaders("*")
;
}));
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseCors("AnyCors");
app.UseWebSockets();
app.UseGenericHandler();
}
......
......@@ -9,6 +9,7 @@
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using Microsoft.Win32;
using Xunit;
namespace System
{
......@@ -59,6 +60,8 @@ public static partial class PlatformDetection
public static bool IsBrowserDomSupported => GetIsBrowserDomSupported();
public static bool IsBrowserDomSupportedOrNotBrowser => IsNotBrowser || GetIsBrowserDomSupported();
public static bool IsNotBrowserDomSupported => !IsBrowserDomSupported;
public static bool LocalEchoServerIsNotAvailable => !LocalEchoServerIsAvailable;
public static bool LocalEchoServerIsAvailable => IsBrowser;
public static bool IsUsingLimitedCultures => !IsNotMobile;
public static bool IsNotUsingLimitedCultures => IsNotMobile;
......
......@@ -343,11 +343,11 @@ public async Task SendAsync_RequestHeaderInResponse_Success(string name, string
});
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Theory]
[InlineData(false)]
[InlineData(true)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
public async Task SendAsync_GetWithValidHostHeader_Success(bool withPort)
{
if (UseVersion == HttpVersion.Version30)
......@@ -355,9 +355,14 @@ public async Task SendAsync_GetWithValidHostHeader_Success(bool withPort)
// External servers do not support HTTP3 currently.
return;
}
if (PlatformDetection.LocalEchoServerIsAvailable && !withPort)
{
// we always have custom port with the local echo server, so we couldn't test without it
return;
}
var m = new HttpRequestMessage(HttpMethod.Get, Configuration.Http.SecureRemoteEchoServer) { Version = UseVersion };
m.Headers.Host = withPort ? Configuration.Http.SecureHost + ":443" : Configuration.Http.SecureHost;
m.Headers.Host = withPort ? Configuration.Http.SecureHost + ":" + Configuration.Http.SecurePort : Configuration.Http.SecureHost;
using (HttpClient client = CreateHttpClient())
using (HttpResponseMessage response = await client.SendAsync(TestAsync, m))
......@@ -372,8 +377,9 @@ public async Task SendAsync_GetWithValidHostHeader_Success(bool withPort)
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53874", TestPlatforms.Browser)]
public async Task SendAsync_GetWithInvalidHostHeader_ThrowsException()
{
if (LoopbackServerFactory.Version >= HttpVersion.Version20)
......
......@@ -1213,10 +1213,10 @@ public async Task SendAsync_CorrectVersionSelected_LoopbackServer(Version reques
});
}
[Theory]
[OuterLoop("Uses external servers")]
[MemberData(nameof(VersionSelectionMemberData))]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsBrowserDomSupportedOrNotBrowser))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/53018", TestPlatforms.Browser)]
[SkipOnPlatform(TestPlatforms.Browser, "Version is ignored on Browser")]
public async Task SendAsync_CorrectVersionSelected_ExternalServer(Version requestVersion, HttpVersionPolicy versionPolicy, Version serverVersion, bool useSsl, object expectedResult)
{
RemoteServer remoteServer = null;
......
......@@ -8,11 +8,19 @@
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-OSX</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetOS)' == 'Browser'">
<Scenario>WasmTestOnBrowser</Scenario>
<TestArchiveTestsRoot>$(TestArchiveRoot)browseronly/</TestArchiveTestsRoot>
<TestArchiveTestsDir>$(TestArchiveTestsRoot)$(OSPlatformConfig)/</TestArchiveTestsDir>
</PropertyGroup>
<Import Condition="'$(TargetOS)' == 'Browser'" Project="$(CommonTestPath)System/Net/Prerequisites/LocalEchoServer.props" />
<ItemGroup Condition="'$(TargetOS)' == 'Browser'">
<ProjectReference Include="$(CommonTestPath)System/Net/Prerequisites/NetCoreServer/NetCoreServer.csproj" ReferenceOutputAssembly="false"/>
</ItemGroup>
<ItemGroup>
<Compile Include="$(CommonPath)Interop\Unix\Interop.Libraries.cs" Condition="'$(TargetsUnix)' == 'true' or '$(TargetsBrowser)' == 'true'"
Link="Common\Interop\Unix\Interop.Libraries.cs" />
......
......@@ -13,7 +13,7 @@ public class CancelTest : ClientWebSocketTestBase
{
public CancelTest(ITestOutputHelper output) : base(output) { }
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task ConnectAsync_Cancel_ThrowsCancellationException(Uri server)
{
......@@ -29,7 +29,7 @@ public async Task ConnectAsync_Cancel_ThrowsCancellationException(Uri server)
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task SendAsync_Cancel_Success(Uri server)
{
......@@ -44,7 +44,7 @@ public async Task SendAsync_Cancel_Success(Uri server)
}, server);
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/19217")]
public async Task ReceiveAsync_Cancel_Success(Uri server)
......@@ -67,7 +67,7 @@ public async Task ReceiveAsync_Cancel_Success(Uri server)
}, server);
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task CloseAsync_Cancel_Success(Uri server)
{
......@@ -89,7 +89,7 @@ public async Task CloseAsync_Cancel_Success(Uri server)
}, server);
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task CloseOutputAsync_Cancel_Success(Uri server)
{
......@@ -112,7 +112,7 @@ public async Task CloseOutputAsync_Cancel_Success(Uri server)
}, server);
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task ReceiveAsync_CancelThenReceive_ThrowsOperationCanceledException(Uri server)
{
......@@ -128,7 +128,7 @@ public async Task ReceiveAsync_CancelThenReceive_ThrowsOperationCanceledExceptio
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task ReceiveAsync_ReceiveThenCancel_ThrowsOperationCanceledException(Uri server)
{
......@@ -144,7 +144,7 @@ public async Task ReceiveAsync_ReceiveThenCancel_ThrowsOperationCanceledExceptio
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task ReceiveAsync_AfterCancellationDoReceiveAsync_ThrowsWebSocketException(Uri server)
{
......
......@@ -18,7 +18,7 @@ public class CloseTest : ClientWebSocketTestBase
public CloseTest(ITestOutputHelper output) : base(output) { }
[ActiveIssue("https://github.com/dotnet/runtime/issues/28957")]
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServersAndBoolean))]
public async Task CloseAsync_ServerInitiatedClose_Success(Uri server, bool useCloseOutputAsync)
{
......@@ -65,7 +65,7 @@ public async Task CloseAsync_ServerInitiatedClose_Success(Uri server, bool useCl
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task CloseAsync_ClientInitiatedClose_Success(Uri server)
{
......@@ -87,7 +87,7 @@ public async Task CloseAsync_ClientInitiatedClose_Success(Uri server)
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task CloseAsync_CloseDescriptionIsMaxLength_Success(Uri server)
{
......@@ -101,7 +101,7 @@ public async Task CloseAsync_CloseDescriptionIsMaxLength_Success(Uri server)
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task CloseAsync_CloseDescriptionIsMaxLengthPlusOne_ThrowsArgumentException(Uri server)
{
......@@ -126,7 +126,7 @@ public async Task CloseAsync_CloseDescriptionIsMaxLengthPlusOne_ThrowsArgumentEx
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task CloseAsync_CloseDescriptionHasUnicode_Success(Uri server)
{
......@@ -145,7 +145,7 @@ public async Task CloseAsync_CloseDescriptionHasUnicode_Success(Uri server)
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task CloseAsync_CloseDescriptionIsNull_Success(Uri server)
{
......@@ -161,7 +161,7 @@ public async Task CloseAsync_CloseDescriptionIsNull_Success(Uri server)
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task CloseOutputAsync_ExpectedStates(Uri server)
{
......@@ -180,7 +180,7 @@ public async Task CloseOutputAsync_ExpectedStates(Uri server)
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task CloseAsync_CloseOutputAsync_Throws(Uri server)
{
......@@ -205,7 +205,7 @@ public async Task CloseAsync_CloseOutputAsync_Throws(Uri server)
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task CloseOutputAsync_ClientInitiated_CanReceive_CanClose(Uri server)
{
......@@ -245,7 +245,7 @@ public async Task CloseOutputAsync_ClientInitiated_CanReceive_CanClose(Uri serve
}
[ActiveIssue("https://github.com/dotnet/runtime/issues/28957")]
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task CloseOutputAsync_ServerInitiated_CanSend(Uri server)
{
......@@ -292,7 +292,7 @@ public async Task CloseOutputAsync_ServerInitiated_CanSend(Uri server)
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task CloseOutputAsync_CloseDescriptionIsNull_Success(Uri server)
{
......@@ -308,7 +308,7 @@ public async Task CloseOutputAsync_CloseDescriptionIsNull_Success(Uri server)
}
[ActiveIssue("https://github.com/dotnet/runtime/issues/22000", TargetFrameworkMonikers.Netcoreapp)]
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task CloseOutputAsync_DuringConcurrentReceiveAsync_ExpectedStates(Uri server)
{
......@@ -345,7 +345,7 @@ public async Task CloseOutputAsync_DuringConcurrentReceiveAsync_ExpectedStates(U
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task CloseAsync_DuringConcurrentReceiveAsync_ExpectedStates(Uri server)
{
......
......@@ -17,7 +17,7 @@ public class ConnectTest : ClientWebSocketTestBase
public ConnectTest(ITestOutputHelper output) : base(output) { }
[ActiveIssue("https://github.com/dotnet/runtime/issues/1895")]
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(UnavailableWebSocketServers))]
public async Task ConnectAsync_NotWebSocketServer_ThrowsWebSocketExceptionWithMessage(Uri server, string exceptionMessage, WebSocketError errorCode)
{
......@@ -42,21 +42,21 @@ public async Task ConnectAsync_NotWebSocketServer_ThrowsWebSocketExceptionWithMe
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task EchoBinaryMessage_Success(Uri server)
{
await WebSocketHelper.TestEcho(server, WebSocketMessageType.Binary, TimeOutMilliseconds, _output);
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task EchoTextMessage_Success(Uri server)
{
await WebSocketHelper.TestEcho(server, WebSocketMessageType.Text, TimeOutMilliseconds, _output);
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoHeadersServers))]
[SkipOnPlatform(TestPlatforms.Browser, "CustomHeaders not supported on browser")]
public async Task ConnectAsync_AddCustomHeaders_Success(Uri server)
......@@ -118,7 +118,7 @@ public async Task ConnectAsync_AddHostHeader_Success()
}), new LoopbackServer.Options { WebSocketEndpoint = true });
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoHeadersServers))]
[SkipOnPlatform(TestPlatforms.Browser, "Cookies not supported on browser")]
public async Task ConnectAsync_CookieHeaders_Success(Uri server)
......@@ -168,7 +168,7 @@ public async Task ConnectAsync_CookieHeaders_Success(Uri server)
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/45583", TestPlatforms.Browser)]
public async Task ConnectAsync_PassNoSubProtocol_ServerRequires_ThrowsWebSocketException(Uri server)
......@@ -194,7 +194,7 @@ public async Task ConnectAsync_PassNoSubProtocol_ServerRequires_ThrowsWebSocketE
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task ConnectAsync_PassMultipleSubProtocols_ServerRequires_ConnectionUsesAgreedSubProtocol(Uri server)
{
......@@ -235,7 +235,7 @@ public async Task ConnectAsync_NonStandardRequestHeaders_HeadersAddedWithoutVali
}), new LoopbackServer.Options { WebSocketEndpoint = true });
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/42852", TestPlatforms.Browser)]
public async Task ConnectAndCloseAsync_UseProxyServer_ExpectedClosedState(Uri server)
......
......@@ -49,7 +49,7 @@ public abstract class SendReceiveTest : ClientWebSocketTestBase
public SendReceiveTest(ITestOutputHelper output) : base(output) { }
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task SendReceive_PartialMessageDueToSmallReceiveBuffer_Success(Uri server)
{
......@@ -86,7 +86,7 @@ public async Task SendReceive_PartialMessageDueToSmallReceiveBuffer_Success(Uri
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
[SkipOnPlatform(TestPlatforms.Browser, "JS Websocket does not support see issue https://github.com/dotnet/runtime/issues/46983")]
public async Task SendReceive_PartialMessageBeforeCompleteMessageArrives_Success(Uri server)
......@@ -128,7 +128,7 @@ public async Task SendReceive_PartialMessageBeforeCompleteMessageArrives_Success
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task SendAsync_SendCloseMessageType_ThrowsArgumentExceptionWithMessage(Uri server)
{
......@@ -156,7 +156,7 @@ public async Task SendAsync_SendCloseMessageType_ThrowsArgumentExceptionWithMess
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task SendAsync_MultipleOutstandingSendOperations_Throws(Uri server)
{
......@@ -215,7 +215,7 @@ public async Task SendAsync_MultipleOutstandingSendOperations_Throws(Uri server)
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task ReceiveAsync_MultipleOutstandingReceiveOperations_Throws(Uri server)
{
......@@ -279,7 +279,7 @@ public async Task ReceiveAsync_MultipleOutstandingReceiveOperations_Throws(Uri s
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task SendAsync_SendZeroLengthPayloadAsEndOfMessage_Success(Uri server)
{
......@@ -318,7 +318,7 @@ public async Task SendAsync_SendZeroLengthPayloadAsEndOfMessage_Success(Uri serv
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task SendReceive_VaryingLengthBuffers_Success(Uri server)
{
......@@ -358,7 +358,7 @@ public async Task SendReceive_VaryingLengthBuffers_Success(Uri server)
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task SendReceive_Concurrent_Success(Uri server)
{
......@@ -387,7 +387,7 @@ public async Task SendReceive_Concurrent_Success(Uri server)
}
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalFact(nameof(WebSocketsSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/42852", TestPlatforms.Browser)]
public async Task SendReceive_ConnectionClosedPrematurely_ReceiveAsyncFailsAndWebSocketStateUpdated()
......@@ -457,7 +457,7 @@ public async Task SendReceive_ConnectionClosedPrematurely_ReceiveAsyncFailsAndWe
}, options);
}
[OuterLoop("Uses external servers")]
[OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task ZeroByteReceive_CompletesWhenDataAvailable(Uri server)
{
......
......@@ -4,11 +4,19 @@
<TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppCurrent)-Browser</TargetFrameworks>
<DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetOS)' == 'Browser'">
<Scenario>WasmTestOnBrowser</Scenario>
<TestArchiveTestsRoot>$(TestArchiveRoot)browseronly/</TestArchiveTestsRoot>
<TestArchiveTestsDir>$(TestArchiveTestsRoot)$(OSPlatformConfig)/</TestArchiveTestsDir>
</PropertyGroup>
<Import Condition="'$(TargetOS)' == 'Browser'" Project="$(CommonTestPath)System/Net/Prerequisites/LocalEchoServer.props" />
<ItemGroup Condition="'$(TargetOS)' == 'Browser'">
<ProjectReference Include="$(CommonTestPath)System/Net/Prerequisites/NetCoreServer/NetCoreServer.csproj" ReferenceOutputAssembly="false"/>
</ItemGroup>
<!-- Do not reference these assemblies from the TargetingPack since we are building part of the source code for tests. -->
<ItemGroup>
<DefaultReferenceExclusion Include="System.Configuration" />
......
......@@ -297,6 +297,7 @@
<SeleniumUrl>https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/$(ChromiumRevision)/chromedriver_linux64.zip</SeleniumUrl>
<EmSdkDir>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'mono', 'wasm', 'emsdk'))</EmSdkDir>
<WasmBuildTargetsDir>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'mono', 'wasm', 'build'))</WasmBuildTargetsDir>
<TestEchoMiddleware>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'bin', 'NetCoreServer', '$(NetCoreAppCurrent)-$(Configuration)'))</TestEchoMiddleware>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeFlavor)' == 'Mono'">
......@@ -329,6 +330,10 @@
<HelixCorrelationPayload Include="$(MonoAotCrossDir)" Destination="build/cross" />
</ItemGroup>
<ItemGroup Condition="'$(TargetOS)' == 'Browser'">
<HelixCorrelationPayload Include="$(TestEchoMiddleware)" Destination="xharness/TestEchoMiddleware" />
</ItemGroup>
<ItemGroup Condition="'$(TargetOS)' != 'Android' and '$(TargetOS)' != 'iOS' and '$(TargetOS)' != 'iOSSimulator' and '$(TargetOS)' != 'tvOS' and '$(TargetOS)' != 'tvOSSimulator' and '$(TargetOS)' != 'MacCatalyst'">
<HelixCorrelationPayload Include="$(HelixCorrelationPayload)"
Condition="'$(IncludeHelixCorrelationPayload)' == 'true' and '$(TargetOS)' != 'Browser'" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册