Bug 1419417 - adjust test expectancy. r=mkmelin,BenB
authorJorg K <jorgk@jorgk.com>
Mon, 21 May 2018 18:48:59 +0200
changeset 23965 a2472fbf9a2c
parent 23964 96fab4a2b811
child 23966 d16fff497d40
push id14450
push usermozilla@jorgk.com
push dateMon, 21 May 2018 16:57:08 +0000
treeherdercomm-central@d16fff497d40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin, BenB
bugs1419417
Bug 1419417 - adjust test expectancy. r=mkmelin,BenB
mailnews/db/gloda/test/unit/test_mime_attachments_size.js
mailnews/db/gloda/test/unit/test_mime_emitter.js
--- a/mailnews/db/gloda/test/unit/test_mime_attachments_size.js
+++ b/mailnews/db/gloda/test/unit/test_mime_attachments_size.js
@@ -211,16 +211,19 @@ function check_attachments(aMimeMsg, eps
   for (let att of aMimeMsg.allUserAttachments) {
     dump("*** Attachment now is " + att.name + " " + att.size + "\n");
     Assert.ok(Math.abs(att.size - originalTextByteCount) <= epsilon);
     totalSize += att.size;
   }
 
   // undefined means true
   if (checkTotalSize !== false) {
+    // Account for stuff added by libmime, incl. two CRLF or LF before and after.
+    totalSize += "<meta http-equiv=\"content-type\" content=\"text\/html; \">".length;
+    totalSize += ("@mozilla.org/windows-registry-key;1" in Cc) ? 4 : 2;
     dump("*** Total size comparison: " + totalSize + " vs " + aMimeMsg.size + "\n");
     Assert.ok(Math.abs(aMimeMsg.size - totalSize) <= epsilon);
   }
 
   async_driver();
 }
 
 function* test_message_attachments(info) {
--- a/mailnews/db/gloda/test/unit/test_mime_emitter.js
+++ b/mailnews/db/gloda/test/unit/test_mime_emitter.js
@@ -335,17 +335,21 @@ function verify_body_part_equivalence(aS
                    deathToNewlineTypeThings, ""),
                  aMimePart.get("content-type").replace(
                    deathToNewlineTypeThings, ""));
 
   // XXX body part checking will get brittle if we ever actually encode things!
   if (aSynBodyPart.body && !aSynBodyPart._filename &&
       aSynBodyPart._contentType.startsWith("text/"))
     Assert.equal(synTransformBody(aSynBodyPart),
-                 aMimePart.body.trim().replace(/\r/g, ""));
+                 aMimePart.body.trim().replace(/\r/g, "")
+                 // Remove stuff added by libmime for HTML parts.
+                 .replace(/[\n]*<meta http-equiv="content-type" content="text\/html; .*">[\n]*/g, "")
+                 .replace(/[\n]+<\/body>/, "</body>")
+                );
   if (aSynBodyPart.parts) {
     let iPart;
     let realPartOffsetCompensator = 0;
     for (iPart = 0; iPart < aSynBodyPart.parts.length; iPart++) {
       let subSyn = aSynBodyPart.parts[iPart];
       // If this is a degenerate empty, it should not produce output, so
       //  compensate for the offset drift and get on with our lives.
       if (subSyn instanceof SyntheticDegeneratePartEmpty) {