Mochitests for Bug 565031

Test for Bug 565031

For bug discussed earlier in here and here, here is the Mochitest.

  1. <!DOCTYPE HTML>
  2. <html>
  3. <!—
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=565031
  5. —>
  6. <head>
  7.   <title>Test for Bug 565031</title>
  8.   <script src="/MochiKit/packed.js"></script>
  9.   <script src="/tests/SimpleTest/SimpleTest.js"></script>
  10.   <script src="/tests/SimpleTest/EventUtils.js"></script>
  11.   <link rel="stylesheet" href="/tests/SimpleTest/test.css">
  12. </head>
  13. <body>
  14. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=565031">Mozilla Bug 565031</a>
  15. <p id="display">
  16. <script>
  17. var simple = false;
  18. var tabs = false;
  19. var onlyTabs = false;
  20. </script>
  21. <map name="map">
  22.   <area coords="1 1 1 1" onclick="simple = true;" />
  23.   <area coords="2,	1,	2,	1" onclick="tabs = true;" />
  24.   <area coords="3	1	3	1" onclick="onlyTabs = true;" />
  25. </map>
  26. <img id="image" src="image.png" usemap="#map" width="200" height="200" />
  27. </p>
  28. <div id="content" style="display: none"></div>
  29. <pre id="test">
  30. <script>
  31. /** Test for Bug 565031 **/
  32. SimpleTest.waitForExplicitFinish();
  33.  
  34. function runTest() {
  35.   SimpleTest.waitForFocus(function() {
  36.     var image = document.getElementById("image");
  37.     synthesizeMouse(image, 1, 1, {});
  38.     synthesizeMouse(image, 2, 1, {});
  39.     synthesizeMouse(image, 3, 1, {});
  40.     ok(simple, "Simple Space");
  41.     ok(tabs, "Tabs");
  42.     ok(!onlyTabs, "Only Tabs"); // should fail
  43.     SimpleTest.finish();
  44.   });
  45. }
  46. addLoadEvent(runTest);
  47. </script>
  48. </pre>
  49. </body>
  50. </html>

To run the test, do:

  1. make -C obj-ff-dbg mochitest-plain

Though, this test here only addresses issues raised in #565031. Other cases, as documented here, are not covered.