Imported Upstream version 5.10.0.47

Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-01-24 17:04:36 +00:00
parent 88ff76fe28
commit e46a49ecf1
5927 changed files with 226314 additions and 129848 deletions

View File

@@ -6,6 +6,7 @@ using System;
using System.Collections.Generic;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using Xunit;
namespace System.Net.Tests
@@ -175,17 +176,29 @@ namespace System.Net.Tests
yield return new object[] { new Uri($"http://{IPAddress.None}"), false };
}
[ActiveIssue(23766, TestPlatforms.AnyUnix)]
[Theory]
[MemberData(nameof(BypassOnLocal_MemberData))]
public static void WebProxy_BypassOnLocal_MatchesExpected(Uri destination, bool isLocal)
{
Uri proxyUri = new Uri("http://microsoft.com");
Assert.Equal(isLocal, new WebProxy(proxyUri, true).IsBypassed(destination));
Assert.False(new WebProxy(proxyUri, false).IsBypassed(destination));
try
{
Assert.Equal(isLocal, new WebProxy(proxyUri, true).IsBypassed(destination));
Assert.False(new WebProxy(proxyUri, false).IsBypassed(destination));
Assert.Equal(isLocal ? destination : proxyUri, new WebProxy(proxyUri, true).GetProxy(destination));
Assert.Equal(proxyUri, new WebProxy(proxyUri, false).GetProxy(destination));
Assert.Equal(isLocal ? destination : proxyUri, new WebProxy(proxyUri, true).GetProxy(destination));
Assert.Equal(proxyUri, new WebProxy(proxyUri, false).GetProxy(destination));
}
catch (SocketException exception)
{
// On Unix, getaddrinfo returns host not found, if all the machine discovery settings on the local network
// is turned off. Hence dns lookup for it's own hostname fails.
Assert.Equal(SocketError.HostNotFound, exception.SocketErrorCode);
Assert.Throws<SocketException>(() => Dns.GetHostEntryAsync(Dns.GetHostName()).GetAwaiter().GetResult());
Assert.True(RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX));
}
}
[Fact]