Bug 674770 part.2 Fix new test_bug597331.html failure and test_bug600570.html failur on Windows r=ehsan
authorMasayuki Nakano <masayuki@d-toybox.com>
Sat, 26 Nov 2011 13:51:48 +0900
changeset 82442 1a9cc49f9cf1276defa2726c8849d1d83c1780d5
parent 82441 dad793c1b1437c83315fda28289228767a0a7a92
child 82443 1ab2c7d4c91d27a7d60be36016286077ce640930
push id519
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 00:38:35 +0000
treeherdermozilla-beta@788ea1ef610b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs674770, 597331, 600570
milestone11.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 674770 part.2 Fix new test_bug597331.html failure and test_bug600570.html failur on Windows r=ehsan
editor/libeditor/text/tests/test_bug597331.html
editor/libeditor/text/tests/test_bug600570.html
--- a/editor/libeditor/text/tests/test_bug597331.html
+++ b/editor/libeditor/text/tests/test_bug597331.html
@@ -20,44 +20,51 @@ line3
 </textarea>
 </div>
 <pre id="test">
 <script type="application/javascript">
 
 /** Test for Bug 597331 **/
 SimpleTest.waitForExplicitFinish();
 addLoadEvent(function() {
-  var t = document.querySelector("textarea");
-  t.focus();
-  t.selectionStart = 4;
-  t.selectionEnd = 4;
   SimpleTest.executeSoon(function() {
-    var before = snapshotWindow(window, true);
-    t.selectionStart = 5;
-    t.selectionEnd = 5;
-    t.addEventListener("keydown", function() {
-      t.removeEventListener("keydown", arguments.callee, false);
+    var t = document.querySelector("textarea");
+    t.focus();
+    t.selectionStart = 4;
+    t.selectionEnd = 4;
+    SimpleTest.executeSoon(function() {
+      var before = snapshotWindow(window, true);
+      t.selectionStart = 5;
+      t.selectionEnd = 5;
+      t.addEventListener("keydown", function() {
+        t.removeEventListener("keydown", arguments.callee, false);
+
+        SimpleTest.executeSoon(function() {
+          t.style.display = 'block';
+          document.body.offsetWidth;
+          t.style.display = '';
+          document.body.offsetWidth;
 
-      SimpleTest.executeSoon(function() {
-        t.style.display = 'block';
-        document.body.offsetWidth;
-        t.style.display = '';
-        document.body.offsetWidth;
+          is(t.selectionStart, 4, "Cursor should be moved correctly");
+          is(t.selectionEnd, 4, "Cursor should be moved correctly");
 
-        is(t.selectionStart, 4, "Cursor should be moved correctly");
-        is(t.selectionEnd, 4, "Cursor should be moved correctly");
+          var after = snapshotWindow(window, true);
 
-        var after = snapshotWindow(window, true);
-
-        var result = compareSnapshots(before, after, true);
-        ok(result[0], "The caret should be displayed correctly after reframing");
+          var result = compareSnapshots(before, after, true);
+          var msg = "The caret should be displayed correctly after reframing";
+          if (!result[0]) {
+            msg += "\nRESULT:\n" + result[2];
+            msg += "\nREFERENCE:\n" + result[1];
+          }
+          ok(result[0], msg);
 
-        SimpleTest.finish();
-      });
-    }, false);
-    synthesizeKey("VK_LEFT", {});
+          SimpleTest.finish();
+        });
+      }, false);
+      synthesizeKey("VK_LEFT", {});
+    });
   });
 });
 
 </script>
 </pre>
 </body>
 </html>
--- a/editor/libeditor/text/tests/test_bug600570.html
+++ b/editor/libeditor/text/tests/test_bug600570.html
@@ -25,49 +25,55 @@ aaa
 
 SimpleTest.waitForExplicitFinish();
 SimpleTest.waitForFocus(function() {
   var t = document.querySelector("textarea");
   t.value = "[aaa\nbbb]";
   t.focus();
   synthesizeKey("A", {accelKey: true});
 
-  var afterSetValue = snapshotWindow(window);
+  SimpleTest.executeSoon(function() {
+    var afterSetValue = snapshotWindow(window);
 
-  t.value = t.defaultValue;
+    t.value = t.defaultValue;
 
-  t.selectionStart = 0;
-  t.selectionEnd = 4;
-  SimpleTest.waitForClipboard("aaa\n",
-    function() {
-      synthesizeKey("X", {accelKey: true});
-    },
-    function() {
-      t.addEventListener("input", function() {
-        t.removeEventListener("input", arguments.callee, false);
+    t.selectionStart = 0;
+    t.selectionEnd = 4;
+    SimpleTest.waitForClipboard("aaa\n",
+      function() {
+        synthesizeKey("X", {accelKey: true});
+      },
+      function() {
+        t.addEventListener("input", function() {
+          t.removeEventListener("input", arguments.callee, false);
+
+          setTimeout(function() { // Avoid the assertion in bug 649797
+            is(t.value, "[aaa\nbbb]", "The value of the textarea should be correct");
+            synthesizeKey("A", {accelKey: true});
+            is(t.selectionStart, 0, "Select all should set the selection start to the beginning of textarea");
+            is(t.selectionEnd, 9, "Select all should set the selection end to the end of textarea");
 
-        setTimeout(function() { // Avoid the assertion in bug 649797
-          is(t.value, "[aaa\nbbb]", "The value of the textarea should be correct");
-          synthesizeKey("A", {accelKey: true});
-          is(t.selectionStart, 0, "Select all should set the selection start to the beginning of textarea");
-          is(t.selectionEnd, 9, "Select all should set the selection end to the end of textarea");
+            var afterPaste = snapshotWindow(window);
 
-          var afterPaste = snapshotWindow(window);
-
-          var res = compareSnapshots(afterSetValue, afterPaste, true);
-          ok(res[0], "Pasting and setting the value directly should result in the same rendering");
+            var res = compareSnapshots(afterSetValue, afterPaste, true);
+            var msg = "Pasting and setting the value directly should result in the same rendering";
+            if (!res[0]) {
+              msg += "\nRESULT:\n" + res[2] + "\nREFERENCE:\n" + res[1];
+            }
+            ok(res[0], msg);
 
-          SimpleTest.finish();
-        }, 0);
-      }, false);
-      synthesizeKey("VK_RIGHT", {});
-      synthesizeKey("V", {accelKey: true});
-    },
-    function() {
-      SimpleTest.finish();
-    }
-  );
+            SimpleTest.finish();
+          }, 0);
+        }, false);
+        synthesizeKey("VK_RIGHT", {});
+        synthesizeKey("V", {accelKey: true});
+      },
+      function() {
+        SimpleTest.finish();
+      }
+    );
+  });
 });
 
 </script>
 </pre>
 </body>
 </html>