Bug 802436: fix test from bug 800817, r=smaug
authorGavin Sharp <gavin@gavinsharp.com>
Wed, 17 Oct 2012 15:24:13 -0700
changeset 110749 c0b7b869931daba97d388f622738f8dc4c3591ef
parent 110748 c4119fd2fb379dbedd41bbb39a0ea64cee2b504e
child 110750 c258aeed70916abdc61106c00439ac1778729cf4
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewerssmaug
bugs802436, 800817
milestone19.0a1
Bug 802436: fix test from bug 800817, r=smaug
dom/bindings/BindingGen.py
dom/tests/mochitest/chrome/file_bug799299.xul
dom/tests/mochitest/chrome/file_bug800817.xul
--- a/dom/tests/mochitest/chrome/file_bug799299.xul
+++ b/dom/tests/mochitest/chrome/file_bug799299.xul
@@ -26,32 +26,36 @@ https://bugzilla.mozilla.org/show_bug.cg
     wu.sendMouseEventToWindow("mousedown", 10, 10, 0, 0, 0);
     wu.sendMouseEventToWindow("mouseup", 10, 10, 0, 0, 0);
   }
 
   function runTests() {
     var b1 = document.getElementById("b1");
     var b2 = document.getElementById("b2");
     b1.contentWindow.focus();
-    opener.wrappedJSObject.is(document.activeElement, b1);
+    opener.wrappedJSObject.is(document.activeElement, b1,
+                              "Focused first iframe");
 
     var didCallDummy = false;
     b2.contentWindow.addEventListener("mousedown", function(e) { didCallDummy = true; });
     sendClick(b2.contentWindow);
-    opener.wrappedJSObject.ok(didCallDummy);
-    opener.wrappedJSObject.is(document.activeElement, b2);
+    opener.wrappedJSObject.ok(didCallDummy, "dummy mousedown handler should fire");
+    opener.wrappedJSObject.is(document.activeElement, b2,
+                              "Focus shifted to second iframe");
 
     b1.contentWindow.focus();
-    opener.wrappedJSObject.is(document.activeElement, b1);
+    opener.wrappedJSObject.is(document.activeElement, b1,
+                              "Re-focused first iframe for the first time");
 
     var didCallListener = false;
     b2.contentWindow.addEventListener("mousedown", function(e) { didCallListener = true; e.preventDefault(); });
     sendClick(b2.contentWindow);
-    opener.wrappedJSObject.ok(didCallListener);
-    opener.wrappedJSObject.is(document.activeElement, b2);
+    opener.wrappedJSObject.ok(didCallListener, "mousedown handler should fire");
+    opener.wrappedJSObject.is(document.activeElement, b2,
+                              "focus should move to the second iframe");
 
     window.close();
     opener.wrappedJSObject.SimpleTest.finish();
   }
 
   SimpleTest.waitForFocus(runTests);
   ]]>
   </script>
--- a/dom/tests/mochitest/chrome/file_bug800817.xul
+++ b/dom/tests/mochitest/chrome/file_bug800817.xul
@@ -26,41 +26,46 @@ https://bugzilla.mozilla.org/show_bug.cg
     wu.sendMouseEventToWindow("mousedown", 10, 10, 0, 0, 0);
     wu.sendMouseEventToWindow("mouseup", 10, 10, 0, 0, 0);
   }
 
   function runTests() {
     var b1 = document.getElementById("b1");
     var b2 = document.getElementById("b2");
 
-    var mozbrowserAttr = opener.wrappedJSObject.testMozBrowser ? "true" : "false";
-    b1.setAttribute("mozbrowser", mozbrowserAttr);
-    b2.setAttribute("mozbrowser", mozbrowserAttr);
+    var testMozBrowser = opener.wrappedJSObject.testMozBrowser;
+    if (testMozBrowser) {
+      b1.setAttribute("mozbrowser", "true");
+      b2.setAttribute("mozbrowser", "true");
+    }
 
-    opener.wrappedJSObject.ok(true, "Testing with mozbrowser="+ mozbrowserAttr);
+    if (testMozBrowser)
+      opener.wrappedJSObject.info("Testing with mozbrowser=true");
+    else
+      opener.wrappedJSObject.info("Testing without mozbrowser");
 
     b1.contentWindow.focus();
     opener.wrappedJSObject.is(document.activeElement, b1,
                               "Focused first iframe");
 
     var didCallDummy = false;
     b2.contentWindow.addEventListener("mousedown", function(e) { didCallDummy = true; });
     sendClick(b2.contentWindow);
-    opener.wrappedJSObject.ok(didCallDummy);
+    opener.wrappedJSObject.ok(didCallDummy, "dummy mousedown handler should fire");
     opener.wrappedJSObject.is(document.activeElement, b2,
                               "Focus shifted to second iframe");
 
     b1.contentWindow.focus();
     opener.wrappedJSObject.is(document.activeElement, b1,
                               "Re-focused first iframe for the first time");
 
     var didCallListener = false;
     b2.contentWindow.addEventListener("mousedown", function(e) { didCallListener = true; e.preventDefault(); });
     sendClick(b2.contentWindow);
-    opener.wrappedJSObject.ok(didCallListener);
+    opener.wrappedJSObject.ok(didCallListener, "mousedown handler should fire");
     opener.wrappedJSObject.is(document.activeElement, b1,
                               "Did not move focus to the second iframe");
 
     window.close();
     opener.wrappedJSObject.finishedTests();
   }
 
   SimpleTest.waitForFocus(runTests);