browser_fullscreen_enterInUrlbar.js (2000B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 // This test makes sure that when the user presses enter in the urlbar in full 5 // screen, the toolbars are hidden. This should not be run on macOS because we 6 // don't hide the toolbars there. 7 8 "use strict"; 9 10 ChromeUtils.defineESModuleGetters(this, { 11 UrlbarTestUtils: "resource://testing-common/UrlbarTestUtils.sys.mjs", 12 }); 13 14 add_task(async function test() { 15 await BrowserTestUtils.withNewTab("about:blank", async () => { 16 // Do the View:FullScreen command and wait for the transition. 17 let onFullscreen = BrowserTestUtils.waitForEvent(window, "fullscreen"); 18 document.getElementById("View:FullScreen").doCommand(); 19 await onFullscreen; 20 21 // Do the Browser:OpenLocation command to show the nav toolbox and focus 22 // the urlbar. 23 let onToolboxShown = TestUtils.topicObserved( 24 "fullscreen-nav-toolbox", 25 (subject, data) => data == "shown" 26 ); 27 document.getElementById("Browser:OpenLocation").doCommand(); 28 info("Waiting for the nav toolbox to be shown"); 29 await onToolboxShown; 30 31 // Enter a URL. 32 await UrlbarTestUtils.promiseAutocompleteResultPopup({ 33 window, 34 // eslint-disable-next-line @microsoft/sdl/no-insecure-url 35 value: "http://example.com/", 36 waitForFocus: SimpleTest.waitForFocus, 37 fireInputEvent: true, 38 }); 39 40 // Press enter and wait for the nav toolbox to be hidden. 41 let onToolboxHidden = TestUtils.topicObserved( 42 "fullscreen-nav-toolbox", 43 (subject, data) => data == "hidden" 44 ); 45 EventUtils.synthesizeKey("KEY_Enter"); 46 info("Waiting for the nav toolbox to be hidden"); 47 await onToolboxHidden; 48 49 Assert.ok(true, "Nav toolbox hidden"); 50 51 info("Waiting for exiting from the fullscreen mode..."); 52 onFullscreen = BrowserTestUtils.waitForEvent(window, "fullscreen"); 53 document.getElementById("View:FullScreen").doCommand(); 54 await onFullscreen; 55 }); 56 });