From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../migration/tests/browser/browser_dialog_open.js | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 browser/components/migration/tests/browser/browser_dialog_open.js (limited to 'browser/components/migration/tests/browser/browser_dialog_open.js') diff --git a/browser/components/migration/tests/browser/browser_dialog_open.js b/browser/components/migration/tests/browser/browser_dialog_open.js new file mode 100644 index 0000000000..e332e1ed4d --- /dev/null +++ b/browser/components/migration/tests/browser/browser_dialog_open.js @@ -0,0 +1,55 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +/** + * Tests that we can open the migration dialog in an about:preferences + * HTML5 dialog when calling MigrationUtils.showMigrationWizard within a + * tabbrowser window execution context. + */ +add_task(async function test_migration_dialog_open_in_tab_dialog_box() { + let migrationDialogPromise = waitForMigrationWizardDialogTab(); + MigrationUtils.showMigrationWizard(window, {}); + let prefsBrowser = await migrationDialogPromise; + Assert.ok(true, "Migration dialog was opened"); + let dialog = prefsBrowser.contentDocument.querySelector( + "#migrationWizardDialog" + ); + + let dialogClosed = BrowserTestUtils.waitForEvent(dialog, "close"); + await BrowserTestUtils.synthesizeKey("VK_ESCAPE", {}, prefsBrowser); + await dialogClosed; + BrowserTestUtils.loadURIString(prefsBrowser, "about:blank"); + await BrowserTestUtils.browserLoaded(prefsBrowser); +}); + +/** + * Tests that we can open the migration dialog in a stand-alone window + * when calling MigrationUtils.showMigrationWizard with a null opener + * argument, or a non-tabbrowser window context. + */ +add_task(async function test_migration_dialog_open_in_xul_window() { + let firstWindowOpened = BrowserTestUtils.domWindowOpened(); + MigrationUtils.showMigrationWizard(null, {}); + let firstDialogWin = await firstWindowOpened; + + await BrowserTestUtils.waitForEvent(firstDialogWin, "MigrationWizard:Ready"); + + Assert.ok(true, "Migration dialog was opened"); + + // Now open a second migration dialog, using the first as the window + // argument. + + let secondWindowOpened = BrowserTestUtils.domWindowOpened(); + MigrationUtils.showMigrationWizard(firstDialogWin, {}); + let secondDialogWin = await secondWindowOpened; + + await BrowserTestUtils.waitForEvent(secondDialogWin, "MigrationWizard:Ready"); + + for (let dialogWin of [firstDialogWin, secondDialogWin]) { + let dialogClosed = BrowserTestUtils.domWindowClosed(dialogWin); + dialogWin.close(); + await dialogClosed; + } +}); -- cgit v1.2.3