diff options
author | Caesar Chen <caesar1995@users.noreply.github.com> | 2018-01-26 02:57:38 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-26 02:57:38 +0300 |
commit | e274885db32ec40b327ed4dcb3439aca41d29844 (patch) | |
tree | 4efe21205777de262ebbae79ab698c19159843bd /src | |
parent | a3986843153e27e92c89907f58046bb37da0f9eb (diff) |
Enable some HttpProtocolTests test cases and skip them on .NET Core Windows run (#26573)
* split test cases
* disable against CurlHandler as well
* address PR feedback
Diffstat (limited to 'src')
-rw-r--r-- | src/System.Net.Http/tests/FunctionalTests/HttpProtocolTests.cs | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/src/System.Net.Http/tests/FunctionalTests/HttpProtocolTests.cs b/src/System.Net.Http/tests/FunctionalTests/HttpProtocolTests.cs index 62b5ad316a..6b20458d3e 100644 --- a/src/System.Net.Http/tests/FunctionalTests/HttpProtocolTests.cs +++ b/src/System.Net.Http/tests/FunctionalTests/HttpProtocolTests.cs @@ -15,9 +15,6 @@ namespace System.Net.Http.Functional.Tests protected virtual Stream GetStream(Stream s) => s; [Theory] - // The following disabled by ActiveIssue: 26540 - // [InlineData("HTTP/1.1 200 ", 200, " ")] - // [InlineData("HTTP/1.1 200 Something", 200, " Something")] [InlineData("HTTP/1.1 200 OK", 200, "OK")] [InlineData("HTTP/1.1 200 Sure why not?", 200, "Sure why not?")] [InlineData("HTTP/1.1 200 OK\x0080", 200, "OK?")] @@ -36,6 +33,24 @@ namespace System.Net.Http.Functional.Tests } [Theory] + [InlineData("HTTP/1.1 200 ", 200, " ", "")] + [InlineData("HTTP/1.1 200 Something", 200, " Something", "Something")] + public async Task GetAsync_ExpectedStatusCodeAndReason_PlatformBehaviorTest(string statusLine, + int expectedStatusCode, string reasonWithSpace, string reasonNoSpace) + { + if (UseManagedHandler || PlatformDetection.IsFullFramework) + { + // ManagedHandler and .NET Framework will keep the space characters. + await GetAsyncSuccessHelper(statusLine, expectedStatusCode, reasonWithSpace); + } + else + { + // WinRT, WinHttpHandler, and CurlHandler will trim space characters. + await GetAsyncSuccessHelper(statusLine, expectedStatusCode, reasonNoSpace); + } + } + + [Theory] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "The following pass on .NET Core but fail on .NET Framework.")] [InlineData("HTTP/1.1 200", 200, "")] // This test data requires the fix in .NET Framework 4.7.3 [InlineData("HTTP/1.1 200 O\tK", 200, "O\tK")] @@ -74,10 +89,6 @@ namespace System.Net.Http.Functional.Tests [InlineData("HTTP/1.1 2345")] [InlineData("HTTP/A.1 200 OK")] [InlineData("HTTP/X.Y.Z 200 OK")] - // The following disabled by ActiveIssue: 26542 - //[InlineData("HTTP/1.1\t200 OK")] - //[InlineData("HTTP/1.1 200\tOK")] - //[InlineData("HTTP/1.1 200\t")] // TODO #24713: The following pass on Windows on .NET Core but fail on .NET Framework. //[InlineData("HTTP/0.1 200 OK")] //[InlineData("HTTP/3.5 200 OK")] @@ -107,6 +118,25 @@ namespace System.Net.Http.Functional.Tests //[InlineData("NOTHTTP/1.1 200 OK")] public async Task GetAsync_InvalidStatusLine_ThrowsException(string responseString) { + await GetAsyncThrowsExceptionHelper(responseString); + } + + [Theory] + [InlineData("HTTP/1.1\t200 OK")] + [InlineData("HTTP/1.1 200\tOK")] + [InlineData("HTTP/1.1 200\t")] + public async Task GetAsync_InvalidStatusLine_ThrowsExceptionOnManagedHandler(string responseString) + { + if (UseManagedHandler || PlatformDetection.IsFullFramework) + { + // ManagedHandler and .NET Framework will throw HttpRequestException. + await GetAsyncThrowsExceptionHelper(responseString); + } + // WinRT, WinHttpHandler, and CurlHandler will succeed. + } + + private async Task GetAsyncThrowsExceptionHelper(string responseString) + { await LoopbackServer.CreateServerAsync(async (server, url) => { using (HttpClient client = CreateHttpClient()) |