Bug 1119503 - Part 3: Change test_aboutmemory*.xul in order to not expect a newline at the very end of the copied text; r=njn
authorEhsan Akhgari <ehsan@mozilla.com>
Sun, 18 Jan 2015 08:28:13 -0500
changeset 239626 996ff2931452f8748a756dcafdf8e4f05b3903e2
parent 239625 5bf4e1018997bb3628ffc3178f12d34ae4f24b07
child 239627 dcaf823a0a0a572811644de987348b0a887f4ead
push id500
push userjoshua.m.grant@gmail.com
push dateThu, 29 Jan 2015 01:48:36 +0000
reviewersnjn
bugs1119503
milestone38.0a1
Bug 1119503 - Part 3: Change test_aboutmemory*.xul in order to not expect a newline at the very end of the copied text; r=njn After the patches in this bug, we only inject a newline at block element boundaries. In order to get these tests to pass, we just compare the trimmed version of the actual and expected tests.
toolkit/components/aboutmemory/tests/test_aboutmemory.xul
toolkit/components/aboutmemory/tests/test_aboutmemory2.xul
toolkit/components/aboutmemory/tests/test_aboutmemory3.xul
toolkit/components/aboutmemory/tests/test_aboutmemory4.xul
--- a/toolkit/components/aboutmemory/tests/test_aboutmemory.xul
+++ b/toolkit/components/aboutmemory/tests/test_aboutmemory.xul
@@ -562,17 +562,17 @@ End of 5th\n\
       let measureButton = doc.getElementById("measureButton");
       let verbose = doc.getElementById("verbose");
       verbose.checked = aVerbose;
       measureButton.click();
 
       SimpleTest.waitForClipboard(
         function(aActual) {
           mostRecentActual = aActual;
-          return aActual === aExpected;
+          return aActual.trim() === aExpected.trim();
         },
         function() {
           synthesizeKey("A", {accelKey: true});
           synthesizeKey("C", {accelKey: true});
         },
         aNext,
         function() {
           ok(false, "pasted text doesn't match for " + aFrameId);
--- a/toolkit/components/aboutmemory/tests/test_aboutmemory2.xul
+++ b/toolkit/components/aboutmemory/tests/test_aboutmemory2.xul
@@ -101,17 +101,17 @@
     }
 
     SimpleTest.executeSoon(function() {
       let mostRecentActual;
       document.getElementById("amFrame").focus();
       SimpleTest.waitForClipboard(
         function(aActual) {
           mostRecentActual = aActual;
-          return aActual === aExpected;
+          return aActual.trim() === aExpected.trim();
         },
         function() {
           synthesizeKey("A", {accelKey: true});
           synthesizeKey("C", {accelKey: true});
         },
         aNext,
         function() {
           ok(false, "pasted text doesn't match");
--- a/toolkit/components/aboutmemory/tests/test_aboutmemory3.xul
+++ b/toolkit/components/aboutmemory/tests/test_aboutmemory3.xul
@@ -101,17 +101,17 @@
       function copyPasteAndCheck() {
         // Copy and paste frame contents, and filter out non-deterministic
         // differences.
         synthesizeKey("A", {accelKey: true});
         synthesizeKey("C", {accelKey: true});
         let actual = SpecialPowers.getClipboardData("text/unicode");
         actual = actual.replace(/\(pid \d+\)/g, "(pid NNN)");
 
-        if (actual === aExpected) {
+        if (actual.trim() === aExpected.trim()) {
           SimpleTest.ok(true, "Clipboard has the expected contents");
           aNext();
         } else {
           numFailures++;
           if (numFailures === maxFailures) {
             ok(false, "pasted text doesn't match");
             dump("******EXPECTED******\n");
             dump(aExpected);
--- a/toolkit/components/aboutmemory/tests/test_aboutmemory4.xul
+++ b/toolkit/components/aboutmemory/tests/test_aboutmemory4.xul
@@ -49,17 +49,17 @@
     function copyPasteAndCheck() {
       // Copy and paste frame contents, and filter out non-deterministic
       // differences.
       synthesizeKey("A", {accelKey: true});
       synthesizeKey("C", {accelKey: true});
       let actual = SpecialPowers.getClipboardData("text/unicode");
       actual = actual.replace(/\(pid \d+\)/, "(pid NNN)");
 
-      if (actual === aExpected) {
+      if (actual.trim() === aExpected.trim()) {
         SimpleTest.ok(true, "Clipboard has the expected contents");
         aNext();
       } else {
         numFailures++;
         if (numFailures === maxFailures) {
           ok(false, "pasted text doesn't match");
           dump("******EXPECTED******\n");
           dump(aExpected);