Imported Upstream version 6.10.0.81

Former-commit-id: 743161e81928aebddbeb90a6adc04ff076fe498a
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-02-21 09:01:57 +00:00
parent c1b35613f4
commit d8e876beb9
54 changed files with 421 additions and 486 deletions

View File

@@ -12,7 +12,6 @@ System.Net.Http/MultipartContentTest.cs
System.Net.Http/MultipartFormDataContentTest.cs
System.Net.Http/StreamContentTest.cs
System.Net.Http/StringContentTest.cs
System.Net.Http/HttpClientHandlerTests.Android.cs
System.Net.Http.Headers/AuthenticationHeaderValueTest.cs
System.Net.Http.Headers/CacheControlHeaderValueTest.cs
System.Net.Http.Headers/ContentDispositionHeaderValueTest.cs

View File

@@ -1,77 +0,0 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Text;
using System.Net.Http;
using System.Reflection;
using NUnit.Framework;
namespace System.Net.Http.Tests
{
[TestFixture]
public class HttpClientHandlerTestsAndroid
{
static Type GetInnerHandlerType (HttpClient httpClient)
{
BindingFlags bflasgs = BindingFlags.Instance | BindingFlags.NonPublic;
FieldInfo handlerField = typeof (HttpMessageInvoker).GetField("_handler", bflasgs);
Assert.IsNotNull (handlerField);
object handler = handlerField.GetValue (httpClient);
FieldInfo innerHandlerField = handler.GetType ().GetField ("_delegatingHandler", bflasgs);
Assert.IsNotNull (handlerField);
object innerHandler = innerHandlerField.GetValue (handler);
return innerHandler.GetType ();
}
[Test]
public void TestEnvVarSwitchForInnerHttpHandler ()
{
#if !MONODROID
return;
#endif
const string xaHandlerKey = "XA_HTTP_CLIENT_HANDLER_TYPE";
var prevHandler = Environment.GetEnvironmentVariable (xaHandlerKey);
// ""
Environment.SetEnvironmentVariable (xaHandlerKey, "");
var httpClient1 = new HttpClient ();
Assert.AreEqual ("SocketsHttpHandler", GetInnerHandlerType (httpClient1).Name);
var handler2 = new HttpClientHandler ();
var httpClient2 = new HttpClient (handler2);
Assert.AreEqual ("SocketsHttpHandler", GetInnerHandlerType (httpClient2).Name);
// "System.Net.Http.MonoWebRequestHandler"
Environment.SetEnvironmentVariable (xaHandlerKey, "System.Net.Http.MonoWebRequestHandler");
var httpClient3 = new HttpClient ();
Assert.AreEqual ("MonoWebRequestHandler", GetInnerHandlerType (httpClient3).Name);
var handler4 = new HttpClientHandler ();
var httpClient4 = new HttpClient (handler4);
Assert.AreEqual ("MonoWebRequestHandler", GetInnerHandlerType (httpClient4).Name);
// "System.Net.Http.MonoWebRequestHandler, System.Net.Http"
Environment.SetEnvironmentVariable (xaHandlerKey, "System.Net.Http.MonoWebRequestHandler, System.Net.Http");
var httpClient5 = new HttpClient ();
Assert.AreEqual ("MonoWebRequestHandler", GetInnerHandlerType (httpClient5).Name);
var handler6 = new HttpClientHandler ();
var httpClient6 = new HttpClient (handler6);
Assert.AreEqual ("MonoWebRequestHandler", GetInnerHandlerType (httpClient6).Name);
// "System.Net.Http.HttpClientHandler"
Environment.SetEnvironmentVariable (xaHandlerKey, "System.Net.Http.HttpClientHandler");
var httpClient7 = new HttpClient ();
Assert.AreEqual ("SocketsHttpHandler", GetInnerHandlerType (httpClient7).Name);
var handler8 = new HttpClientHandler ();
var httpClient8 = new HttpClient (handler8);
Assert.AreEqual ("SocketsHttpHandler", GetInnerHandlerType (httpClient8).Name);
Environment.SetEnvironmentVariable (xaHandlerKey, prevHandler);
}
}
}

View File

@@ -1 +1 @@
3509912d9ece3ffae8892338a8b7d191c341adc6
86a5dc7bbfde66f1134a85038dbabe8cd733439c

View File

@@ -1 +1 @@
bacfce6b6d0b818bee67aa94d64011711db4afad
2e1b48014ca314985ce155e8f876a6e901c1556e

View File

@@ -1 +1 @@
4d827fe16b2e39ca49d37b3fa31a0beb67b1d33e
3b82d95b59ebf52c6554b1bcf92a29136dd39cd1

View File

@@ -1 +1 @@
7c73b167752924894980e0e60ec17b4070f5811d
93e5919993bbcc0895bd4e59d9a0badf4127bff3

View File

@@ -1 +1 @@
8fb3cddafa32e3a592e72145b6c91b77e84caf68
1fa644386f932ba40b652ee17dbd412358be7fbf

View File

@@ -1 +1 @@
778527c6ed97b3c2795c2d498d45e71370ff6e90
22b26dde137a49e1be80d8ca4a39816c7ed2472f

View File

@@ -1 +1 @@
07f957cf41ba1d5f3fd5b74febdb5b444ecf9d4b
bdb7f1ebb9107c01e5d438bc71368a4204cab6f7

View File

@@ -1 +1 @@
31cfb941c91f3a839d4cc187031da8a0b1aa205e
43b10719f4952ab0860e15700e87725fed617349

View File

@@ -1 +1 @@
3509912d9ece3ffae8892338a8b7d191c341adc6
86a5dc7bbfde66f1134a85038dbabe8cd733439c

View File

@@ -1 +1 @@
bacfce6b6d0b818bee67aa94d64011711db4afad
2e1b48014ca314985ce155e8f876a6e901c1556e

View File

@@ -1 +1 @@
4d827fe16b2e39ca49d37b3fa31a0beb67b1d33e
3b82d95b59ebf52c6554b1bcf92a29136dd39cd1

View File

@@ -1 +1 @@
7c73b167752924894980e0e60ec17b4070f5811d
93e5919993bbcc0895bd4e59d9a0badf4127bff3

View File

@@ -1 +1 @@
8fb3cddafa32e3a592e72145b6c91b77e84caf68
1fa644386f932ba40b652ee17dbd412358be7fbf

View File

@@ -1 +1 @@
778527c6ed97b3c2795c2d498d45e71370ff6e90
22b26dde137a49e1be80d8ca4a39816c7ed2472f

View File

@@ -1 +1 @@
07f957cf41ba1d5f3fd5b74febdb5b444ecf9d4b
bdb7f1ebb9107c01e5d438bc71368a4204cab6f7

View File

@@ -1 +1 @@
31cfb941c91f3a839d4cc187031da8a0b1aa205e
43b10719f4952ab0860e15700e87725fed617349

View File

@@ -1 +1 @@
3509912d9ece3ffae8892338a8b7d191c341adc6
86a5dc7bbfde66f1134a85038dbabe8cd733439c

View File

@@ -1 +1 @@
bacfce6b6d0b818bee67aa94d64011711db4afad
2e1b48014ca314985ce155e8f876a6e901c1556e

Some files were not shown because too many files have changed in this diff Show More