Bug 1884426 - [4/6] Add test for file-picker crash notification r=Gijs,firefox-desktop-core-reviewers

Test that the file-picker-crashed notification appears when the
file-picker utility process is terminated with a file-picker dialog
active.

Differential Revision: https://phabricator.services.mozilla.com/D215980
This commit is contained in:
Ray Kraesig 2024-07-09 22:16:56 +00:00
parent b626761907
commit 491e97395e

View File

@ -94,11 +94,19 @@ function makeTask(description, Describe, action) {
// file dialog open to fail.
//
// (We shouldn't be running two such tests in parallel on the same Fx
// instance, but that's not obvious at this level.)
// instance, but it's not obvious at this level that we're not.)
ok(false, "another test has a file dialog open; aborting");
return;
}
// the file-picker-crashed notification should be shown after the process
// dies, but we must set up the listener before the notification is shown
let notificationAppeared = BrowserTestUtils.waitForNotificationBar(
gBrowser,
undefined,
"file-picker-crashed"
);
const { process, file } = openFileDialog();
const pid = await process;
const untilDead = untilChildProcessDead(pid);
@ -113,6 +121,10 @@ function makeTask(description, Describe, action) {
const delta = _after - _before;
info(`file callback resolved after ${description} after ${delta}ms`);
let notification = await notificationAppeared;
ok(notification, "file-picker notification should appear");
notification.close();
// depending on the test configuration, this may take some time while
// cleanup occurs
await untilDead;