From 2478c164b5d4ddfbde52727ba1c6048744c9b642 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Wed, 11 Apr 2018 14:00:03 +0100 Subject: [PATCH] Update Mono to 078d5147836 (#543) * Update Mono to 078d5147836 * Update driver.c to match updated Mono version * Rebuild Mono binaries * Update dependency resolution baseline to match updated Mono BCL * Add E2E test for new RuntimeInformation values --- samples/MonoSanity/wwwroot/index.html | 14 ++++++++++++++ samples/MonoSanityClient/Examples.cs | 6 ++++++ .../RuntimeDependenciesResolverTest.cs | 7 ------- .../Tests/MonoSanityTest.cs | 9 +++++++++ 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/samples/MonoSanity/wwwroot/index.html b/samples/MonoSanity/wwwroot/index.html index 449dc78b3a..42078226c1 100644 --- a/samples/MonoSanity/wwwroot/index.html +++ b/samples/MonoSanity/wwwroot/index.html @@ -55,6 +55,14 @@ +
+ Get runtime OS +
+ + +
+
+

Loading...

@@ -111,6 +119,12 @@ el('callJsNoBoxingResult').value = result; }; + el('getRuntimeInformation').onsubmit = function (evt) { + evt.preventDefault(); + var result = invokeMonoMethod('MonoSanityClient', 'MonoSanityClient', 'Examples', 'GetRuntimeInformation', []); + el('getRuntimeInformationResult').value = result; + }; + function el(id) { return document.getElementById(id); } diff --git a/samples/MonoSanityClient/Examples.cs b/samples/MonoSanityClient/Examples.cs index 5a677c97a3..23179361c4 100644 --- a/samples/MonoSanityClient/Examples.cs +++ b/samples/MonoSanityClient/Examples.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Runtime.InteropServices; using System.Text; using WebAssembly; @@ -53,5 +54,10 @@ namespace MonoSanityClient return $".NET received: {result}"; } + + public static string GetRuntimeInformation() + => $"OSDescription: '{RuntimeInformation.OSDescription}';" + + $" OSArchitecture: '{RuntimeInformation.OSArchitecture}';" + + $" IsOSPlatform(WEBASSEMBLY): '{RuntimeInformation.IsOSPlatform(OSPlatform.Create("WEBASSEMBLY"))}'"; } } diff --git a/test/Microsoft.AspNetCore.Blazor.Build.Test/RuntimeDependenciesResolverTest.cs b/test/Microsoft.AspNetCore.Blazor.Build.Test/RuntimeDependenciesResolverTest.cs index b4d1fe4ae0..098af08f61 100644 --- a/test/Microsoft.AspNetCore.Blazor.Build.Test/RuntimeDependenciesResolverTest.cs +++ b/test/Microsoft.AspNetCore.Blazor.Build.Test/RuntimeDependenciesResolverTest.cs @@ -66,25 +66,18 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test "System.ComponentModel.Composition.dll", "System.Core.dll", "System.Data.dll", - "System.Diagnostics.StackTrace.dll", "System.dll", "System.Drawing.dll", - "System.Globalization.Extensions.dll", "System.IO.Compression.dll", "System.IO.Compression.FileSystem.dll", "System.Net.Http.dll", "System.Numerics.dll", "System.Runtime.Serialization.dll", - "System.Runtime.Serialization.Primitives.dll", - "System.Runtime.Serialization.Xml.dll", - "System.Security.Cryptography.Algorithms.dll", - "System.Security.SecureString.dll", "System.ServiceModel.Internals.dll", "System.Transactions.dll", "System.Web.Services.dll", "System.Xml.dll", "System.Xml.Linq.dll", - "System.Xml.XPath.XDocument.dll", }.OrderBy(i => i, StringComparer.Ordinal) .ToArray(); diff --git a/test/Microsoft.AspNetCore.Blazor.E2ETest/Tests/MonoSanityTest.cs b/test/Microsoft.AspNetCore.Blazor.E2ETest/Tests/MonoSanityTest.cs index 513a0a85c5..6bc3fdc16e 100644 --- a/test/Microsoft.AspNetCore.Blazor.E2ETest/Tests/MonoSanityTest.cs +++ b/test/Microsoft.AspNetCore.Blazor.E2ETest/Tests/MonoSanityTest.cs @@ -126,6 +126,15 @@ namespace Microsoft.AspNetCore.Blazor.E2ETest.Tests Assert.StartsWith(".NET got exception: Division by zero", GetValue(Browser, "callJsNoBoxingResult")); } + [Fact] + public void ReturnsExpectedRuntimeInformation() + { + Browser.FindElement(By.CssSelector("#getRuntimeInformation button")).Click(); + Assert.Equal( + "OSDescription: 'web'; OSArchitecture: 'X86'; IsOSPlatform(WEBASSEMBLY): 'True'", + GetValue(Browser, "getRuntimeInformationResult")); + } + private static string GetValue(IWebDriver webDriver, string elementId) { var element = webDriver.FindElement(By.Id(elementId));