Commit bcb53c0c authored by Lukasz Anforowicz's avatar Lukasz Anforowicz Committed by Commit Bot

Remove WebAuthBrowserTest...Client::DoesSiteRequireDedicatedProcess.

Why remove DoesSiteRequireDedicatedProcess
==========================================

This CL removes
ShellContentBrowserClient::DoesSiteRequireDedicatedProcess.  We plan
to remove 2 other overrides of this ContentBrowserClient method in
other CLs.  We want to remove this ContentBrowserClient method
altogether, because
1) it is currently the only reason
   SiteInstanceImpl::DetermineProcessLockURL needs to take
   BrowserContext* as an argument (and therefore is problematic on
   threads other than UI thread)
2) the method was initially introduced to support --isolate-extensions
   which has been obsolete since shipping --site-per-process in M67.


Removal mechanics
=================

agl@ (original author of the test) suggested to simply remove
WebAuthJavascriptClientBrowserTest.RegisterDuringUnload for now.


Change-Id: I5aeb3b113de642ef96d7a9abc35d0e9c42c45f86
Bug: 898281
Reviewed-on: https://chromium-review.googlesource.com/c/1308256
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: default avatarCharlie Reis <creis@chromium.org>
Reviewed-by: default avatarAdam Langley <agl@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605102}
parent 86e38f59
......@@ -229,10 +229,6 @@ struct WebAuthBrowserTestState {
// Set when |IsFocused| is called.
bool focus_checked = false;
// If true, request a new render process for each site (i.e. site isolation).
// Otherwise have the default behaviour for |ContentBrowserClient|.
bool force_new_render_processes = false;
// This is incremented when an |AuthenticatorRequestClientDelegate| is
// created.
int delegate_create_count = 0;
......@@ -277,24 +273,6 @@ class WebAuthBrowserTestContentBrowserClient : public ContentBrowserClient {
return std::make_unique<WebAuthBrowserTestClientDelegate>(test_state_);
}
bool ShouldUseProcessPerSite(BrowserContext* browser_context,
const GURL& effective_url) override {
if (test_state_->force_new_render_processes) {
return true;
}
return ContentBrowserClient::ShouldUseProcessPerSite(browser_context,
effective_url);
}
bool DoesSiteRequireDedicatedProcess(BrowserContext* browser_context,
const GURL& effective_url) override {
if (test_state_->force_new_render_processes) {
return true;
}
return ContentBrowserClient::DoesSiteRequireDedicatedProcess(
browser_context, effective_url);
}
private:
WebAuthBrowserTestState* const test_state_;
......@@ -964,45 +942,6 @@ IN_PROC_BROWSER_TEST_F(WebAuthJavascriptClientBrowserTest,
}
}
IN_PROC_BROWSER_TEST_F(WebAuthJavascriptClientBrowserTest,
RegisterDuringUnload) {
// Request new render processes for each site in order to test concurrent
// unloading with a different RenderFrame showing the new page.
test_state()->force_new_render_processes = true;
NavigateToURL(shell(), GetHttpsURL("www.acme.com", "/title1.html"));
const std::string script = base::ReplaceStringPlaceholders(
R"(
window.addEventListener('unload', function(e) {
$1
});
// Trigger a webauthn operation so that the bindings are established
// before unload.
navigator.credentials.get({ publicKey: {
challenge: new TextEncoder().encode('climb a mountain'),
timeout: 1,
}}).catch(c => window.location = '$2');
)",
{BuildCreateCallWithParameters(CreateParameters()),
GetHttpsURL("www.acme2.com", "/title2.html").spec()},
nullptr);
RenderFrameHost* render_frame_host = shell()->web_contents()->GetMainFrame();
RenderFrameDeletedObserver observer(render_frame_host);
render_frame_host->ExecuteJavaScriptForTests(base::UTF8ToUTF16(script));
observer.WaitUntilDeleted();
// The |MakeCredential| call from the unload handler should not have reached
// the point where focus was checked.
EXPECT_FALSE(test_state()->focus_checked);
// Two delegates should have been created: one for the GetAssertion call that
// primes the binding and a second for the MakeCredential call in the unload
// handler.
ASSERT_EQ(2, test_state()->delegate_create_count);
}
// WebAuthBrowserCtapTest ----------------------------------------------
class WebAuthBrowserCtapTest : public WebAuthLocalClientBrowserTest {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment