Bug 1246635, enable browser_autofocus_background.js in e10s, r=mrbkap

This commit is contained in:
Neil Deakin 2016-03-09 09:11:12 -05:00
parent 6b4f6f99fb
commit 3c1f661ece
2 changed files with 39 additions and 45 deletions

View File

@ -1,5 +1,4 @@
[DEFAULT]
skip-if = e10s # Bug ?????? - most of these tests fail for currently unknown reasons.
support-files =
browser_frame_elements.html
page_privatestorageevent.html
@ -10,30 +9,42 @@ support-files =
geo_leak_test.html
[browser_test_toolbars_visibility.js]
skip-if = e10s
support-files =
test_new_window_from_content_child.html
[browser_bug1008941_dismissGeolocationHanger.js]
skip-if = buildapp == 'mulet'
skip-if = buildapp == 'mulet' || e10s
[browser_test__content.js]
skip-if = e10s
[browser_ConsoleAPITests.js]
skip-if = e10s
[browser_ConsoleStorageAPITests.js]
skip-if = e10s
[browser_ConsoleStoragePBTest_perwindowpb.js]
skip-if = e10s
[browser_autofocus_background.js]
skip-if= buildapp == 'mulet'
[browser_autofocus_preference.js]
skip-if = e10s
[browser_bug1238427.js]
skip-if = e10s
[browser_bug396843.js]
skip-if = e10s
[browser_focus_steal_from_chrome.js]
skip-if = e10s
[browser_focus_steal_from_chrome_during_mousedown.js]
skip-if = e10s
[browser_frame_elements.js]
skip-if = e10s
[browser_localStorage_privatestorageevent.js]
skip-if = e10s
[browser_test_new_window_from_content.js]
skip-if = (toolkit == 'android' || buildapp == 'b2g' || buildapp == 'mulet')
skip-if = (toolkit == 'android' || buildapp == 'b2g' || buildapp == 'mulet') || e10s
support-files =
test_new_window_from_content_child.html
[browser_webapps_permissions.js]
# TODO: Re-enable permissions tests on Mac, bug 795334
skip-if = buildapp != "b2g"
skip-if = buildapp != "b2g" || e10s
support-files =
test-webapp.webapp
test-webapp-reinstall.webapp
@ -42,5 +53,6 @@ support-files =
[browser_webapps_perms_reinstall.js]
disabled = re-enable when bug 794920 is fixed
[browser_xhr_sandbox.js]
skip-if= buildapp == 'mulet'
skip-if= buildapp == 'mulet' || e10s
[browser_bug1004814.js]
skip-if = e10s

View File

@ -1,9 +1,4 @@
function test() {
waitForExplicitFinish();
let fm = Components.classes["@mozilla.org/focus-manager;1"]
.getService(Components.interfaces.nsIFocusManager);
add_task(function* () {
let tabs = [ gBrowser.selectedTab, gBrowser.addTab() ];
// The first tab has an autofocused element.
@ -13,43 +8,30 @@ function test() {
tagName: "INPUT"},
];
function runTest() {
// Set the focus to the first tab.
tabs[0].linkedBrowser.focus();
// Set the focus to the first tab.
tabs[0].linkedBrowser.focus();
// Load the first tab on background.
tabs[1].linkedBrowser.addEventListener("load", onLoadBackgroundTab, true);
tabs[1].linkedBrowser.loadURI(testingList[0].uri);
// Load the second tab in the background.
let loadedPromise = BrowserTestUtils.browserLoaded(tabs[1].linkedBrowser);
tabs[1].linkedBrowser.loadURI(testingList[0].uri);
yield loadedPromise;
for (var i = 0; i < testingList.length; ++i) {
// Get active element in the tab.
let tagName = yield ContentTask.spawn(tabs[i + 1].linkedBrowser, null, function* () {
return content.document.activeElement.tagName;
});
is(tagName, testingList[i].tagName,
"The background tab's focused element should be " + testingList[i].tagName);
}
function onLoadBackgroundTab() {
tabs[1].linkedBrowser.removeEventListener("load", onLoadBackgroundTab, true);
is(document.activeElement, tabs[0].linkedBrowser,
"The background tab's focused element should not cause the tab to be focused");
// The focus event (from autofocus) has been sent,
// let's test with executeSoon so we are sure the test is done
// after the focus event is processed.
executeSoon(doTest);
// Cleaning up.
for (let i = 1; i < tabs.length; i++) {
yield BrowserTestUtils.removeTab(tabs[i]);
}
});
function doTest() {
for (var i=0; i<testingList.length; ++i) {
// Get active element in the tab.
var e = tabs[i+1].linkedBrowser.contentDocument.activeElement;
is(e.tagName, testingList[i].tagName,
"The background tab's focused element should be " +
testingList[i].tagName);
isnot(fm.focusedElement, e,
"The background tab's focused element should not be the focus " +
"manager focused element");
}
// Cleaning up.
for (let i = 1; i < tabs.length; i++) {
gBrowser.removeTab(tabs[i]);
}
finish();
}
runTest();
}