Skip to content

Commit

Permalink
Test - Increase BrowserRefCountDecrementedOnDispose reliability
Browse files Browse the repository at this point in the history
  • Loading branch information
amaitland committed May 31, 2022
1 parent 527aab2 commit 46e9249
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions CefSharp.Test/OffScreen/OffScreenBrowserBasicFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ public async Task CanLoadExpiredBadSsl()
[Fact]
public void BrowserRefCountDecrementedOnDispose()
{
var currentCount = BrowserRefCounter.Instance.Count;

var manualResetEvent = new ManualResetEvent(false);

var browser = new ChromiumWebBrowser("https://google.com");
Expand All @@ -141,12 +143,10 @@ public void BrowserRefCountDecrementedOnDispose()
manualResetEvent.WaitOne();

//TODO: Refactor this so reference is injected into browser
Assert.Equal(1, BrowserRefCounter.Instance.Count);
Assert.Equal(currentCount + 1, BrowserRefCounter.Instance.Count);

browser.Dispose();

Assert.True(BrowserRefCounter.Instance.Count <= 1);

Cef.WaitForBrowsersToClose();

Assert.Equal(0, BrowserRefCounter.Instance.Count);
Expand Down

0 comments on commit 46e9249

Please sign in to comment.