Bug 1551490 - Fix failures when browser_update_checkForUpdate run with HTML about:addons enabled. r=aswan

Depends on D31778

Differential Revision: https://phabricator.services.mozilla.com/D31779

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Luca Greco 2019-05-28 22:02:28 +00:00
Родитель e01108444d
Коммит 492f0cccbe
3 изменённых файлов: 71 добавлений и 11 удалений

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

@ -13,5 +13,29 @@ function checkAll(win) {
}
// Test "Check for Updates" with both auto-update settings
add_task(() => interactiveUpdateTest(true, checkAll));
add_task(() => interactiveUpdateTest(false, checkAll));
async function test_check_for_updates() {
info("Test 'Check for Updates' with auto-update true");
await interactiveUpdateTest(true, checkAll);
info("Test 'Check for Updates' with auto-update false");
await interactiveUpdateTest(false, checkAll);
}
add_task(async function test_xul_aboutaddons() {
await SpecialPowers.pushPrefEnv({
set: [["extensions.htmlaboutaddons.enabled", false]],
});
await test_check_for_updates();
await SpecialPowers.popPrefEnv();
});
add_task(async function test_html_aboutaddons() {
await SpecialPowers.pushPrefEnv({
set: [["extensions.htmlaboutaddons.enabled", true]],
});
await test_check_for_updates();
await SpecialPowers.popPrefEnv();
});

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

@ -4,5 +4,29 @@ function checkOne(win, addon) {
}
// Test "Find Updates" with both auto-update settings
add_task(() => interactiveUpdateTest(true, checkOne));
add_task(() => interactiveUpdateTest(false, checkOne));
async function test_find_updates() {
info("Test 'Find Updates' with auto-update true");
await interactiveUpdateTest(true, checkOne);
info("Test 'Find Updates' with auto-update false");
await interactiveUpdateTest(false, checkOne);
}
add_task(async function test_xul_aboutaddons() {
await SpecialPowers.pushPrefEnv({
set: [["extensions.htmlaboutaddons.enabled", false]],
});
await test_find_updates();
await SpecialPowers.popPrefEnv();
});
add_task(async function test_html_aboutaddons() {
await SpecialPowers.pushPrefEnv({
set: [["extensions.htmlaboutaddons.enabled", true]],
});
await test_find_updates();
await SpecialPowers.popPrefEnv();
});

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

@ -419,13 +419,25 @@ async function interactiveUpdateTest(autoUpdate, checkFn) {
if (manualUpdatePromise) {
await manualUpdatePromise;
let list = win.document.getElementById("addon-list");
// Make sure we have XBL bindings
list.clientHeight;
let item = list.itemChildren.find(_item => _item.value == ID);
EventUtils.synthesizeMouseAtCenter(item._updateBtn, {}, win);
if (win.useHtmlViews) {
// about:addons is using the new HTML views.
const availableUpdates = win.document.getElementById("updates-manualUpdatesFound-btn");
availableUpdates.click();
let doc = win.getHtmlBrowser().contentDocument;
let card = await BrowserTestUtils.waitForCondition(() => {
return doc.querySelector(`addon-card[addon-id="${ID}"]`);
}, `Wait addon card for "${ID}"`);
let updateBtn = card.querySelector('panel-item[action="install-update"]');
ok(updateBtn, `Found update button for "${ID}"`);
updateBtn.click();
} else {
// about:addons is still using the legacy XUL views.
let list = win.document.getElementById("addon-list");
// Make sure we have XBL bindings
list.clientHeight;
let item = list.itemChildren.find(_item => _item.value == ID);
EventUtils.synthesizeMouseAtCenter(item._updateBtn, {}, win);
}
}
return {promise};