Skip to content

Commit

Permalink
https://github.com/cefsharp/CefSharp/issues/4621
Browse files Browse the repository at this point in the history
New test to mimic issue cefsharp#4621 where isolate-origins settings does not help.
  • Loading branch information
nebojsasandin committed Mar 27, 2024
1 parent 6cb2e07 commit 78073d8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions CefSharp.Test/CefSharpFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ private void CefInitialize()
settings.RootCachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CefSharp\\Tests");
//settings.CefCommandLineArgs.Add("renderer-startup-dialog");
//settings.CefCommandLineArgs.Add("disable-site-isolation-trials");
settings.CefCommandLineArgs.Add("isolate-origins", "https://accounts.google.com,https://chrome.google.com,https://chromewebstore.google.com,https://mail.google.com,https://www.google.com,https://google.com");

var success = Cef.Initialize(settings, performDependencyCheck: false, browserProcessHandler: null);

Expand Down
18 changes: 18 additions & 0 deletions CefSharp.Test/OffScreen/OffScreenBrowserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,24 @@ public async Task GoogleSearchToGoogleAccountsBreaksJS()
}
}

[Fact]
public async Task GoogleSearchToGmailBreaksJS()
{
using (var browser = new ChromiumWebBrowser("www.google.com", useLegacyRenderHandler: false))
{
var response = await browser.WaitForInitialLoadAsync();

browser.Load("https://mail.google.com/mail/&ogbl");
var nav = await browser.WaitForNavigationAsync();
Assert.True(nav.Success);
Assert.Equal(200, nav.HttpStatusCode);
var mainFrame = browser.GetMainFrame();
Assert.True(mainFrame.IsValid);
var buttonText = await mainFrame.EvaluateScriptAsync<string>("(function() { return document.querySelector(\"a[data-action='sign in']\").innerText; })();");
Assert.Equal("Sign in", buttonText);
}
}

[Theory]
[InlineData("http://httpbin.org/post")]
public async Task ShouldWorkWhenLoadingRequestWithPostData(string url)
Expand Down

0 comments on commit 78073d8

Please sign in to comment.