Bug 620906 - Part 2: Accessibility test adjustments; r=davidb f=MarcoZ a=blocking-final+
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 11 Jan 2011 16:01:11 -0500
changeset 60318 556f7620b78fdd0d5b0714cc4b6fc472258d438d
parent 60317 985c54525bc0c39d7e624c68ca2966bd4456b804
child 60319 95f32675752ff71f85f0d7d4dc276ec35f405142
push idunknown
push userunknown
push dateunknown
reviewersdavidb, blocking-final
bugs620906
milestone2.0b10pre
Bug 620906 - Part 2: Accessibility test adjustments; r=davidb f=MarcoZ a=blocking-final+
accessible/tests/mochitest/states/test_doc.html
accessible/tests/mochitest/states/test_docarticle.html
--- a/accessible/tests/mochitest/states/test_doc.html
+++ b/accessible/tests/mochitest/states/test_doc.html
@@ -9,70 +9,18 @@
           src="chrome://mochikit/content/MochiKit/packed.js"></script>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 
   <script type="application/javascript"
           src="../common.js"></script>
   <script type="application/javascript"
           src="../states.js"></script>
-  <script type="application/javascript"
-          src="../events.js"></script>
 
   <script type="application/javascript">
-    function designModeOn()
-    {
-      this.eventSeq = [
-        new invokerChecker(EVENT_REORDER, document)
-      ];
-
-      this.invoke = function designModeOn_invoke()
-      {
-        document.designMode = "on";
-      }
-
-      this.finalCheck = function designModeOn_finalCheck()
-      {
-        testStates(document, 0, EXT_STATE_EDITABLE);
-        testStates("p", 0, EXT_STATE_EDITABLE);
-        testStates("document", 0, EXT_STATE_EDITABLE);
-        testStates("editable_document", 0, EXT_STATE_EDITABLE);
-      }
-
-      this.getID = function designModeOn_getID()
-      {
-        return "design mode on";
-      }
-    }
-
-    function designModeOff()
-    {
-      this.eventSeq = [
-        new invokerChecker(EVENT_REORDER, document)
-      ];
-
-      this.invoke = function designModeOn_invoke()
-      {
-        document.designMode = "off";
-      }
-
-      this.finalCheck = function designModeOn_finalCheck()
-      {
-        testStates(document, STATE_READONLY);
-        testStates("document", STATE_READONLY);
-        testStates("editable_document", 0, EXT_STATE_EDITABLE);
-      }
-
-      this.getID = function designModeOn_getID()
-      {
-        return "design mode off";
-      }
-    }
-
-    var gQueue = null;
     function doTest()
     {
       // Bug 566542: root accesible should expose active state when focused.
       testStates(getRootAccessible(), 0, EXT_STATE_ACTIVE);
 
       // Bug 509696, 607219.
       testStates(document, STATE_READONLY); // role=""
 
@@ -83,21 +31,30 @@
       document.body.removeAttribute("role");
       testStates(document, STATE_READONLY);
 
       // Bugs 454997 and 467387
       testStates(document, STATE_READONLY);
       testStates("document", STATE_READONLY);
       testStates("editable_document", 0, EXT_STATE_EDITABLE);
 
-      // Design mode on/off trigger document accessible subtree recreation.
-      gQueue = new eventQueue();
-      gQueue.push(new designModeOn());
-      gQueue.push(new designModeOff());
-      gQueue.invoke(); // Will call SimpleTest.finish();
+      document.designMode = "on";
+
+      testStates(document, 0, EXT_STATE_EDITABLE);
+      testStates("p", 0, EXT_STATE_EDITABLE);
+      testStates("document", 0, EXT_STATE_EDITABLE);
+      testStates("editable_document", 0, EXT_STATE_EDITABLE);
+
+      document.designMode = "off";
+
+      testStates(document, STATE_READONLY);
+      testStates("document", STATE_READONLY);
+      testStates("editable_document", 0, EXT_STATE_EDITABLE);
+
+      SimpleTest.finish();
     }
 
     SimpleTest.waitForExplicitFinish();
     addA11yLoadEvent(doTest);
   </script>
 </head>
 
 <body role="">
--- a/accessible/tests/mochitest/states/test_docarticle.html
+++ b/accessible/tests/mochitest/states/test_docarticle.html
@@ -9,87 +9,45 @@
           src="chrome://mochikit/content/MochiKit/packed.js"></script>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 
   <script type="application/javascript"
           src="../common.js"></script>
   <script type="application/javascript"
           src="../states.js"></script>
-  <script type="application/javascript"
-          src="../events.js"></script>
 
   <script type="application/javascript">
-    function designModeOn()
+    function doTest()
     {
-      this.eventSeq = [
-        new invokerChecker(EVENT_REORDER, document)
-      ];
+      var docAcc = getAccessible(document, [nsIAccessibleDocument]);
+      if (docAcc) {
+        testStates(docAcc, STATE_READONLY);
+        testStates("aria_article", STATE_READONLY);
+        testStates("editable_aria_article", 0, EXT_STATE_EDITABLE);
+        testStates("article", STATE_READONLY);
+        testStates("editable_article", 0, EXT_STATE_EDITABLE);
 
-      this.invoke = function designModeOn_invoke()
-      {
         document.designMode = "on";
-      }
 
-      this.finalCheck = function designModeOn_finalCheck()
-      {
-        testStates(document, 0, EXT_STATE_EDITABLE);
+        testStates(docAcc, 0, EXT_STATE_EDITABLE);
         testStates("aria_article", 0, EXT_STATE_EDITABLE);
         testStates("editable_aria_article", 0, EXT_STATE_EDITABLE);
         testStates("article", 0, EXT_STATE_EDITABLE);
         testStates("editable_article", 0, EXT_STATE_EDITABLE);
-      }
-
-      this.getID = function designModeOn_getID()
-      {
-        return "design mode on";
-      }
-    }
+  
+        document.designMode = "off";
 
-    function designModeOff()
-    {
-      this.eventSeq = [
-        new invokerChecker(EVENT_REORDER, document)
-      ];
-
-      this.invoke = function designModeOn_invoke()
-      {
-        document.designMode = "off";
-      }
-
-      this.finalCheck = function designModeOn_finalCheck()
-      {
-        testStates(document, STATE_READONLY);
+        testStates(docAcc, STATE_READONLY);
         testStates("aria_article", STATE_READONLY);
         testStates("editable_aria_article", 0, EXT_STATE_EDITABLE);
         testStates("article", STATE_READONLY);
         testStates("editable_article", 0, EXT_STATE_EDITABLE);
       }
-
-      this.getID = function designModeOn_getID()
-      {
-        return "design mode off";
-      }
-    }
-
-    var gQueue = null;
-
-    function doTest()
-    {
-      testStates(document, STATE_READONLY);
-      testStates("aria_article", STATE_READONLY);
-      testStates("editable_aria_article", 0, EXT_STATE_EDITABLE);
-      testStates("article", STATE_READONLY);
-      testStates("editable_article", 0, EXT_STATE_EDITABLE);
-
-      // Design mode on/off trigger document accessible subtree recreation.
-      gQueue = new eventQueue();
-      gQueue.push(new designModeOn());
-      gQueue.push(new designModeOff());
-      gQueue.invoke(); // Will call SimpleTest.finish();
+      SimpleTest.finish();
     }
 
     SimpleTest.waitForExplicitFinish();
     addA11yLoadEvent(doTest);
   </script>
 </head>
 
 <body role="article">