browser_test_tabpanels.js (1501B)
1 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */ 2 /* vim: set sts=2 sw=2 et tw=80: */ 3 /* This test is based on 4 https://searchfox.org/mozilla-central/rev/380b8fd795e7d96d8a5a3e6ec2b50a9f2b65854a/layout/base/tests/browser_test_oopif_reconstruct.js 5 */ 6 7 "use strict"; 8 9 Services.scriptloader.loadSubScript( 10 "chrome://mochitests/content/browser/gfx/layers/apz/test/mochitest/apz_test_utils.js", 11 this 12 ); 13 14 async function runOneTest(filename) { 15 function chromeURL(sfilename) { 16 let result = getRootDirectory(gTestPath) + sfilename; 17 return result; 18 } 19 20 const url = chromeURL(filename); 21 const tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url); 22 23 const { rect } = await SpecialPowers.spawn( 24 tab.linkedBrowser, 25 [], 26 async () => { 27 const container = content.document.documentElement; 28 29 // Get the area in the screen coords of the tab. 30 let containerRect = container.getBoundingClientRect(); 31 containerRect.x += content.window.mozInnerScreenX; 32 containerRect.y += content.window.mozInnerScreenY; 33 34 return { 35 rect: containerRect, 36 }; 37 } 38 ); 39 40 const reference = await getSnapshot({ 41 x: rect.x, 42 y: rect.y, 43 width: rect.width, 44 height: rect.height, 45 }); 46 47 BrowserTestUtils.removeTab(tab); 48 return reference; 49 } 50 51 add_task(async () => { 52 let snapshot1 = await runOneTest("470711-1.xhtml"); 53 let snapshot2 = await runOneTest("470711-1-ref.xhtml"); 54 is(snapshot1, snapshot1, "should be same"); 55 });