Bug 1240750 - Put add button in ContentTask and modernize the rest of the test case and remove relevant skip-if in layout/base/tests/browser.ini. r=mconley

This commit is contained in:
Tracy Walker 2016-01-20 13:34:07 -06:00
parent c2fbfc9add
commit 7c1847b3e9
2 changed files with 30 additions and 46 deletions

View File

@ -1,7 +1,6 @@
[DEFAULT]
[browser_bug617076.js]
skip-if = e10s # Bug ?????? - test touches content (TypeError: doc.documentElement is null)
[browser_disableDialogs_onbeforeunload.js]
[browser_onbeforeunload_only_after_interaction.js]
[browser_onbeforeunload_only_after_interaction_in_frame.js]

View File

@ -1,10 +1,3 @@
function test()
{
waitForExplicitFinish();
test1();
}
/**
* 1. load about:addons in a new tab and select that tab
* 2. insert a button with tooltiptext
@ -15,47 +8,39 @@ function test()
*
* the test succeeds if it doesn't trigger any assertions
*/
function test1() {
let uri = "about:addons";
let tab = gBrowser.addTab();
tab.linkedBrowser.addEventListener("load", function(aEvent) {
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
add_task(function* test() {
// Open the test tab
let testTab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:addons");
let doc = gBrowser.contentDocument;
var e = doc.createElement("button");
e.setAttribute('label', "hello");
e.setAttribute('tooltiptext', "world");
// insert button into test page content
yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () {
let doc = content.document;
let e = doc.createElement("button");
e.setAttribute("label", "hello");
e.setAttribute("tooltiptext", "world");
e.setAttribute("id", "test-button");
doc.documentElement.insertBefore(e, doc.documentElement.firstChild);
});
let tab2 = gBrowser.addTab();
gBrowser.selectedTab = tab2;
// open a second tab and select it
let tab2 = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank", true);
gBrowser.selectedTab = tab2;
setTimeout(function() {
gBrowser.selectedTab = tab;
// Select the testTab then perform mouse events on inserted button
gBrowser.selectedTab = testTab;
let browser = gBrowser.selectedBrowser;
EventUtils.disableNonTestMouseEvents(true);
try {
yield BrowserTestUtils.synthesizeMouse("#test-button", 1, 1, { type: "mouseover" }, browser);
yield BrowserTestUtils.synthesizeMouse("#test-button", 2, 6, { type: "mousemove" }, browser);
yield BrowserTestUtils.synthesizeMouse("#test-button", 2, 4, { type: "mousemove" }, browser);
} finally {
EventUtils.disableNonTestMouseEvents(false);
}
let doc = gBrowser.contentDocument;
var win = gBrowser.contentWindow;
EventUtils.disableNonTestMouseEvents(true);
try {
EventUtils.synthesizeMouse(e, 1, 1, { type: "mouseover" }, win);
EventUtils.synthesizeMouse(e, 2, 6, { type: "mousemove" }, win);
EventUtils.synthesizeMouse(e, 2, 4, { type: "mousemove" }, win);
} finally {
EventUtils.disableNonTestMouseEvents(false);
}
executeSoon(function() {
gBrowser.removeTab(tab, {animate: false});
gBrowser.removeTab(tab2, {animate: false});
ok(true, "pass if no assertions");
// done
executeSoon(finish);
});
}, 0);
}, true);
gBrowser.selectedTab = tab;
gBrowser.selectedBrowser.loadURI(uri);
}
// cleanup
yield BrowserTestUtils.removeTab(testTab);
yield BrowserTestUtils.removeTab(tab2);
ok(true, "pass if no assertions");
});