From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../test/pageinfo/browser_pageinfo_image_info.js | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 browser/base/content/test/pageinfo/browser_pageinfo_image_info.js (limited to 'browser/base/content/test/pageinfo/browser_pageinfo_image_info.js') diff --git a/browser/base/content/test/pageinfo/browser_pageinfo_image_info.js b/browser/base/content/test/pageinfo/browser_pageinfo_image_info.js new file mode 100644 index 0000000000..374cd5f032 --- /dev/null +++ b/browser/base/content/test/pageinfo/browser_pageinfo_image_info.js @@ -0,0 +1,57 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + **/ + +const URI = + "data:text/html," + + "" + + "2" + + "2" + + "" + + "1" + + "2"; + +add_task(async function () { + let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, URI); + let browser = tab.linkedBrowser; + + let imageInfo = await SpecialPowers.spawn(browser, [], async () => { + let testImg = content.document.getElementById("test-image"); + + return { + src: testImg.src, + currentSrc: testImg.currentSrc, + width: testImg.width, + height: testImg.height, + imageText: testImg.title || testImg.alt, + }; + }); + + let pageInfo = BrowserPageInfo( + browser.currentURI.spec, + "mediaTab", + imageInfo + ); + await BrowserTestUtils.waitForEvent(pageInfo, "page-info-init"); + + let pageInfoImg = pageInfo.document.getElementById("thepreviewimage"); + await BrowserTestUtils.waitForEvent(pageInfoImg, "load"); + Assert.equal( + pageInfoImg.src, + imageInfo.src, + "selected image has the correct source" + ); + Assert.equal( + pageInfoImg.width, + imageInfo.width, + "selected image has the correct width" + ); + Assert.equal( + pageInfoImg.height, + imageInfo.height, + "selected image has the correct height" + ); + pageInfo.close(); + BrowserTestUtils.removeTab(tab); +}); -- cgit v1.2.3