Bug 1498410 - Part 5 - Fix tests broken by Screenshots migration to pure webextension; r=aswan

* Explicitly disable Screenshots in PageActions and context menu tests

* Update browser_preferences_usage test to accommodate Screenshots as a webextension
  (Moving Screenshots from legacy bootstrap to webextension seems to require reducing
  the minimum number of values in the `extensions.getAddons.cache.enabled` pref by one)

MozReview-Commit-ID: LCNaaXSE8w0

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jared Hirsch 2018-10-12 23:42:54 +00:00
Родитель 3b68ee30d9
Коммит 24854801a8
5 изменённых файлов: 17 добавлений и 16 удалений

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

@ -19,6 +19,12 @@ const chrome_base = "chrome://mochitests/content/browser/browser/base/content/te
/* import-globals-from contextmenu_common.js */
Services.scriptloader.loadSubScript(chrome_base + "contextmenu_common.js", this);
add_task(async function init() {
// Ensure screenshots is really disabled (bug 1498738)
const addon = await AddonManager.getAddonByID("screenshots@mozilla.org");
await addon.disable({allowSystemAddons: true});
});
// Below are test cases for XUL element
add_task(async function test_xul_text_link_label() {
let url = chrome_base + "subtst_contextmenu_xul.xul";

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

@ -12,6 +12,10 @@ add_task(async function test_setup() {
const contextmenu_common = chrome_base + "contextmenu_common.js";
/* import-globals-from contextmenu_common.js */
Services.scriptloader.loadSubScript(contextmenu_common, this);
// Ensure screenshots is really disabled (bug 1498738)
const addon = await AddonManager.getAddonByID("screenshots@mozilla.org");
await addon.disable({allowSystemAddons: true});
});
add_task(async function test_text_input() {
@ -175,10 +179,6 @@ add_task(async function test_tel_email_url_number_input() {
"context-delete", false,
"---", null,
"context-selectall", null], {
// XXX Bug 1345081. Currently the Screenshots menu option is shown for
// various text elements even though it is set to type "page". That bug
// should remove the need for next line.
maybeScreenshotsPresent: true,
skipFocusChange: true,
});
}

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

@ -72,7 +72,7 @@ function getVisibleMenuItems(aMenu, aData) {
item.id != "fill-login-no-logins" &&
// XXX Screenshots doesn't have an access key. This needs
// at least bug 1320462 fixing first.
item.id != "screenshots_mozilla_org_create-screenshot") {
item.id != "screenshots_mozilla_org-menuitem-_create-screenshot") {
ok(key, "menuitem " + item.id + " has an access key");
if (accessKeys[key])
ok(false, "menuitem " + item.id + " has same accesskey as " + accessKeys[key]);
@ -331,7 +331,7 @@ async function test_contextmenu(selector, menuItems, options = {}) {
!Services.prefs.getBoolPref("extensions.screenshots.disabled", false)) {
let screenshotItems = [
"---", null,
"screenshots_mozilla_org_create-screenshot", true,
"screenshots_mozilla_org-menuitem-_create-screenshot", true,
];
menuItems = menuItems.concat(screenshotItems);

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

@ -98,18 +98,9 @@ add_task(async function startup() {
// This is accessed in debug only.
},
"extensions.getAddons.cache.enabled": {
min: 6,
min: 5,
max: 55,
},
// Disabling screenshots in the default test profile triggers some
// work in the chrome registry that reads this pref. This can be removed
// when bootstrapped extensions are gone, or even when screenshots
// moves away from bootstrap (bug 1422437)
"chrome.override_package.global": {
min: 0,
max: 50,
},
};
let startupRecorder = Cc["@mozilla.org/test/startuprecorder;1"].getService().wrappedJSObject;

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

@ -18,6 +18,10 @@ add_task(async function init() {
registerCleanupFunction(async () => {
BrowserTestUtils.removeTab(tab);
});
// Ensure screenshots is really disabled (bug 1498738)
const addon = await AddonManager.getAddonByID("screenshots@mozilla.org");
await addon.disable({allowSystemAddons: true});
});