diff options
Diffstat (limited to 'devtools/client/performance-new/test/browser/browser_popup-private-browsing.js')
-rw-r--r-- | devtools/client/performance-new/test/browser/browser_popup-private-browsing.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/devtools/client/performance-new/test/browser/browser_popup-private-browsing.js b/devtools/client/performance-new/test/browser/browser_popup-private-browsing.js new file mode 100644 index 0000000000..ad9b84cbcf --- /dev/null +++ b/devtools/client/performance-new/test/browser/browser_popup-private-browsing.js @@ -0,0 +1,48 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +add_task(async function test() { + info( + "Test that the profiler popup gets disabled when a private browsing window is open." + ); + await makeSureProfilerPopupIsEnabled(); + + const getRecordingButton = () => + getElementByLabel(document, "Start Recording"); + + const getDisabledMessage = () => + getElementFromDocumentByText( + document, + "The profiler is currently disabled" + ); + + await withPopupOpen(window, async () => { + ok(await getRecordingButton(), "The start recording button is available"); + }); + + info("Open a private browsing window."); + const privateWindow = await BrowserTestUtils.openNewBrowserWindow({ + private: true, + }); + + info("Switch back to the main window and open the popup again."); + window.focus(); + await withPopupOpen(window, async () => { + ok(await getDisabledMessage(), "The disabled message is displayed."); + }); + + info("Close the private window"); + await BrowserTestUtils.closeWindow(privateWindow); + + info("Make sure the first window is focused, and open the popup back up."); + window.focus(); + await withPopupOpen(window, async () => { + ok( + await getRecordingButton(), + "The start recording button is available once again." + ); + }); +}); |