Tests for bug 632215; r=roc a=blocking-final+
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 10 Feb 2011 16:23:09 -0500
changeset 62306 7573d51778309110084e9cde781e0a27ab7c43a6
parent 62305 3eaad34067e4003449252176acfb893b613c5e33
child 62307 3ce0b8db2ebb198ff7b46304fe670c05738c7126
push idunknown
push userunknown
push dateunknown
reviewersroc, blocking-final
bugs632215
milestone2.0b12pre
Tests for bug 632215; r=roc a=blocking-final+
layout/base/tests/Makefile.in
layout/base/tests/bug632215-1.html
layout/base/tests/bug632215-2.html
layout/base/tests/bug632215-ref.html
layout/base/tests/test_reftests_with_caret.html
--- a/layout/base/tests/Makefile.in
+++ b/layout/base/tests/Makefile.in
@@ -128,16 +128,19 @@ DEFINES += -D_IMPL_NS_LAYOUT
 		     bug612271-3.html \
 		     bug612271-ref.html \
 		     bug613433-1.html \
 		     bug613433-2.html \
 		     bug613433-3.html \
 		     bug613433-ref.html \
 		     bug613807-1.html \
 		     bug613807-1-ref.html \
+		     bug632215-1.html \
+		     bug632215-2.html \
+		     bug632215-ref.html \
 		test_bug514127.html \
 		test_bug518777.html \
 		test_bug548545.xhtml \
 		test_bug558663.html \
 		test_bug559499.html \
 		test_flush_on_paint.html \
 		test_mozPaintCount.html \
 		test_scroll_selection_into_view.html \
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/bug632215-1.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+  <head>
+    <script type="text/javascript" src="/MochiKit/packed.js"></script>
+    <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+  </head>
+  <body>
+    <iframe src="data:text/html,<body></body>"></iframe>
+    <script>
+      onload = function() {
+        var i = document.querySelector("iframe");
+        var d = i.contentDocument;
+        var w = i.contentWindow;
+        var s = w.getSelection();
+        i.focus();
+        d.body.contentEditable = true;
+        d.body.contentEditable = false;
+        d.designMode = "off";
+        d.designMode = "on";
+        d.body.focus();
+        synthesizeKey("x", {});
+        s.collapse(d.body.firstChild, 1);
+        synthesizeKey("x", {});
+        setTimeout(function() {
+          document.documentElement.removeAttribute("class");
+        }, 0);
+      };
+    </script>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/bug632215-2.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+  <head>
+    <script type="text/javascript" src="/MochiKit/packed.js"></script>
+    <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+  </head>
+  <body>
+    <iframe src="data:text/html,<body contenteditable></body>"></iframe>
+    <script>
+      onload = function() {
+        var i = document.querySelector("iframe");
+        var d = i.contentDocument;
+        var w = i.contentWindow;
+        var s = w.getSelection();
+        i.focus();
+        d.body.contentEditable = false;
+        d.designMode = "off";
+        d.designMode = "on";
+        d.body.focus();
+        synthesizeKey("x", {});
+        s.collapse(d.body.firstChild, 1);
+        synthesizeKey("x", {});
+        setTimeout(function() {
+          document.documentElement.removeAttribute("class");
+        }, 0);
+      };
+    </script>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/bug632215-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+  <body>
+    <iframe src="data:text/html,<body>xx</body>"></iframe>
+    <script>
+      onload = function() {
+        var i = document.querySelector("iframe");
+        var d = i.contentDocument;
+        var w = i.contentWindow;
+        d.designMode = "on";
+        i.focus();
+        d.body.focus();
+        w.getSelection().collapse(d.body.firstChild, 2);
+      };
+    </script>
+  </body>
+</html>
--- a/layout/base/tests/test_reftests_with_caret.html
+++ b/layout/base/tests/test_reftests_with_caret.html
@@ -46,17 +46,17 @@ function doSnapShot(iframe) {
   callbackTestCanvas(iframe);
 };
 
 function remotePageLoaded() {
   var iframe = this;
   setTimeout(function(){doSnapShot(iframe);}, 0)
 };
 
-const MAX_ITERATIONS = 10;
+const MAX_ITERATIONS = 1000;
 
 function createIframe(url,next) {
   var iframe = document.createElement("iframe");
   iframe.src = url;
   iframe.remotePageLoaded = remotePageLoaded;
   var me = this;
   var currentIteration = 0;
   function iframeLoadCompleted() {
@@ -113,17 +113,19 @@ var tests = [
     [ 'bug602141-3.html' , 'bug602141-3-ref.html' ] ,
     [ 'bug602141-4.html' , 'bug602141-4-ref.html' ] ,
     [ 'bug612271-1.html' , 'bug612271-ref.html' ] ,
     [ 'bug612271-2.html' , 'bug612271-ref.html' ] ,
     [ 'bug612271-3.html' , 'bug612271-ref.html' ] ,
     [ 'bug613433-1.html' , 'bug613433-ref.html' ] ,
     [ 'bug613433-2.html' , 'bug613433-ref.html' ] ,
     [ 'bug613433-3.html' , 'bug613433-ref.html' ] ,
-    [ 'bug613807-1.html' , 'bug613807-1-ref.html' ]
+    [ 'bug613807-1.html' , 'bug613807-1-ref.html' ] ,
+    [ 'bug632215-1.html' , 'bug632215-ref.html'   ] ,
+    [ 'bug632215-2.html' , 'bug632215-ref.html'   ]
 ];
 var testIndex = 0;
 
 function nextTest() {
   if (testIndex < tests.length) {
     refTest(tests[testIndex][0],tests[testIndex][1]);
     ++testIndex;
   } else {