forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[browser] Allow downloading WebAssembly resources without performing …
…other WebAssembly runtime initalization (dotnet#102254) * await dotnet.download(); * Added WBT. * Rename. * Feedback: add the new wbt to TestAppScenarios. * Check for re-download instead of specific files. --------- Co-authored-by: Ilona Tomkowicz <[email protected]>
- Loading branch information
1 parent
ab604e9
commit 8fac5af
Showing
12 changed files
with
147 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/DownloadThenInitTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Xunit.Abstractions; | ||
using Xunit; | ||
|
||
#nullable enable | ||
|
||
namespace Wasm.Build.Tests.TestAppScenarios; | ||
|
||
public class DownloadThenInitTests : AppTestBase | ||
{ | ||
public DownloadThenInitTests(ITestOutputHelper output, SharedBuildPerTestClassFixture buildContext) | ||
: base(output, buildContext) | ||
{ | ||
} | ||
|
||
[Theory] | ||
[InlineData("Debug")] | ||
[InlineData("Release")] | ||
public async Task NoResourcesReFetchedAfterDownloadFinished(string config) | ||
{ | ||
CopyTestAsset("WasmBasicTestApp", "DownloadThenInitTests", "App"); | ||
BuildProject(config); | ||
|
||
var result = await RunSdkStyleAppForBuild(new(Configuration: config, TestScenario: "DownloadThenInit")); | ||
var resultTestOutput = result.TestOutput.ToList(); | ||
int index = resultTestOutput.FindIndex(s => s == "download finished"); | ||
Assert.True(index > 0); // number of fetched resources cannot be 0 | ||
var afterDownload = resultTestOutput.Skip(index + 1).Where(s => s.StartsWith("fetching")).ToList(); | ||
if (afterDownload.Count > 0) | ||
{ | ||
var duringDownload = resultTestOutput.Take(index + 1).Where(s => s.StartsWith("fetching")).ToList(); | ||
var reFetchedResources = afterDownload.Intersect(duringDownload).ToList(); | ||
if (reFetchedResources.Any()) | ||
Assert.Fail($"Resources should not be fetched twice. Re-fetched on init: {string.Join(", ", reFetchedResources)}"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters