browser_domFS_statuspanel.js (2787B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 /* Tests that the status panel gets cleared when entering DOM fullscreen 7 * (bug 1850993), and that we don't show network statuses in DOM fullscreen 8 * (bug 1853896). */ 9 10 let statuspanel = document.getElementById("statuspanel"); 11 let statuspanelLabel = document.getElementById("statuspanel-label"); 12 13 async function withDomFsTab(beforeEnter, afterEnter) { 14 let url = "https://example.com/"; 15 let tab = await BrowserTestUtils.openNewForegroundTab( 16 gBrowser, 17 url, 18 true, 19 true 20 ); 21 let browser = tab.linkedBrowser; 22 23 await beforeEnter(); 24 info("Entering DOM fullscreen"); 25 await DOMFullscreenTestUtils.changeFullscreen(browser, true); 26 is(document.fullscreenElement, browser, "Entered DOM fullscreen"); 27 await afterEnter(); 28 29 await BrowserTestUtils.removeTab(tab); 30 } 31 32 add_setup(async function () { 33 await SpecialPowers.pushPrefEnv({ 34 set: [["test.wait300msAfterTabSwitch", true]], 35 }); 36 }); 37 38 add_task(async function test_overlink() { 39 const overlink = "https://example.com"; 40 let setAndCheckOverLink = async info => { 41 XULBrowserWindow.setOverLink(overlink); 42 await TestUtils.waitForCondition( 43 () => BrowserTestUtils.isVisible(statuspanel), 44 `statuspanel should become visible after setting overlink ${info}` 45 ); 46 is( 47 statuspanelLabel.value, 48 BrowserUIUtils.trimURL(overlink), 49 `statuspanel has expected value after setting overlink ${info}` 50 ); 51 }; 52 await withDomFsTab( 53 async function () { 54 await setAndCheckOverLink("outside of DOM FS"); 55 }, 56 async function () { 57 await TestUtils.waitForCondition( 58 () => !BrowserTestUtils.isVisible(statuspanel), 59 "statuspanel with overlink should hide when entering DOM FS" 60 ); 61 await setAndCheckOverLink("while in DOM FS"); 62 } 63 ); 64 }); 65 66 add_task(async function test_networkstatus() { 67 await withDomFsTab( 68 async function () { 69 XULBrowserWindow.status = "test1"; 70 XULBrowserWindow.busyUI = true; 71 StatusPanel.update(); 72 ok( 73 BrowserTestUtils.isVisible(statuspanel), 74 "statuspanel is visible before entering DOM FS" 75 ); 76 is(statuspanelLabel.value, "test1", "statuspanel has expected value"); 77 }, 78 async function () { 79 is( 80 XULBrowserWindow.busyUI, 81 true, 82 "browser window still considered busy (i.e. loading stuff) when entering DOM FS" 83 ); 84 is( 85 XULBrowserWindow.status, 86 "", 87 "network status cleared when entering DOM FS" 88 ); 89 ok( 90 !BrowserTestUtils.isVisible(statuspanel), 91 "statuspanel with network status should should hide when entering DOM FS" 92 ); 93 } 94 ); 95 });