From a51da76ad908887fc82420c61b602f678a324956 Mon Sep 17 00:00:00 2001 From: Alex Maitland Date: Sun, 15 Jan 2023 11:33:08 +1000 Subject: [PATCH] OffScreen - Add useLegacyRenderHandler optional param to constructor - Defaults to true - For those using CaptureScreenshotAsync set to false to avoid creating DefaultRenderHandler --- CefSharp.OffScreen/ChromiumWebBrowser.cs | 19 +++++-- .../ChromiumWebBrowserOffScreenFixture.cs | 2 +- CefSharp.Test/DevTools/DevToolsClientFacts.cs | 22 ++++---- .../EvaluateScriptAsPromiseAsyncFacts.cs | 4 +- .../Navigation/WaitForNavigationAsyncTests.cs | 8 +-- .../OffScreen/OffScreenBrowserBasicFacts.cs | 53 +++++++++---------- .../OffScreen/WaitForRenderIdleTests.cs | 8 +-- .../PostMessage/IntegrationTestFacts.cs | 2 +- .../FolderSchemeHandlerFactoryTests.cs | 2 +- .../Selector/WaitForSelectorAsyncTests.cs | 14 ++--- 10 files changed, 72 insertions(+), 62 deletions(-) diff --git a/CefSharp.OffScreen/ChromiumWebBrowser.cs b/CefSharp.OffScreen/ChromiumWebBrowser.cs index 3bc95ca703..df9fe6f00b 100644 --- a/CefSharp.OffScreen/ChromiumWebBrowser.cs +++ b/CefSharp.OffScreen/ChromiumWebBrowser.cs @@ -172,10 +172,15 @@ public bool IsBrowserInitialized /// this action is guranteed to be called after the browser created where as the event may be called before /// you have a chance to subscribe to the event as the CEF Browser is created async. (Issue https://github.com/cefsharp/CefSharp/issues/3552). /// + /// + /// For those using or then + /// this must be true, for those using this can be false. + /// Lower memory usage when false. Defaults to true for backwards compatability. + /// /// Cef::Initialize() failed public ChromiumWebBrowser(HtmlString html, IBrowserSettings browserSettings = null, IRequestContext requestContext = null, bool automaticallyCreateBrowser = true, - Action onAfterBrowserCreated = null) : this(html.ToDataUriString(), browserSettings, requestContext, automaticallyCreateBrowser, onAfterBrowserCreated) + Action onAfterBrowserCreated = null, bool useLegacyRenderHandler = true) : this(html.ToDataUriString(), browserSettings, requestContext, automaticallyCreateBrowser, onAfterBrowserCreated, useLegacyRenderHandler) { } @@ -195,10 +200,15 @@ public ChromiumWebBrowser(HtmlString html, IBrowserSettings browserSettings = nu /// this action is guranteed to be called after the browser created where as the event may be called before /// you have a chance to subscribe to the event as the CEF Browser is created async. (Issue https://github.com/cefsharp/CefSharp/issues/3552). /// + /// + /// For those using or then + /// this must be true, for those using this can be false. + /// Lower memory usage when false. Defaults to true for backwards compatability. + /// /// Cef::Initialize() failed public ChromiumWebBrowser(string address = "", IBrowserSettings browserSettings = null, IRequestContext requestContext = null, bool automaticallyCreateBrowser = true, - Action onAfterBrowserCreated = null) + Action onAfterBrowserCreated = null, bool useLegacyRenderHandler = true) { if (!Cef.IsInitialized) { @@ -223,7 +233,10 @@ public ChromiumWebBrowser(string address = "", IBrowserSettings browserSettings CreateBrowser(null, browserSettings); } - RenderHandler = new DefaultRenderHandler(this); + if (useLegacyRenderHandler) + { + RenderHandler = new DefaultRenderHandler(this); + } } /// diff --git a/CefSharp.Test/ChromiumWebBrowserOffScreenFixture.cs b/CefSharp.Test/ChromiumWebBrowserOffScreenFixture.cs index 40b47798cc..670afd42f6 100644 --- a/CefSharp.Test/ChromiumWebBrowserOffScreenFixture.cs +++ b/CefSharp.Test/ChromiumWebBrowserOffScreenFixture.cs @@ -22,7 +22,7 @@ Task IAsyncLifetime.DisposeAsync() Task IAsyncLifetime.InitializeAsync() { - Browser = new ChromiumWebBrowser(CefExample.HelloWorldUrl); + Browser = new ChromiumWebBrowser(CefExample.HelloWorldUrl, useLegacyRenderHandler: false); return Browser.WaitForInitialLoadAsync(); } diff --git a/CefSharp.Test/DevTools/DevToolsClientFacts.cs b/CefSharp.Test/DevTools/DevToolsClientFacts.cs index d7bc71b8c6..8a37811644 100644 --- a/CefSharp.Test/DevTools/DevToolsClientFacts.cs +++ b/CefSharp.Test/DevTools/DevToolsClientFacts.cs @@ -35,7 +35,7 @@ public DevToolsClientFacts(ITestOutputHelper output, CefSharpFixture fixture) [Fact] public async Task CanCaptureScreenshot() { - using (var browser = new ChromiumWebBrowser("www.google.com")) + using (var browser = new ChromiumWebBrowser("www.google.com", useLegacyRenderHandler: false)) { await browser.WaitForInitialLoadAsync(); @@ -81,7 +81,7 @@ public void CanConvertDevToolsObjectToDictionary() [Fact] public async Task CanGetDevToolsProtocolVersion() { - using (var browser = new ChromiumWebBrowser("www.google.com")) + using (var browser = new ChromiumWebBrowser("www.google.com", useLegacyRenderHandler: false)) { await browser.WaitForInitialLoadAsync(); @@ -102,7 +102,7 @@ public async Task CanGetDevToolsProtocolVersion() [Fact] public async Task CanEmulationCanEmulate() { - using (var browser = new ChromiumWebBrowser("www.google.com")) + using (var browser = new ChromiumWebBrowser("www.google.com", useLegacyRenderHandler: false)) { await browser.WaitForInitialLoadAsync(); @@ -118,7 +118,7 @@ public async Task CanEmulationCanEmulate() [Fact] public async Task CanGetPageNavigationHistory() { - using (var browser = new ChromiumWebBrowser("www.google.com")) + using (var browser = new ChromiumWebBrowser("www.google.com", useLegacyRenderHandler: false)) { await browser.WaitForInitialLoadAsync(); @@ -141,7 +141,7 @@ public async Task CanGetPageNavigationHistory() [InlineData("CefSharpTest1", "CefSharp Test Cookie2", CefExample.ExampleDomain, CookieSameSite.Lax)] public async Task CanSetCookieForDomain(string name, string value, string domain, CookieSameSite sameSite) { - using (var browser = new ChromiumWebBrowser("www.google.com")) + using (var browser = new ChromiumWebBrowser("www.google.com", useLegacyRenderHandler: false)) { await browser.WaitForInitialLoadAsync(); @@ -157,7 +157,7 @@ public async Task CanSetCookieForDomain(string name, string value, string domain [Fact] public async Task CanUseMultipleDevToolsClientInstancesPerBrowser() { - using (var browser = new ChromiumWebBrowser("www.google.com")) + using (var browser = new ChromiumWebBrowser("www.google.com", useLegacyRenderHandler: false)) { await browser.WaitForInitialLoadAsync(); @@ -190,7 +190,7 @@ public async Task CanUseMultipleDevToolsClientInstancesPerBrowser() [Fact] public async Task CanSetUserAgentOverride() { - using (var browser = new ChromiumWebBrowser("www.google.com")) + using (var browser = new ChromiumWebBrowser("www.google.com", useLegacyRenderHandler: false)) { await browser.WaitForInitialLoadAsync(); @@ -259,7 +259,7 @@ public async Task CanSetUserAgentOverride() [Fact] public async Task CanSetExtraHTTPHeaders() { - using (var browser = new ChromiumWebBrowser("about:blank", automaticallyCreateBrowser: false)) + using (var browser = new ChromiumWebBrowser("about:blank", automaticallyCreateBrowser: false, useLegacyRenderHandler: false)) { await browser.CreateBrowserAsync(); @@ -307,7 +307,7 @@ public async Task CanSetExtraHTTPHeaders() [Fact] public async Task ExecuteDevToolsMethodThrowsExceptionWithInvalidMethod() { - using (var browser = new ChromiumWebBrowser("www.google.com")) + using (var browser = new ChromiumWebBrowser("www.google.com", useLegacyRenderHandler: false)) { await browser.WaitForInitialLoadAsync(); @@ -327,7 +327,7 @@ public async Task ExecuteDevToolsMethodThrowsExceptionWithInvalidMethod() [Fact] public async Task CanGetMediaQueries() { - using (var browser = new ChromiumWebBrowser("https://cefsharp.github.io/demo/mediaqueryhover.html")) + using (var browser = new ChromiumWebBrowser("https://cefsharp.github.io/demo/mediaqueryhover.html", useLegacyRenderHandler: false)) { await browser.WaitForInitialLoadAsync(); @@ -346,7 +346,7 @@ public async Task CanGetMediaQueries() [Fact] public async Task CanRegisterMultipleEventHandlers() { - using (var browser = new ChromiumWebBrowser("about:blank", automaticallyCreateBrowser: false)) + using (var browser = new ChromiumWebBrowser("about:blank", automaticallyCreateBrowser: false, useLegacyRenderHandler: false)) { await browser.CreateBrowserAsync(); diff --git a/CefSharp.Test/Javascript/EvaluateScriptAsPromiseAsyncFacts.cs b/CefSharp.Test/Javascript/EvaluateScriptAsPromiseAsyncFacts.cs index 4bc9f6839b..734f58eb23 100644 --- a/CefSharp.Test/Javascript/EvaluateScriptAsPromiseAsyncFacts.cs +++ b/CefSharp.Test/Javascript/EvaluateScriptAsPromiseAsyncFacts.cs @@ -33,7 +33,7 @@ public EvaluateScriptAsPromiseAsyncFacts(ITestOutputHelper output, CefSharpFixtu [InlineData("var result = await fetch('./robots.txt'); return result.status;", true, "200")] public async Task CanEvaluateScriptAsPromiseAsync(string script, bool success, string expected) { - using (var browser = new ChromiumWebBrowser("http://www.google.com")) + using (var browser = new ChromiumWebBrowser("http://www.google.com", useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -66,7 +66,7 @@ public async Task CanEvaluateScriptAsPromiseAsync(string script, bool success, s [InlineData("function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }; async function getValAfterSleep() { await sleep(1000); return { a: 'CefSharp', b: 42 }; }; await sleep(2000); const result = await getValAfterSleep(); await sleep(2000); return result;", true, "CefSharp", "42")] public async Task CanEvaluateScriptAsPromiseAsyncReturnObject(string script, bool success, string expectedA, string expectedB) { - using (var browser = new ChromiumWebBrowser("http://www.google.com")) + using (var browser = new ChromiumWebBrowser("http://www.google.com", useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); diff --git a/CefSharp.Test/Navigation/WaitForNavigationAsyncTests.cs b/CefSharp.Test/Navigation/WaitForNavigationAsyncTests.cs index 904acdb3b4..129679e802 100644 --- a/CefSharp.Test/Navigation/WaitForNavigationAsyncTests.cs +++ b/CefSharp.Test/Navigation/WaitForNavigationAsyncTests.cs @@ -28,7 +28,7 @@ public async Task CanWork() { const string expected = CefExample.HelloWorldUrl; - using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl)) + using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl, useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -54,7 +54,7 @@ public async Task CanWork() public async Task CanWaitForInvalidDomain() { const string expected = "https://notfound.cefsharp.test"; - using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl)) + using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl, useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -82,7 +82,7 @@ public async Task CanTimeout() { const string expected = "The operation has timed out."; - using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl)) + using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl, useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -104,7 +104,7 @@ public async Task CanCancel() { const string expected = "A task was canceled."; - using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl)) + using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl, useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); diff --git a/CefSharp.Test/OffScreen/OffScreenBrowserBasicFacts.cs b/CefSharp.Test/OffScreen/OffScreenBrowserBasicFacts.cs index f4f5528e12..fcf7575667 100644 --- a/CefSharp.Test/OffScreen/OffScreenBrowserBasicFacts.cs +++ b/CefSharp.Test/OffScreen/OffScreenBrowserBasicFacts.cs @@ -49,7 +49,7 @@ public OffScreenBrowserBasicFacts(ITestOutputHelper output, CefSharpFixture fixt [Fact] public async Task CanLoadGoogle() { - using (var browser = new ChromiumWebBrowser("www.google.com")) + using (var browser = new ChromiumWebBrowser("www.google.com", useLegacyRenderHandler:false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -69,7 +69,7 @@ public async Task ShouldRespectDisposed() { ChromiumWebBrowser browser; - using (browser = new ChromiumWebBrowser(CefExample.DefaultUrl)) + using (browser = new ChromiumWebBrowser(CefExample.DefaultUrl, useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -94,7 +94,7 @@ public async Task ShouldRespectDisposed() [Fact] public async Task CanLoadInvalidDomain() { - using (var browser = new ChromiumWebBrowser("notfound.cefsharp.test")) + using (var browser = new ChromiumWebBrowser("notfound.cefsharp.test", useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -110,7 +110,7 @@ public async Task CanLoadInvalidDomain() [Fact] public async Task CanLoadExpiredBadSsl() { - using (var browser = new ChromiumWebBrowser("https://expired.badssl.com/")) + using (var browser = new ChromiumWebBrowser("https://expired.badssl.com/", useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -131,7 +131,7 @@ public void BrowserRefCountDecrementedOnDispose() var manualResetEvent = new ManualResetEvent(false); - var browser = new ChromiumWebBrowser("https://google.com"); + var browser = new ChromiumWebBrowser("https://google.com", useLegacyRenderHandler: false); browser.LoadingStateChanged += (sender, e) => { if (!e.IsLoading) @@ -158,7 +158,7 @@ public void BrowserRefCountDecrementedOnDispose() [Fact] public async Task CanCreateBrowserAsync() { - using (var chromiumWebBrowser = new ChromiumWebBrowser("http://www.google.com", automaticallyCreateBrowser: false)) + using (var chromiumWebBrowser = new ChromiumWebBrowser("http://www.google.com", automaticallyCreateBrowser: false, useLegacyRenderHandler: false)) { var browser = await chromiumWebBrowser.CreateBrowserAsync(); @@ -172,7 +172,7 @@ public async Task CanCreateBrowserAsync() [Fact] public async Task CanLoadGoogleAndEvaluateScript() { - using (var browser = new ChromiumWebBrowser("www.google.com")) + using (var browser = new ChromiumWebBrowser("www.google.com", useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -192,7 +192,7 @@ public async Task CanLoadGoogleAndEvaluateScript() [Fact] public async Task CanEvaluateScriptInParallel() { - using (var browser = new ChromiumWebBrowser("www.google.com")) + using (var browser = new ChromiumWebBrowser("www.google.com", useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -226,7 +226,7 @@ public async Task CanEvaluateScriptInParallel() [InlineData("[,2,,3,,4,,,,5,,,]", new object[] { null, 2, null, 3, null, 4, null, null, null, 5, null, null })] public async Task CanEvaluateScriptAsyncReturnPartiallyEmptyArrays(string javascript, object[] expected) { - using (var browser = new ChromiumWebBrowser(CefExample.HelloWorldUrl)) + using (var browser = new ChromiumWebBrowser(CefExample.HelloWorldUrl, useLegacyRenderHandler: false)) { await browser.WaitForInitialLoadAsync(); @@ -249,7 +249,7 @@ public async Task CrossSiteNavigationJavascriptBinding() var boundObj = new AsyncBoundObject(); - using (var browser = new ChromiumWebBrowser("https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/url")) + using (var browser = new ChromiumWebBrowser("https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/url", useLegacyRenderHandler: false)) { #if NETCOREAPP browser.JavascriptObjectRepository.Register("bound", boundObj); @@ -289,7 +289,7 @@ public async Task JavascriptBindingMultipleObjects() var objectNames = new List(); var boundObj = new AsyncBoundObject(); - using (var browser = new ChromiumWebBrowser("https://www.google.com")) + using (var browser = new ChromiumWebBrowser("https://www.google.com", useLegacyRenderHandler: false)) { browser.JavascriptObjectRepository.ResolveObject += (s, e) => { @@ -317,7 +317,7 @@ public async Task JavascriptBindingMultipleObjects() [Fact] public async Task CanEvaluateScriptAsyncWithEncodedStringArguments() { - using (var browser = new ChromiumWebBrowser("http://www.google.com")) + using (var browser = new ChromiumWebBrowser("http://www.google.com", useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -345,7 +345,7 @@ public async Task CanEvaluateScriptAsyncWithEncodedStringArguments() [Fact] public async Task CanMakeFrameUrlRequest() { - using (var browser = new ChromiumWebBrowser("https://code.jquery.com/jquery-3.4.1.min.js")) + using (var browser = new ChromiumWebBrowser("https://code.jquery.com/jquery-3.4.1.min.js", useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -383,7 +383,7 @@ await Cef.UIThreadTaskFactory.StartNew(delegate [InlineData("https://code.jquery.com/jquery-3.4.1.min.js")] public async Task CanDownloadUrlForFrame(string url) { - using (var browser = new ChromiumWebBrowser(url)) + using (var browser = new ChromiumWebBrowser(url, useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -413,7 +413,7 @@ public async Task CanDownloadFileToFolderWithoutAskingUser(string url) { var tcs = new TaskCompletionSource(TaskContinuationOptions.RunContinuationsAsynchronously); - using (var chromiumWebBrowser = new ChromiumWebBrowser(url)) + using (var chromiumWebBrowser = new ChromiumWebBrowser(url, useLegacyRenderHandler: false)) { var userTempPath = System.IO.Path.GetTempPath(); @@ -490,7 +490,7 @@ await Cef.UIThreadTaskFactory.StartNew(delegate [InlineData("http://www.google.com", "http://cefsharp.github.io/")] public async Task CanExecuteJavascriptInMainFrameAfterNavigatingToDifferentOrigin(string firstUrl, string secondUrl) { - using (var browser = new ChromiumWebBrowser(firstUrl)) + using (var browser = new ChromiumWebBrowser(firstUrl, useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -517,7 +517,7 @@ public async Task CanLoadRequestWithPostData(string url) //a web page of the same origin to use LoadRequest //When Site Isolation is disabled we can navigate to any web page //https://magpcss.org/ceforum/viewtopic.php?f=10&t=18672&p=50266#p50249 - using (var browser = new ChromiumWebBrowser("http://httpbin.org/")) + using (var browser = new ChromiumWebBrowser("http://httpbin.org/", useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -562,7 +562,7 @@ public async Task CanLoadHttpWebsiteUsingProxy() .WithProxyServer("127.0.0.1", 8080) .Create(); - using (var browser = new ChromiumWebBrowser("http://cefsharp.github.io/", requestContext: requestContext)) + using (var browser = new ChromiumWebBrowser("http://cefsharp.github.io/", requestContext: requestContext, useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -598,7 +598,7 @@ public async Task CanLoadHttpWebsiteUsingSetProxyAsync() Assert.True(setProxyResponse.Success); - using (var browser = new ChromiumWebBrowser("http://cefsharp.github.io/", requestContext: requestContext)) + using (var browser = new ChromiumWebBrowser("http://cefsharp.github.io/", requestContext: requestContext, useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -650,7 +650,7 @@ await Cef.UIThreadTaskFactory.StartNew(delegate Assert.True(success); - using (var browser = new ChromiumWebBrowser("http://cefsharp.github.io/", requestContext: requestContext)) + using (var browser = new ChromiumWebBrowser("http://cefsharp.github.io/", requestContext: requestContext, useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -667,7 +667,7 @@ await Cef.UIThreadTaskFactory.StartNew(delegate [Fact] public async Task CanWaitForBrowserInitialLoadAfterLoad() { - using (var browser = new ChromiumWebBrowser("http://www.google.com")) + using (var browser = new ChromiumWebBrowser("http://www.google.com", useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -689,7 +689,7 @@ public async Task CanWaitForBrowserInitialLoadAfterLoad() [Fact] public async Task CanCallTryGetBrowserCoreByIdWithInvalidId() { - using (var browser = new ChromiumWebBrowser("http://www.google.com")) + using (var browser = new ChromiumWebBrowser("http://www.google.com", useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -703,7 +703,7 @@ public async Task CanCallTryGetBrowserCoreByIdWithInvalidId() [Fact] public async Task CanCallTryGetBrowserCoreByIdWithOwnId() { - using (var browser = new ChromiumWebBrowser("http://www.google.com")) + using (var browser = new ChromiumWebBrowser("http://www.google.com", useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -718,7 +718,7 @@ public async Task CanCallTryGetBrowserCoreByIdWithOwnId() [Fact] public async Task CanCaptureScreenshotAsync() { - using (var browser = new ChromiumWebBrowser("http://www.google.com")) + using (var browser = new ChromiumWebBrowser("http://www.google.com", useLegacyRenderHandler:false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -756,7 +756,6 @@ public async Task CanCaptureScreenshotAsync() Assert.Equal(400, screenshot.Height); } - var result4 = await browser.CaptureScreenshotAsync(viewport: new Viewport { Width = 100, Height = 200, Scale = 1 }); Assert.Equal(1466, browser.Size.Width); Assert.Equal(968, browser.Size.Height); @@ -795,7 +794,6 @@ public async Task CanResizeWithDeviceScalingFactor() Assert.Equal(1200, screenshot.Height); } - await browser.ResizeAsync(400, 300); Assert.Equal(400, browser.Size.Width); @@ -808,7 +806,6 @@ public async Task CanResizeWithDeviceScalingFactor() Assert.Equal(600, screenshot.Height); } - await browser.ResizeAsync(1366, 768, 1); Assert.Equal(1366, browser.Size.Width); @@ -829,7 +826,7 @@ public async Task CanLoadMultipleBrowserInstancesSequentially() { for (int i = 0; i < 1000; i++) { - using (var browser = new ChromiumWebBrowser(new HtmlString("Testing"))) + using (var browser = new ChromiumWebBrowser(new HtmlString("Testing"), useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); diff --git a/CefSharp.Test/OffScreen/WaitForRenderIdleTests.cs b/CefSharp.Test/OffScreen/WaitForRenderIdleTests.cs index 78a3b9ecbf..fe32b4483d 100644 --- a/CefSharp.Test/OffScreen/WaitForRenderIdleTests.cs +++ b/CefSharp.Test/OffScreen/WaitForRenderIdleTests.cs @@ -27,7 +27,7 @@ public async Task ShouldWork() { const int expected = 500; - using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl)) + using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl, useLegacyRenderHandler:false)) { var start = DateTime.Now; await browser.WaitForRenderIdleAsync(); @@ -50,7 +50,7 @@ public async Task ShouldWorkForManualInvalidateCalls() { const int expected = 600; - using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl)) + using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl, useLegacyRenderHandler: false)) { var start = DateTime.Now; @@ -87,7 +87,7 @@ public async Task ShouldWorkForManualInvalidateCalls() [Fact] public async Task ShouldRespectTimeout() { - using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl)) + using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl, useLegacyRenderHandler: false)) { var exception = await Assert.ThrowsAsync(async () => { @@ -105,7 +105,7 @@ public async Task ShouldRespectCancellation() { using (var cancellationSource = new CancellationTokenSource()) - using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl)) + using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl, useLegacyRenderHandler: false)) { cancellationSource.CancelAfter(400); diff --git a/CefSharp.Test/PostMessage/IntegrationTestFacts.cs b/CefSharp.Test/PostMessage/IntegrationTestFacts.cs index 4b9d66b1a9..64e4a34727 100644 --- a/CefSharp.Test/PostMessage/IntegrationTestFacts.cs +++ b/CefSharp.Test/PostMessage/IntegrationTestFacts.cs @@ -49,7 +49,7 @@ public async Task JavascriptCustomEvent(string jsEventObject, string eventToRais //Load a dummy page initially so we can then add our script using //Page.AddScriptToEvaluateOnNewDocument (via DevTools) - using (var browser = new ChromiumWebBrowser(new HtmlString("Initial Load"))) + using (var browser = new ChromiumWebBrowser(new HtmlString("Initial Load"), useLegacyRenderHandler: false)) { await browser.WaitForInitialLoadAsync(); diff --git a/CefSharp.Test/SchemeHandler/FolderSchemeHandlerFactoryTests.cs b/CefSharp.Test/SchemeHandler/FolderSchemeHandlerFactoryTests.cs index e05fbc511a..6568c945f5 100644 --- a/CefSharp.Test/SchemeHandler/FolderSchemeHandlerFactoryTests.cs +++ b/CefSharp.Test/SchemeHandler/FolderSchemeHandlerFactoryTests.cs @@ -33,7 +33,7 @@ public async Task CanWork() const string expected = "https://folderschemehandlerfactory.test/"; using (var requestContext = new RequestContext(Cef.GetGlobalRequestContext())) - using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl, requestContext: requestContext)) + using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl, requestContext: requestContext, useLegacyRenderHandler: false)) { _ = await browser.WaitForInitialLoadAsync(); diff --git a/CefSharp.Test/Selector/WaitForSelectorAsyncTests.cs b/CefSharp.Test/Selector/WaitForSelectorAsyncTests.cs index e06ef8ddb1..0459ed2ba0 100644 --- a/CefSharp.Test/Selector/WaitForSelectorAsyncTests.cs +++ b/CefSharp.Test/Selector/WaitForSelectorAsyncTests.cs @@ -27,7 +27,7 @@ public async Task CanWork() { const string elementId = "newElement"; - using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl)) + using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl, useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -54,7 +54,7 @@ public async Task CanWorkForDelayedAction() { const string elementId = "newElement"; - using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl)) + using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl, useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -86,7 +86,7 @@ public async Task CanWorkForRemoved() { const string elementId = "content"; - using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl)) + using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl, useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -115,7 +115,7 @@ public async Task CanWorkForRemoved() [Fact] public async Task ShouldReturnTrueForRemovedNonExistingElement() { - using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl)) + using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl, useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -133,7 +133,7 @@ public async Task CanTimeout() { const string expected = "The operation has timed out."; - using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl)) + using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl, useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -156,7 +156,7 @@ public async Task ShouldTimeoutIfNavigationOccurs() const string expected = "The operation has timed out."; const string url = CefExample.HelloWorldUrl; - using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl)) + using (var browser = new ChromiumWebBrowser(CefExample.DefaultUrl, useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync(); @@ -182,7 +182,7 @@ public async Task ShouldRespondToNodeAttributeMutation() { var html = new HtmlString("
"); - using (var browser = new ChromiumWebBrowser(html)) + using (var browser = new ChromiumWebBrowser(html, useLegacyRenderHandler: false)) { var response = await browser.WaitForInitialLoadAsync();