layout/base/tests/browser_bug617076.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/base/tests/browser_bug617076.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,61 @@
     1.4 +function test()
     1.5 +{
     1.6 +  waitForExplicitFinish();
     1.7 +
     1.8 +  test1();
     1.9 +}
    1.10 +
    1.11 +/**
    1.12 + * 1. load about:addons in a new tab and select that tab
    1.13 + * 2. insert a button with tooltiptext
    1.14 + * 3. create a new blank tab and select that tab
    1.15 + * 4. select the about:addons tab and hover the inserted button
    1.16 + * 5. remove the about:addons tab
    1.17 + * 6. remove the blank tab
    1.18 + *
    1.19 + * the test succeeds if it doesn't trigger any assertions
    1.20 + */
    1.21 +function test1() {
    1.22 +  let uri = "about:addons";
    1.23 +  let tab = gBrowser.addTab();
    1.24 +
    1.25 +  tab.linkedBrowser.addEventListener("load", function(aEvent) {
    1.26 +    tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
    1.27 +
    1.28 +    let doc = gBrowser.contentDocument;
    1.29 +    var e = doc.createElement("button");
    1.30 +    e.setAttribute('label', "hello");
    1.31 +    e.setAttribute('tooltiptext', "world");
    1.32 +    doc.documentElement.insertBefore(e, doc.documentElement.firstChild);
    1.33 +
    1.34 +    let tab2 = gBrowser.addTab();
    1.35 +    gBrowser.selectedTab = tab2;
    1.36 +
    1.37 +    setTimeout(function() {
    1.38 +      gBrowser.selectedTab = tab;
    1.39 +
    1.40 +      let doc = gBrowser.contentDocument;
    1.41 +      var win = gBrowser.contentWindow;
    1.42 +      EventUtils.disableNonTestMouseEvents(true);
    1.43 +      try {
    1.44 +        EventUtils.synthesizeMouse(e, 1, 1, { type: "mouseover" }, win);
    1.45 +        EventUtils.synthesizeMouse(e, 2, 6, { type: "mousemove" }, win);
    1.46 +        EventUtils.synthesizeMouse(e, 2, 4, { type: "mousemove" }, win);
    1.47 +      } finally {
    1.48 +        EventUtils.disableNonTestMouseEvents(false);
    1.49 +      }
    1.50 +
    1.51 +      executeSoon(function() {
    1.52 +        gBrowser.removeTab(tab, {animate: false});
    1.53 +        gBrowser.removeTab(tab2, {animate: false});
    1.54 +        ok(true, "pass if no assertions");
    1.55 +
    1.56 +        // done
    1.57 +        executeSoon(finish);
    1.58 +      });
    1.59 +    }, 0);
    1.60 +  }, true);
    1.61 +
    1.62 +  gBrowser.selectedTab = tab;
    1.63 +  gBrowser.selectedTab.linkedBrowser.loadURI(uri);
    1.64 +}

mercurial