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
Родитель c2fbfc9add
Коммит 7c1847b3e9
2 изменённых файлов: 30 добавлений и 46 удалений

Просмотреть файл

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

Просмотреть файл

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