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.
--- 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);