diff options
Diffstat (limited to 'browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize_bottom.js')
-rw-r--r-- | browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize_bottom.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize_bottom.js b/browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize_bottom.js new file mode 100644 index 0000000000..3370be0053 --- /dev/null +++ b/browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize_bottom.js @@ -0,0 +1,39 @@ +/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set sts=2 sw=2 et tw=80: */ +"use strict"; + +loadTestSubscript("head_browserAction.js"); + +// Test that we still make reasonable maximum size calculations when the window +// is close enough to the bottom of the screen that the menu panel opens above, +// rather than below, its button. +add_task(async function testBrowserActionMenuResizeBottomArrow() { + const WIDTH = 800; + const HEIGHT = 80; + + let left = screen.availLeft + screen.availWidth - WIDTH; + let top = screen.availTop + screen.availHeight - HEIGHT; + + let win = await BrowserTestUtils.openNewBrowserWindow(); + + win.resizeTo(WIDTH, HEIGHT); + + // Sometimes we run into problems on Linux with resizing being asynchronous + // and window managers not allowing us to move the window so that any part of + // it is off-screen, so we need to try more than once. + for (let i = 0; i < 20; i++) { + win.moveTo(left, top); + + if (win.screenX == left && win.screenY == top) { + break; + } + + await delay(100); + } + + await SimpleTest.promiseFocus(win); + + await testPopupSize(true, win, "bottom"); + + await BrowserTestUtils.closeWindow(win); +}); |