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 --- .../browser/message-reader/browser_androidMMS.js | 75 ++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 comm/mail/test/browser/message-reader/browser_androidMMS.js (limited to 'comm/mail/test/browser/message-reader/browser_androidMMS.js') diff --git a/comm/mail/test/browser/message-reader/browser_androidMMS.js b/comm/mail/test/browser/message-reader/browser_androidMMS.js new file mode 100644 index 0000000000..bde6dbbbf0 --- /dev/null +++ b/comm/mail/test/browser/message-reader/browser_androidMMS.js @@ -0,0 +1,75 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/** + * Tests that opening a message with bad Content-Location is able to show + * images correctly. + * The test messsage has a bad Content-Location. This should not prevent + * the html part from referring to the image parts by cid: correctly. + */ + +"use strict"; + +var { get_about_message, open_message_from_file } = ChromeUtils.import( + "resource://testing-common/mozmill/FolderDisplayHelpers.jsm" +); +var { close_window } = ChromeUtils.import( + "resource://testing-common/mozmill/WindowHelpers.jsm" +); + +add_task(async function testMMS() { + let file = new FileUtils.File( + getTestFilePath("data/bug1774805_android_mms.eml") + ); + let msgc = await open_message_from_file(file); + + let imgs = msgc.window.content.document.querySelectorAll("img"); + // There are dottedline600.gif, tbmobilespace.gif x 3, footer.gif. + Assert.equal(imgs.length, 5, "body should show all images"); + + let lines = msgc.window.content.document.querySelectorAll( + `img[src$="dottedline600.gif"]` + ); + Assert.equal(lines.length, 1, "should have one dottedline600.gif"); + + let spacers = msgc.window.content.document.querySelectorAll( + `img[src$="tmobilespace.gif"]` + ); + Assert.equal(spacers.length, 3, "should have three tmobilespace.gif"); + + let footer = msgc.window.content.document.querySelectorAll( + `img[src$="footer.gif"]` + ); + Assert.equal(footer.length, 1, "should have one footer.gif"); + + for (var img of imgs) { + Assert.ok( + !img.matches(":-moz-broken"), + `img should not show broken: ${img.src}` + ); + Assert.ok( + img.naturalWidth > 0, + `img should have natural width: ${img.src}` + ); + } + + Assert.ok( + msgc.window.content.document.body.textContent.includes( + "This is a sample SMS text to email" + ), + "Body should have the right text" + ); + + let aboutMessage = get_about_message(msgc.window); + let attachmentList = aboutMessage.document.getElementById("attachmentList"); + Assert.equal( + attachmentList.childNodes.length, + 1, + "should have one attachment" + ); + + close_window(msgc); +}); -- cgit v1.2.3