diff --git a/eng/testing/scenarios/BuildWasmAppsJobsListCoreCLR.txt b/eng/testing/scenarios/BuildWasmAppsJobsListCoreCLR.txt index 28a2f6ccee94a4..1c6ca2e9b8a3c4 100644 --- a/eng/testing/scenarios/BuildWasmAppsJobsListCoreCLR.txt +++ b/eng/testing/scenarios/BuildWasmAppsJobsListCoreCLR.txt @@ -3,6 +3,7 @@ Wasm.Build.Tests.EnvVariablesTests Wasm.Build.Tests.FilesToIncludeInFileSystemTests Wasm.Build.Tests.HttpTests Wasm.Build.Tests.LazyLoadingTests +Wasm.Build.Tests.MaxParallelDownloadsTests Wasm.Build.Tests.ModuleConfigTests Wasm.Build.Tests.PreloadingTests Wasm.Build.Tests.RebuildTests diff --git a/src/mono/wasm/Wasm.Build.Tests/MaxParallelDownloadsTests.cs b/src/mono/wasm/Wasm.Build.Tests/MaxParallelDownloadsTests.cs index 5c7c13c9b7db2a..4a75a660ebbf7b 100644 --- a/src/mono/wasm/Wasm.Build.Tests/MaxParallelDownloadsTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/MaxParallelDownloadsTests.cs @@ -31,7 +31,10 @@ public async Task NeverFetchMoreThanMaxAllowed(Configuration config, string maxP RunResult result = await RunForBuildWithDotnetRun(new BrowserRunOptions( config, TestScenario: "MaxParallelDownloads", - BrowserQueryString: new NameValueCollection { {"maxParallelDownloads", maxParallelDownloads } } + BrowserQueryString: new NameValueCollection { + {"maxParallelDownloads", maxParallelDownloads }, + {"runtimeFlavor", s_buildEnv.IsMonoRuntime ? "Mono" : "CoreCLR" } + } )); var resultTestOutput = result.TestOutput.ToList(); diff --git a/src/mono/wasm/testassets/WasmBasicTestApp/App/wwwroot/main.js b/src/mono/wasm/testassets/WasmBasicTestApp/App/wwwroot/main.js index d6057365483d79..60b0e485b0d289 100644 --- a/src/mono/wasm/testassets/WasmBasicTestApp/App/wwwroot/main.js +++ b/src/mono/wasm/testassets/WasmBasicTestApp/App/wwwroot/main.js @@ -129,7 +129,14 @@ switch (testCase) { const maxParallelDownloads = params.get("maxParallelDownloads"); let activeFetchCount = 0; const originalFetch2 = globalThis.fetch; + const isCoreCLR = params.get("runtimeFlavor") === "CoreCLR"; globalThis.fetch = async (...args) => { + if (isCoreCLR) { + const url = typeof args[0] === "string" ? args[0] : args[0]?.url ?? ""; + if (url.includes("dotnet.native")) { + return originalFetch2(...args); + } + } activeFetchCount++; testOutput(`Fetch started. Active downloads: ${activeFetchCount}`); try { @@ -143,7 +150,7 @@ switch (testCase) { throw error; } }; - dotnet.withConfig({ maxParallelDownloads: maxParallelDownloads }); + dotnet.withConfig({ maxParallelDownloads: parseInt(maxParallelDownloads) }); break; case "AllocateLargeHeapThenInterop": dotnet.withEnvironmentVariable("MONO_LOG_LEVEL", "debug")