Imported Upstream version 5.2.0.175

Former-commit-id: bb0468d0f257ff100aa895eb5fe583fb5dfbf900
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-06-07 13:16:24 +00:00
parent 4bdbaf4a88
commit 966bba02bb
8776 changed files with 346420 additions and 149650 deletions

View File

@@ -2,7 +2,7 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
netstandard1.3-Windows_NT;
netstandard-Windows_NT;
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<Project Include="System.Net.Http.WinHttpHandler.Functional.Tests.csproj">
<OSGroup>Windows_NT</OSGroup>
<TestTFMs>netcoreapp;netcoreapp1.0;net46</TestTFMs>
</Project>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
</Project>

View File

@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<ProjectGuid>{17D5CC82-F72C-4DD2-B6DB-DE7FB2F19C34}</ProjectGuid>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard1.3-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard1.3-Windows_NT-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Windows_NT-Release|AnyCPU'" />
<ItemGroup Condition=" '$(TargetsWindows)' == 'true' ">
<Compile Include="$(CommonTestPath)\System\Net\Configuration.cs">
<Link>Common\System\Net\Configuration.cs</Link>
@@ -18,4 +18,4 @@
<Compile Include="XunitTestAssemblyAtrributes.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
</Project>

View File

@@ -96,6 +96,7 @@ namespace System.Net.Http.WinHttpHandlerFunctional.Tests
}
}
[ActiveIssue(17234)]
[OuterLoop] // TODO: Issue #11345
[Fact]
[OuterLoop]

View File

@@ -2,7 +2,7 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
netstandard1.3-Windows_NT;
netstandard-Windows_NT;
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@@ -201,7 +201,7 @@ internal static partial class Interop
}
else
{
int bufferSize = Marshal.SizeOf<int>();
int bufferSize = sizeof(int);
IntPtr buffer = Marshal.AllocHGlobal(bufferSize);
Marshal.WriteInt32(buffer, TestServer.DataAvailable);
fakeHandle.InvokeCallback(Interop.WinHttp.WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE, buffer, (uint)bufferSize);

View File

@@ -13,21 +13,15 @@ namespace System.Net.Http.WinHttpHandlerUnitTests
{
internal class FakeSafeWinHttpHandle : Interop.WinHttp.SafeWinHttpHandle
{
private static int s_HandlesOpen = 0;
private Interop.WinHttp.WINHTTP_STATUS_CALLBACK _callback = null;
private IntPtr _context = IntPtr.Zero;
public FakeSafeWinHttpHandle(bool markAsValid)
{
if (markAsValid)
{
SetHandle(Marshal.AllocHGlobal(1));
Interlocked.Increment(ref s_HandlesOpen);
Debug.WriteLine(
"FakeSafeWinHttpHandle.cctor, handle=#{0}, s_HandlesOpen={1}",
handle.GetHashCode(),
s_HandlesOpen);
Debug.WriteLine("FakeSafeWinHttpHandle.cctor, handle=#{0}", handle.GetHashCode());
}
else
{
@@ -35,21 +29,13 @@ namespace System.Net.Http.WinHttpHandlerUnitTests
}
}
public static int HandlesOpen
{
get
{
return s_HandlesOpen;
}
}
public Interop.WinHttp.WINHTTP_STATUS_CALLBACK Callback
{
get
{
return _callback;
}
set
{
_callback = value;
@@ -62,7 +48,7 @@ namespace System.Net.Http.WinHttpHandlerUnitTests
{
return _context;
}
set
{
_context = value;
@@ -75,7 +61,7 @@ namespace System.Net.Http.WinHttpHandlerUnitTests
{
return true;
}
// Sleep for delay time specified. Abort if handle becomes closed.
var sw = new Stopwatch();
sw.Start();
@@ -86,15 +72,15 @@ namespace System.Net.Http.WinHttpHandlerUnitTests
sw.Stop();
return false;
}
Thread.Sleep(1);
}
sw.Stop();
return true;
}
public void InvokeCallback(uint internetStatus, Interop.WinHttp.WINHTTP_ASYNC_RESULT asyncResult)
{
GCHandle pinnedAsyncResult = GCHandle.Alloc(asyncResult, GCHandleType.Pinned);
@@ -113,12 +99,7 @@ namespace System.Net.Http.WinHttpHandlerUnitTests
protected override bool ReleaseHandle()
{
Interlocked.Decrement(ref s_HandlesOpen);
Debug.WriteLine(
"FakeSafeWinHttpHandle.ReleaseHandle, handle=#{0}, s_HandlesOpen={1}",
handle.GetHashCode(),
s_HandlesOpen);
Debug.WriteLine("FakeSafeWinHttpHandle.ReleaseHandle, handle=#{0}", handle.GetHashCode());
return base.ReleaseHandle();
}
}

View File

@@ -11,7 +11,6 @@ namespace System.Net.Http.WinHttpHandlerUnitTests
{
public class SafeWinHttpHandleTest
{
[ActiveIssue(13951)]
[Fact]
public void CreateAddRefDispose_HandleIsNotClosed()
{
@@ -20,15 +19,13 @@ namespace System.Net.Http.WinHttpHandlerUnitTests
safeHandle.DangerousAddRef(ref success);
Assert.True(success, "DangerousAddRef");
safeHandle.Dispose();
Assert.False(safeHandle.IsClosed, "closed");
Assert.Equal(1, FakeSafeWinHttpHandle.HandlesOpen);
// Clean up safeHandle to keep outstanding handles at zero.
safeHandle.DangerousRelease();
}
[ActiveIssue(13951)]
[Fact]
public void CreateAddRefDisposeDispose_HandleIsNotClosed()
{
@@ -38,15 +35,13 @@ namespace System.Net.Http.WinHttpHandlerUnitTests
Assert.True(success, "DangerousAddRef");
safeHandle.Dispose();
safeHandle.Dispose();
Assert.False(safeHandle.IsClosed, "closed");
Assert.Equal(1, FakeSafeWinHttpHandle.HandlesOpen);
// Clean up safeHandle to keep outstanding handles at zero.
safeHandle.DangerousRelease();
}
[ActiveIssue(13951)]
[Fact]
public void CreateAddRefDisposeRelease_HandleIsClosed()
{
@@ -56,12 +51,10 @@ namespace System.Net.Http.WinHttpHandlerUnitTests
Assert.True(success, "DangerousAddRef");
safeHandle.Dispose();
safeHandle.DangerousRelease();
Assert.True(safeHandle.IsClosed, "closed");
Assert.Equal(0, FakeSafeWinHttpHandle.HandlesOpen);
}
[ActiveIssue(13951)]
[Fact]
public void CreateAddRefRelease_HandleIsNotClosed()
{
@@ -70,15 +63,13 @@ namespace System.Net.Http.WinHttpHandlerUnitTests
safeHandle.DangerousAddRef(ref success);
Assert.True(success, "DangerousAddRef");
safeHandle.DangerousRelease();
Assert.False(safeHandle.IsClosed, "closed");
Assert.Equal(1, FakeSafeWinHttpHandle.HandlesOpen);
// Clean up safeHandle to keep outstanding handles at zero.
safeHandle.Dispose();
}
[ActiveIssue(13951)]
[Fact]
public void CreateAddRefReleaseDispose_HandleIsClosed()
{
@@ -88,22 +79,19 @@ namespace System.Net.Http.WinHttpHandlerUnitTests
Assert.True(success, "DangerousAddRef");
safeHandle.DangerousRelease();
safeHandle.Dispose();
Assert.True(safeHandle.IsClosed, "closed");
Assert.Equal(0, FakeSafeWinHttpHandle.HandlesOpen);
}
[ActiveIssue(13951)]
[Fact]
public void CreateDispose_HandleIsClosed()
{
var safeHandle = new FakeSafeWinHttpHandle(true);
safeHandle.Dispose();
Assert.True(safeHandle.IsClosed, "closed");
}
[ActiveIssue(13951)]
[Fact]
public void CreateDisposeDispose_HandleIsClosedAndSecondDisposeIsNoop()
{
@@ -113,17 +101,15 @@ namespace System.Net.Http.WinHttpHandlerUnitTests
Assert.True(safeHandle.IsClosed, "closed");
}
[ActiveIssue(13951)]
[Fact]
public void CreateDisposeAddRef_ThrowsObjectDisposedException()
{
var safeHandle = new FakeSafeWinHttpHandle(true);
safeHandle.Dispose();
Assert.Throws<ObjectDisposedException>(() =>
Assert.Throws<ObjectDisposedException>(() =>
{ bool ignore = false; safeHandle.DangerousAddRef(ref ignore); });
}
[ActiveIssue(13951)]
[Fact]
public void CreateDisposeRelease_ThrowsObjectDisposedException()
{
@@ -132,7 +118,6 @@ namespace System.Net.Http.WinHttpHandlerUnitTests
Assert.Throws<ObjectDisposedException>(() => safeHandle.DangerousRelease());
}
[ActiveIssue(13951)]
[Fact]
public void SetParentHandle_CreateParentCreateChildDisposeParent_ParentNotClosed()
{
@@ -140,15 +125,13 @@ namespace System.Net.Http.WinHttpHandlerUnitTests
var childHandle = new FakeSafeWinHttpHandle(true);
childHandle.SetParentHandle(parentHandle);
parentHandle.Dispose();
Assert.False(parentHandle.IsClosed, "closed");
Assert.Equal(2, FakeSafeWinHttpHandle.HandlesOpen);
// Clean up safeHandles to keep outstanding handles at zero.
childHandle.Dispose();
}
[ActiveIssue(13951)]
[Fact]
public void SetParentHandle_CreateParentCreateChildDisposeParentDisposeChild_HandlesClosed()
{
@@ -157,12 +140,11 @@ namespace System.Net.Http.WinHttpHandlerUnitTests
childHandle.SetParentHandle(parentHandle);
parentHandle.Dispose();
childHandle.Dispose();
Assert.True(parentHandle.IsClosed, "closed");
Assert.True(childHandle.IsClosed, "closed");
}
[ActiveIssue(13951)]
[Fact]
public void SetParentHandle_CreateParentCreateChildDisposeChildDisposeParent_HandlesClosed()
{
@@ -171,7 +153,7 @@ namespace System.Net.Http.WinHttpHandlerUnitTests
childHandle.SetParentHandle(parentHandle);
childHandle.Dispose();
parentHandle.Dispose();
Assert.True(parentHandle.IsClosed, "closed");
Assert.True(childHandle.IsClosed, "closed");
}

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<Project Include="System.Net.Http.WinHttpHandler.Unit.Tests.csproj">
<OSGroup>Windows_NT</OSGroup>
<TestTFMs>netcoreapp;netcoreapp1.0;net46</TestTFMs>
</Project>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
</Project>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
@@ -7,8 +7,8 @@
<StringResourcesPath>../../src/Resources/Strings.resx</StringResourcesPath>
</PropertyGroup>
<!-- Help VS understand available configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard1.3-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard1.3-Windows_NT-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Windows_NT-Release|AnyCPU'" />
<ItemGroup>
<TargetingPackExclusions Include="System.Net.Http.WinHttpHandler" />
</ItemGroup>
@@ -64,12 +64,6 @@
<Compile Include="$(CommonPath)\System\Net\Http\HttpHandlerDefaults.cs">
<Link>Common\System\Net\Http\HttpHandlerDefaults.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\Http\HttpHandlerDiagnosticListenerExtensions.cs">
<Link>Common\System\Net\Http\HttpHandlerDiagnosticListenerExtensions.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\Http\HttpHandlerLoggingStrings.cs">
<Link>Common\System\Net\Http\HttpHandlerLoggingStrings.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\Http\NoWriteNoSeekStreamContent.cs">
<Link>Common\System\Net\Http\NoWriteNoSeekStreamContent.cs</Link>
</Compile>
@@ -79,6 +73,9 @@
<Compile Include="$(CommonPath)\System\Threading\Tasks\RendezvousAwaitable.cs">
<Link>Common\System\Threading\Tasks\RendezvousAwaitable.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Threading\Tasks\TaskToApm.cs">
<Link>Common\System\Threading\Tasks\TaskToApm.cs</Link>
</Compile>
<Compile Include="..\..\src\System\Net\Http\WinHttpAuthHelper.cs">
<Link>ProductionCode\WinHttpAuthHelper.cs</Link>
</Compile>
@@ -140,4 +137,4 @@
<Compile Include="XunitTestAssemblyAtrributes.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
</Project>

View File

@@ -130,7 +130,7 @@ namespace System.Net.Http.WinHttpHandlerUnitTests
}
[Fact]
public async void CookieUsePolicy_UseSpecifiedCookieContainerAndNullContainer_ThrowsInvalidOperationException()
public async Task CookieUsePolicy_UseSpecifiedCookieContainerAndNullContainer_ThrowsInvalidOperationException()
{
var handler = new WinHttpHandler();
Assert.Null(handler.CookieContainer);