Bug 1249400 - add a test for missed hide events in case of accessible stealing, r=yzen
authorAlexander Surkov <surkov.alexander@gmail.com>
Tue, 23 Feb 2016 18:40:20 -0500
changeset 321583 ce33e421e1da6a35c0ebe6c0a43401d13495f05f
parent 321582 5f2f4297e6bd18edc3e8811f178b63bbf8acd323
child 321584 a54eb10d5f440b09f9d076e88cec772b70299e4b
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyzen
bugs1249400
milestone47.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 1249400 - add a test for missed hide events in case of accessible stealing, r=yzen
accessible/tests/mochitest/events.js
accessible/tests/mochitest/events/test_mutation.html
--- a/accessible/tests/mochitest/events.js
+++ b/accessible/tests/mochitest/events.js
@@ -340,20 +340,27 @@ function eventQueue(aEventType)
               // Report everythign is ok.
               for (var idx = 0; idx < eventSeq.length; idx++) {
                 var checker = eventSeq[idx];
 
                 var typeStr = eventQueue.getEventTypeAsString(checker);
                 var msg = "Test with ID = '" + this.getEventID(checker) +
                   "' succeed. ";
 
-                if (checker.unexpected)
-                  ok(true, msg + "There's no unexpected " + typeStr + " event.");
-                else
+                if (checker.unexpected) {
+                  if (checker.todo) {
+                    todo(false, "Event " + typeStr + " event is still missing");
+                  }
+                  else {
+                    ok(true, msg + "There's no unexpected " + typeStr + " event.");
+                  }
+                }
+                else {
                   ok(true, msg + "Event " + typeStr + " was handled.");
+                }
               }
             }
           }
         }
 
         // We don't have completely matched scenario. Report each failure/success
         // for every scenario.
         if (matchIdx == -1) {
@@ -366,18 +373,23 @@ function eventQueue(aEventType)
               var typeStr = eventQueue.getEventTypeAsString(checker);
               var msg = "Scenario #" + scnIdx + " of test with ID = '" +
                 this.getEventID(checker) + "' failed. ";
 
               if (checker.wasCaught > 1)
                 ok(false, msg + "Dupe " + typeStr + " event.");
 
               if (checker.unexpected) {
-                if (checker.wasCaught)
+                if (checker.todo) {
+                  todo(checker.wasCaught,
+                       "Event " + typeStr + " event is still missing");
+                }
+                else if (checker.wasCaught) {
                   ok(false, msg + "There's unexpected " + typeStr + " event.");
+                }
               } else if (!checker.wasCaught) {
                 ok(false, msg + typeStr + " event was missed.");
               }
             }
           }
         }
       }
     }
@@ -1663,16 +1675,28 @@ function invokerChecker(aEventType, aTar
     return prettyName(this.mTarget);
   }
 
   this.mTarget = aTargetOrFunc;
   this.mTargetFuncArg = aTargetFuncArg;
 }
 
 /**
+ * Generic invoker checker for todo events.
+ */
+function todo_invokerChecker(aEventType, aTargetOrFunc, aTargetFuncArg)
+{
+  this.__proto__ = new invokerChecker(aEventType, aTargetOrFunc,
+                                      aTargetFuncArg, true);
+
+  this.unexpected = true;
+  this.todo = true;
+}
+
+/**
  * Generic invoker checker for unexpected events.
  */
 function unexpectedInvokerChecker(aEventType, aTargetOrFunc, aTargetFuncArg)
 {
   this.__proto__ = new invokerChecker(aEventType, aTargetOrFunc,
                                       aTargetFuncArg, true);
 
   this.unexpected = true;
--- a/accessible/tests/mochitest/events/test_mutation.html
+++ b/accessible/tests/mochitest/events/test_mutation.html
@@ -353,16 +353,35 @@
       }
 
       this.getID = function insertReferredElm_getID()
       {
         return "insert inaccessible element and then insert referring element to make it accessible";
       }
     }
 
+    function showHiddenParentOfVisibleChild()
+    {
+      this.eventSeq = [
+        new todo_invokerChecker(EVENT_HIDE, getNode("c4_child")),
+        new invokerChecker(EVENT_SHOW, getNode("c4_middle")),
+        new invokerChecker(EVENT_REORDER, getNode("c4"))
+      ];
+
+      this.invoke = function showHiddenParentOfVisibleChild_invoke()
+      {
+        getNode("c4_middle").style.visibility = 'visible';
+      }
+
+      this.getID = function showHiddenParentOfVisibleChild_getID()
+      {
+        return "show hidden parent of visible child";
+      }
+    }
+
     /**
      * Target getters.
      */
     function getFirstChild(aNode)
     {
       return [aNode.firstChild];
     }
     function getLastChild(aNode)
@@ -479,16 +498,17 @@
       gQueue.push(new changeClass("container3", "link8", "visibilityHidden",
                                   kHideEvents));
 
       gQueue.push(new test1("testContainer"));
       gQueue.push(new test2("testContainer", "testContainer2"));
       gQueue.push(new test2("testContainer", "testNestedContainer"));
       gQueue.push(new test3("testContainer"));
       gQueue.push(new insertReferredElm("testContainer3"));
+      gQueue.push(new showHiddenParentOfVisibleChild());
 
       gQueue.invoke(); // Will call SimpleTest.finish();
     }
 
     SimpleTest.waitForExplicitFinish();
     addA11yLoadEvent(doTests);
   </script>
 </head>
@@ -539,10 +559,16 @@
     <a id="link6" href="http://www.google.com">Link #6</a>
 
     <div id="container2" class="displayNone"><a id="link7">Link #7</a></div>
     <div id="container3" class="visibilityHidden"><a id="link8">Link #8</a></div>
     <div id="testNestedContainer"></div>
   </div>
   <div id="testContainer2"></div>
   <div id="testContainer3"></div>
+
+  <div id="c4">
+    <div style="visibility:hidden" id="c4_middle">
+     <div style="visibility:visible" id="c4_child"></div>
+   </div>
+  </div>
 </body>
 </html>