Test for bug 800817. r=smaug
authorChris Jones <jones.chris.g@gmail.com>
Sat, 13 Oct 2012 18:43:24 -0700
changeset 118149 6ea044d85c1e3ef0dddcc636890536ff7801cd43
parent 118148 ad6c79681a21a8984f831197719aa4c7150cda13
child 118150 576c66cb9f2f9e7f3c3418ebb677a709a1e555a3
push id1997
push userakeybl@mozilla.com
push dateMon, 07 Jan 2013 21:25:26 +0000
treeherdermozilla-beta@4baf45cdcf21 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs800817
milestone19.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
Test for bug 800817. r=smaug
dom/tests/mochitest/chrome/Makefile.in
dom/tests/mochitest/chrome/file_bug800817.xul
dom/tests/mochitest/chrome/test_bug800817.xul
--- a/dom/tests/mochitest/chrome/Makefile.in
+++ b/dom/tests/mochitest/chrome/Makefile.in
@@ -45,16 +45,18 @@ MOCHITEST_CHROME_FILES = \
 		test_callback_wrapping.xul \
 		window_callback_wrapping.xul \
 		test_sandbox_postMessage.html \
 		test_sandbox_bindings.xul \
 		test_selectAtPoint.html \
 		selectAtPoint.html \
 		test_bug799299.xul \
 		file_bug799299.xul \
+		test_bug800817.xul \
+		file_bug800817.xul \
 		$(NULL)
 
 ifeq (WINNT,$(OS_ARCH))
 MOCHITEST_CHROME_FILES += \
 		test_sizemode_attribute.xul \
 		sizemode_attribute.xul \
 		$(NULL)
 endif
copy from dom/tests/mochitest/chrome/file_bug799299.xul
copy to dom/tests/mochitest/chrome/file_bug800817.xul
--- a/dom/tests/mochitest/chrome/file_bug799299.xul
+++ b/dom/tests/mochitest/chrome/file_bug800817.xul
@@ -1,62 +1,75 @@
 <?xml version="1.0"?>
 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
 <!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=799299
+https://bugzilla.mozilla.org/show_bug.cgi?id=800817
 -->
-<window title="Mozilla Bug 799299"
+<window title="Mozilla Bug 800817"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
 
   <!-- test results are displayed in the html:body -->
   <body xmlns="http://www.w3.org/1999/xhtml">
-  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=799299"
-     target="_blank">Mozilla Bug 799299</a>
+  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=800817"
+     target="_blank">Mozilla Bug 800817</a>
   </body>
 
   <!-- test code goes here -->
   <script type="application/javascript">
   <![CDATA[
-  /** Test for Bug 799299 **/
+  /** Test for Bug 800817 **/
 
   function sendClick(win) {
     var wu = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
                 .getInterface(Components.interfaces.nsIDOMWindowUtils);
     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);
+
+    opener.wrappedJSObject.ok(true, "Testing with mozbrowser="+ mozbrowserAttr);
+
     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.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.is(document.activeElement, b1,
+                              "Did not move focus to the second iframe");
 
     window.close();
-    opener.wrappedJSObject.SimpleTest.finish();
+    opener.wrappedJSObject.finishedTests();
   }
 
   SimpleTest.waitForFocus(runTests);
   ]]>
   </script>
-  <hbox flex="1">
-    <browser id="b1" type="content" src="about:blank" flex="1" style="border: 1px solid black;"/>
-    <browser id="b2" type="content" src="about:blank" flex="1" style="border: 1px solid black;"/>
-  </hbox>
+  <iframe xmlns="http://www.w3.org/1999/xhtml"
+          id="b1" type="content" src="about:blank"
+          style="width: 300px; height: 550px; border: 1px solid black;"/>
+  <iframe xmlns="http://www.w3.org/1999/xhtml"
+          id="b2" type="content" src="about:blank"
+          style="width: 300px; height: 550px; border: 1px solid black;"/>
 </window>
copy from dom/tests/mochitest/chrome/test_bug799299.xul
copy to dom/tests/mochitest/chrome/test_bug800817.xul
--- a/dom/tests/mochitest/chrome/test_bug799299.xul
+++ b/dom/tests/mochitest/chrome/test_bug800817.xul
@@ -1,31 +1,43 @@
 <?xml version="1.0"?>
 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
 <!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=799299
+https://bugzilla.mozilla.org/show_bug.cgi?id=800817
 -->
-<window title="Mozilla Bug 799299" onload="runTests()"
+<window title="Mozilla Bug 800817" onload="runTests()"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
 
   <!-- test results are displayed in the html:body -->
   <body xmlns="http://www.w3.org/1999/xhtml">
-  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=799299"
-     target="_blank">Mozilla Bug 799299</a>
+  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=800817"
+     target="_blank">Mozilla Bug 800817</a>
   </body>
 
   <!-- test code goes here -->
   <script type="application/javascript">
   <![CDATA[
-  /** Test for Bug 799299 **/
+  /** Test for Bug 800817 **/
+
+  var testMozBrowser = false;
+  function runTests() {
+    // Run a first round of tests for non-mozbrowser iframes.
+    window.open("file_bug800817.xul", "_blank", "chrome,width=600,height=550");
+  }
 
-  function runTests() {
-    window.open("file_bug799299.xul", "_blank", "chrome,width=600,height=550");
+  function finishedTests() {
+    if (!testMozBrowser) {
+      testMozBrowser = true;
+      // Run a second round of tests for mozbrowser iframes.
+      window.open("file_bug800817.xul", "_blank", "chrome,width=600,height=550");
+    } else {
+      SimpleTest.finish();
+    }
   }
 
   SimpleTest.waitForExplicitFinish();
 
   ]]>
   </script>
 </window>