layout/base/tests/browser_bug617076.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:6f2afd8103d6
1 function test()
2 {
3 waitForExplicitFinish();
4
5 test1();
6 }
7
8 /**
9 * 1. load about:addons in a new tab and select that tab
10 * 2. insert a button with tooltiptext
11 * 3. create a new blank tab and select that tab
12 * 4. select the about:addons tab and hover the inserted button
13 * 5. remove the about:addons tab
14 * 6. remove the blank tab
15 *
16 * the test succeeds if it doesn't trigger any assertions
17 */
18 function test1() {
19 let uri = "about:addons";
20 let tab = gBrowser.addTab();
21
22 tab.linkedBrowser.addEventListener("load", function(aEvent) {
23 tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
24
25 let doc = gBrowser.contentDocument;
26 var e = doc.createElement("button");
27 e.setAttribute('label', "hello");
28 e.setAttribute('tooltiptext', "world");
29 doc.documentElement.insertBefore(e, doc.documentElement.firstChild);
30
31 let tab2 = gBrowser.addTab();
32 gBrowser.selectedTab = tab2;
33
34 setTimeout(function() {
35 gBrowser.selectedTab = tab;
36
37 let doc = gBrowser.contentDocument;
38 var win = gBrowser.contentWindow;
39 EventUtils.disableNonTestMouseEvents(true);
40 try {
41 EventUtils.synthesizeMouse(e, 1, 1, { type: "mouseover" }, win);
42 EventUtils.synthesizeMouse(e, 2, 6, { type: "mousemove" }, win);
43 EventUtils.synthesizeMouse(e, 2, 4, { type: "mousemove" }, win);
44 } finally {
45 EventUtils.disableNonTestMouseEvents(false);
46 }
47
48 executeSoon(function() {
49 gBrowser.removeTab(tab, {animate: false});
50 gBrowser.removeTab(tab2, {animate: false});
51 ok(true, "pass if no assertions");
52
53 // done
54 executeSoon(finish);
55 });
56 }, 0);
57 }, true);
58
59 gBrowser.selectedTab = tab;
60 gBrowser.selectedTab.linkedBrowser.loadURI(uri);
61 }

mercurial