From 1a964b405e3f6ee20862b4a45328da570ce2fac0 Mon Sep 17 00:00:00 2001 From: softworkz Date: Fri, 14 Nov 2025 06:09:38 +0100 Subject: [PATCH] BrowserWindow tests: use about:blank as url --- src/ElectronNET.IntegrationTests/ElectronFixture.cs | 2 +- .../Tests/BrowserWindowTests.cs | 8 ++++---- src/ElectronNET.IntegrationTests/Tests/ProcessTests.cs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ElectronNET.IntegrationTests/ElectronFixture.cs b/src/ElectronNET.IntegrationTests/ElectronFixture.cs index 68a1ec9..999e066 100644 --- a/src/ElectronNET.IntegrationTests/ElectronFixture.cs +++ b/src/ElectronNET.IntegrationTests/ElectronFixture.cs @@ -22,7 +22,7 @@ namespace ElectronNET.IntegrationTests Show = false, Width = 800, Height = 600, - }); + }, "about:blank"); // Clear potential cache side-effects await this.MainWindow.WebContents.Session.ClearCacheAsync(); diff --git a/src/ElectronNET.IntegrationTests/Tests/BrowserWindowTests.cs b/src/ElectronNET.IntegrationTests/Tests/BrowserWindowTests.cs index e7e6902..32ebc21 100644 --- a/src/ElectronNET.IntegrationTests/Tests/BrowserWindowTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/BrowserWindowTests.cs @@ -105,7 +105,7 @@ namespace ElectronNET.IntegrationTests.Tests [Fact(Timeout = 20000)] public async Task ReadyToShow_event_fires_after_content_ready() { - var window = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = false }); + var window = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = false }, "about:blank"); var tcs = new TaskCompletionSource(); window.OnReadyToShow += () => tcs.TrySetResult(); @@ -125,7 +125,7 @@ namespace ElectronNET.IntegrationTests.Tests [Fact(Timeout = 20000)] public async Task PageTitleUpdated_event_fires_on_title_change() { - var window = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = true }); + var window = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = true }, "about:blank"); var tcs = new TaskCompletionSource(); window.OnPageTitleUpdated += title => tcs.TrySetResult(title); @@ -145,7 +145,7 @@ namespace ElectronNET.IntegrationTests.Tests [Fact(Timeout = 20000)] public async Task Resize_event_fires_on_size_change() { - var window = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = false }); + var window = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = false }, "about:blank"); var resized = false; window.OnResize += () => resized = true; window.SetSize(500, 400); @@ -178,7 +178,7 @@ namespace ElectronNET.IntegrationTests.Tests [Fact(Timeout = 20000)] public async Task Parent_child_relationship_roundtrip() { - var child = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = false, Width = 300, Height = 200 }); + var child = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = false, Width = 300, Height = 200 }, "about:blank"); this.fx.MainWindow.SetParentWindow(null); // ensure top-level child.SetParentWindow(this.fx.MainWindow); var parent = await child.GetParentWindowAsync(); diff --git a/src/ElectronNET.IntegrationTests/Tests/ProcessTests.cs b/src/ElectronNET.IntegrationTests/Tests/ProcessTests.cs index 6a8eafd..3fe2724 100644 --- a/src/ElectronNET.IntegrationTests/Tests/ProcessTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/ProcessTests.cs @@ -9,7 +9,7 @@ namespace ElectronNET.IntegrationTests.Tests public async Task Process_info_is_accessible() { // Use renderer to fetch process info and round-trip - var execPath = await Electron.WindowManager.CreateWindowAsync(new API.Entities.BrowserWindowOptions { Show = false }); + var execPath = await Electron.WindowManager.CreateWindowAsync(new API.Entities.BrowserWindowOptions { Show = false }, "about:blank"); var result = await execPath.WebContents.ExecuteJavaScriptAsync("process.execPath && process.platform ? 'ok' : 'fail'"); result.Should().Be("ok"); }