Commit 1b3c1be9 authored by Katie Dillon's avatar Katie Dillon Committed by Commit Bot

Add field trial config for HighPriorityBeforeUnload.

Change-Id: Ia274d2e51503514c3fc98420fa4eee5eb040e1fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2490782
Commit-Queue: Katie Dillon <kdillon@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826894}
parent ed4303f5
......@@ -716,8 +716,9 @@ IN_PROC_BROWSER_TEST_F(BrowserCloseManagerBrowserTest,
AddBlankTabAndShow(browsers_[1]);
ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
browsers_[1], embedded_test_server()->GetURL("/beforeunload.html")));
PrepareForDialog(browsers_[0]);
PrepareForDialog(browsers_[1]);
// Prep the new tabs for dialog to ensure the beforeunload dialog will show.
PrepareForDialog(browsers_[0]->tab_strip_model()->GetWebContentsAt(1));
PrepareForDialog(browsers_[1]->tab_strip_model()->GetWebContentsAt(1));
ASSERT_NO_FATAL_FAILURE(AcceptClose());
ASSERT_NO_FATAL_FAILURE(CancelClose());
cancel_observer.Wait();
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
onload = function() {
window.addEventListener('DOMContentLoaded', () => {
var port = location.search.substr(1);
var redirect =
"http://127.0.0.1:" + port + "/server-redirect";
......@@ -14,4 +14,4 @@ onload = function() {
link.download = "somefile.txt";
document.body.appendChild(link);
link.click();
};
});
......@@ -743,8 +743,13 @@ bool WaitForLoadStop(WebContents* web_contents) {
void PrepContentsForBeforeUnloadTest(WebContents* web_contents,
bool trigger_user_activation) {
for (auto* frame : web_contents->GetAllFrames()) {
if (trigger_user_activation)
frame->ExecuteJavaScriptWithUserGestureForTests(base::string16());
if (trigger_user_activation && frame->IsRenderFrameLive()) {
// Execute script with user interaction to prep the page to show
// before unload dialog if needed. Must wait on a response from the
// renderer before proceeding to ensure the page has been interacted with.
ExecuteScriptWithUserGestureControl(frame, std::string(), true);
}
// Disable the hang monitor, otherwise there will be a race between the
// beforeunload dialog and the beforeunload hang timer.
......
......@@ -1098,6 +1098,26 @@
]
}
],
"BlinkSchedulerHighPriorityBeforeUnload": [
{
"platforms": [
"android",
"android_webview",
"chromeos",
"linux",
"mac",
"windows"
],
"experiments": [
{
"name": "Enabled",
"enable_features": [
"HighPriorityBeforeUnload"
]
}
]
}
],
"BlinkSchedulerPerAgentSchedulingStudy": [
{
"platforms": [
......
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