1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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);
});
|