Bug 1582056 part 1 - Convert some Mozmill helper modules to JSMs; r=mkmelin

--HG--
rename : mail/test/mozmill/shared-modules/test-attachment-helpers.js => mail/test/mozmill/shared-modules/AttachmentHelpers.jsm
rename : mail/test/mozmill/shared-modules/test-keyboard-helpers.js => mail/test/mozmill/shared-modules/KeyboardHelpers.jsm
rename : mail/test/mozmill/shared-modules/test-message-helpers.js => mail/test/mozmill/shared-modules/MessageHelpers.jsm
rename : mail/test/mozmill/shared-modules/test-mock-object-helpers.js => mail/test/mozmill/shared-modules/MockObjectHelpers.jsm
rename : mail/test/mozmill/shared-modules/test-notificationbox-helpers.js => mail/test/mozmill/shared-modules/NotificationBoxHelpers.jsm
rename : mail/test/mozmill/shared-modules/test-prompt-helpers.js => mail/test/mozmill/shared-modules/PromptHelpers.jsm
This commit is contained in:
Geoff Lankow 2019-09-25 20:59:47 +12:00
Родитель ea7e11c6ef
Коммит a2e4cadfd5
41 изменённых файлов: 262 добавлений и 362 удалений

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

@ -11,7 +11,7 @@
var MODULE_NAME = "testInvitations";
var RELATIVE_ROOT = "../shared-modules";
var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers", "notificationbox-helpers"];
var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");

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

@ -6,7 +6,6 @@
/* import-globals-from ../shared-modules/test-account-manager-helpers.js */
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-keyboard-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-ab-whitelist";
@ -15,7 +14,6 @@ var MODULE_REQUIRES = [
"folder-display-helpers",
"window-helpers",
"account-manager-helpers",
"keyboard-helpers",
];
var mozmill = ChromeUtils.import(

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

@ -6,7 +6,6 @@
/* import-globals-from ../shared-modules/test-account-manager-helpers.js */
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-keyboard-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-account-port-setting";
@ -15,13 +14,16 @@ var MODULE_REQUIRES = [
"folder-display-helpers",
"window-helpers",
"account-manager-helpers",
"keyboard-helpers",
];
var elib = ChromeUtils.import(
"chrome://mozmill/content/modules/elementslib.jsm"
);
var { input_value, delete_all_existing } = ChromeUtils.import(
"resource://testing-common/mozmill/KeyboardHelpers.jsm"
);
var PORT_NUMBERS_TO_TEST = [
"110", // The original port number. We don't input this though.
"456", // Random port number.

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

@ -11,7 +11,6 @@
/* import-globals-from ../shared-modules/test-account-manager-helpers.js */
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-keyboard-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-account-values";
@ -20,13 +19,16 @@ var MODULE_REQUIRES = [
"folder-display-helpers",
"window-helpers",
"account-manager-helpers",
"keyboard-helpers",
];
var elib = ChromeUtils.import(
"chrome://mozmill/content/modules/elementslib.jsm"
);
var { input_value, delete_all_existing } = ChromeUtils.import(
"resource://testing-common/mozmill/KeyboardHelpers.jsm"
);
var gPopAccount, gOriginalAccountCount;
function setupModule(module) {

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

@ -6,8 +6,6 @@
/* import-globals-from ../shared-modules/test-account-manager-helpers.js */
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-keyboard-helpers.js */
/* import-globals-from ../shared-modules/test-prompt-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-mail-account-setup-wizard";
@ -16,19 +14,24 @@ var MODULE_REQUIRES = [
"folder-display-helpers",
"window-helpers",
"account-manager-helpers",
"keyboard-helpers",
"prompt-helpers",
];
var elib = ChromeUtils.import(
"chrome://mozmill/content/modules/elementslib.jsm"
);
var { input_value, delete_all_existing } = ChromeUtils.import(
"resource://testing-common/mozmill/KeyboardHelpers.jsm"
);
var { gMockPromptService } = ChromeUtils.import(
"resource://testing-common/mozmill/PromptHelpers.jsm"
);
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"
);
var elib = ChromeUtils.import(
"chrome://mozmill/content/modules/elementslib.jsm"
);
var user = {
name: "Yamato Nadeshiko",
email: "yamato.nadeshiko@example.com",

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

@ -6,7 +6,6 @@
/* import-globals-from ../shared-modules/test-account-manager-helpers.js */
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-keyboard-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-retest-config";
@ -14,13 +13,17 @@ var RELATIVE_ROOT = "../shared-modules";
var MODULE_REQUIRES = [
"folder-display-helpers",
"window-helpers",
"keyboard-helpers",
"account-manager-helpers",
];
var elib = ChromeUtils.import(
"chrome://mozmill/content/modules/elementslib.jsm"
);
var { input_value, delete_all_existing } = ChromeUtils.import(
"resource://testing-common/mozmill/KeyboardHelpers.jsm"
);
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var user = {

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

@ -11,7 +11,6 @@
/* import-globals-from ../shared-modules/test-address-book-helpers.js */
/* import-globals-from ../shared-modules/test-compose-helpers.js */
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-prompt-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-address-book";
@ -21,9 +20,12 @@ var MODULE_REQUIRES = [
"address-book-helpers",
"compose-helpers",
"window-helpers",
"prompt-helpers",
];
var { gMockPromptService } = ChromeUtils.import(
"resource://testing-common/mozmill/PromptHelpers.jsm"
);
var { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
);

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

@ -8,11 +8,8 @@
"use strict";
/* import-globals-from ../shared-modules/test-attachment-helpers.js */
/* import-globals-from ../shared-modules/test-compose-helpers.js */
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-observer-helpers.js */
/* import-globals-from ../shared-modules/test-prompt-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-attachment-events";
@ -21,13 +18,17 @@ var MODULE_REQUIRES = [
"folder-display-helpers",
"compose-helpers",
"window-helpers",
"attachment-helpers",
"observer-helpers",
"prompt-helpers",
];
var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
var { select_attachments } = ChromeUtils.import(
"resource://testing-common/mozmill/AttachmentHelpers.jsm"
);
var { gMockPromptService } = ChromeUtils.import(
"resource://testing-common/mozmill/PromptHelpers.jsm"
);
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { fixIterator } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"

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

@ -4,17 +4,12 @@
"use strict";
/* import-globals-from ../shared-modules/test-attachment-helpers.js */
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-attachment-menus";
var RELATIVE_ROOT = "../shared-modules";
var MODULE_REQUIRES = [
"folder-display-helpers",
"window-helpers",
"attachment-helpers",
];
var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
var folder;
var messenger;
@ -28,6 +23,15 @@ var controller = ChromeUtils.import(
"chrome://mozmill/content/modules/controller.jsm"
);
var {
create_body_part,
create_deleted_attachment,
create_detached_attachment,
create_enclosure_attachment,
} = ChromeUtils.import(
"resource://testing-common/mozmill/AttachmentHelpers.jsm"
);
var textAttachment =
"Can't make the frug contest, Helen; stomach's upset. I'll fix you, " +
"Ubik! Ubik drops you back in the thick of things fast. Taken as " +
@ -179,8 +183,6 @@ function setupModule(module) {
fdh.installInto(module);
let wh = collector.getModule("window-helpers");
wh.installInto(module);
let ah = collector.getModule("attachment-helpers");
ah.installInto(module);
messenger = Cc["@mozilla.org/messenger;1"].createInstance(Ci.nsIMessenger);

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

@ -4,17 +4,12 @@
"use strict";
/* import-globals-from ../shared-modules/test-attachment-helpers.js */
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-attachment-size";
var RELATIVE_ROOT = "../shared-modules";
var MODULE_REQUIRES = [
"folder-display-helpers",
"window-helpers",
"attachment-helpers",
];
var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
var folder;
var messenger;
@ -25,6 +20,14 @@ var controller = ChromeUtils.import(
"chrome://mozmill/content/modules/controller.jsm"
);
var {
create_body_part,
create_deleted_attachment,
create_detached_attachment,
} = ChromeUtils.import(
"resource://testing-common/mozmill/AttachmentHelpers.jsm"
);
var textAttachment =
"Can't make the frug contest, Helen; stomach's upset. I'll fix you, " +
"Ubik! Ubik drops you back in the thick of things fast. Taken as " +

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

@ -11,7 +11,6 @@
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-compose-helpers.js */
/* import-globals-from ../shared-modules/test-cloudfile-helpers.js */
/* import-globals-from ../shared-modules/test-attachment-helpers.js */
var MODULE_NAME = "test-cloudfile-attachment-item";
var RELATIVE_ROOT = "../shared-modules";
@ -19,9 +18,16 @@ var MODULE_REQUIRES = [
"folder-display-helpers",
"compose-helpers",
"cloudfile-helpers",
"attachment-helpers",
];
var {
gMockFilePicker,
gMockFilePickReg,
select_attachments,
} = ChromeUtils.import(
"resource://testing-common/mozmill/AttachmentHelpers.jsm"
);
var kAttachmentItemContextID = "msgComposeAttachmentItemContext";
var { cloudFileAccounts } = ChromeUtils.import(

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

@ -11,7 +11,6 @@
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-compose-helpers.js */
/* import-globals-from ../shared-modules/test-cloudfile-helpers.js */
/* import-globals-from ../shared-modules/test-attachment-helpers.js */
/* import-globals-from ../shared-modules/test-dom-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
@ -21,11 +20,18 @@ var MODULE_REQUIRES = [
"folder-display-helpers",
"compose-helpers",
"cloudfile-helpers",
"attachment-helpers",
"dom-helpers",
"window-helpers",
];
var {
gMockFilePicker,
gMockFilePickReg,
select_attachments,
} = ChromeUtils.import(
"resource://testing-common/mozmill/AttachmentHelpers.jsm"
);
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"

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

@ -11,9 +11,6 @@
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-compose-helpers.js */
/* import-globals-from ../shared-modules/test-cloudfile-helpers.js */
/* import-globals-from ../shared-modules/test-attachment-helpers.js */
/* import-globals-from ../shared-modules/test-prompt-helpers.js */
/* import-globals-from ../shared-modules/test-notificationbox-helpers.js */
var MODULE_NAME = "test-cloudfile-notifications";
var RELATIVE_ROOT = "../shared-modules";
@ -21,11 +18,26 @@ var MODULE_REQUIRES = [
"folder-display-helpers",
"compose-helpers",
"cloudfile-helpers",
"attachment-helpers",
"prompt-helpers",
"notificationbox-helpers",
];
var {
gMockFilePicker,
gMockFilePickReg,
select_attachments,
} = ChromeUtils.import(
"resource://testing-common/mozmill/AttachmentHelpers.jsm"
);
var {
assert_notification_displayed,
close_notification,
wait_for_notification_to_stop,
} = ChromeUtils.import(
"resource://testing-common/mozmill/NotificationBoxHelpers.jsm"
);
var { gMockPromptService } = ChromeUtils.import(
"resource://testing-common/mozmill/PromptHelpers.jsm"
);
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { cloudFileAccounts } = ChromeUtils.import(
"resource:///modules/cloudFileAccounts.jsm"

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

@ -10,8 +10,6 @@
/* import-globals-from ../shared-modules/test-compose-helpers.js */
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-keyboard-helpers.js */
/* import-globals-from ../shared-modules/test-notificationbox-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-attachment-reminder";
@ -20,10 +18,21 @@ var MODULE_REQUIRES = [
"folder-display-helpers",
"compose-helpers",
"window-helpers",
"notificationbox-helpers",
"keyboard-helpers",
];
var { delete_all_existing } = ChromeUtils.import(
"resource://testing-common/mozmill/KeyboardHelpers.jsm"
);
var {
assert_notification_displayed,
check_notification_displayed,
get_notification_button,
wait_for_notification_to_show,
wait_for_notification_to_stop,
} = ChromeUtils.import(
"resource://testing-common/mozmill/NotificationBoxHelpers.jsm"
);
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"

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

@ -10,7 +10,6 @@
/* import-globals-from ../shared-modules/test-compose-helpers.js */
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-notificationbox-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-blocked-content";
@ -19,10 +18,14 @@ var MODULE_REQUIRES = [
"folder-display-helpers",
"window-helpers",
"compose-helpers",
"notificationbox-helpers",
];
var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
var { wait_for_notification_to_show } = ChromeUtils.import(
"resource://testing-common/mozmill/NotificationBoxHelpers.jsm"
);
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"

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

@ -11,7 +11,6 @@
/* import-globals-from ../shared-modules/test-compose-helpers.js */
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-notificationbox-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-charset-edit";
@ -20,19 +19,23 @@ var MODULE_REQUIRES = [
"folder-display-helpers",
"compose-helpers",
"window-helpers",
"notificationbox-helpers",
];
var elib = ChromeUtils.import(
"chrome://mozmill/content/modules/elementslib.jsm"
);
var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
var utils = ChromeUtils.import("chrome://mozmill/content/modules/utils.jsm");
var { wait_for_notification_to_show } = ChromeUtils.import(
"resource://testing-common/mozmill/NotificationBoxHelpers.jsm"
);
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"
);
var { MimeParser } = ChromeUtils.import("resource:///modules/mimeParser.jsm");
var elib = ChromeUtils.import(
"chrome://mozmill/content/modules/elementslib.jsm"
);
var utils = ChromeUtils.import("chrome://mozmill/content/modules/utils.jsm");
var gDrafts;

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

@ -11,7 +11,6 @@
/* import-globals-from ../shared-modules/test-compose-helpers.js */
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-notificationbox-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-draft-identity";
@ -20,9 +19,15 @@ var MODULE_REQUIRES = [
"folder-display-helpers",
"window-helpers",
"compose-helpers",
"notificationbox-helpers",
];
var {
assert_notification_displayed,
wait_for_notification_to_show,
} = ChromeUtils.import(
"resource://testing-common/mozmill/NotificationBoxHelpers.jsm"
);
var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"
);

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

@ -11,7 +11,6 @@
/* import-globals-from ../shared-modules/test-compose-helpers.js */
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-notificationbox-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-drafts";
@ -20,9 +19,12 @@ var MODULE_REQUIRES = [
"folder-display-helpers",
"compose-helpers",
"window-helpers",
"notificationbox-helpers",
];
var { wait_for_notification_to_show } = ChromeUtils.import(
"resource://testing-common/mozmill/NotificationBoxHelpers.jsm"
);
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"

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

@ -11,7 +11,6 @@
/* import-globals-from ../shared-modules/test-compose-helpers.js */
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-message-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-forward-headers";
@ -20,9 +19,12 @@ var MODULE_REQUIRES = [
"folder-display-helpers",
"compose-helpers",
"window-helpers",
"message-helpers",
];
var { to_mime_message } = ChromeUtils.import(
"resource://testing-common/mozmill/MessageHelpers.jsm"
);
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var cwc = null; // compose window controller
@ -36,8 +38,6 @@ function setupModule(module) {
composeHelper.installInto(module);
let wh = collector.getModule("window-helpers");
wh.installInto(module);
let mh = collector.getModule("message-helpers");
mh.installInto(module);
folder = create_folder("Test");
let thread1 = create_thread(10);

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

@ -10,7 +10,6 @@
/* import-globals-from ../shared-modules/test-compose-helpers.js */
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-keyboard-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-image-insertion-dialog";
@ -19,14 +18,17 @@ var MODULE_REQUIRES = [
"folder-display-helpers",
"compose-helpers",
"window-helpers",
"keyboard-helpers",
];
var elib = ChromeUtils.import(
"chrome://mozmill/content/modules/elementslib.jsm"
);
var fdh, ch, wh, kh;
var { input_value } = ChromeUtils.import(
"resource://testing-common/mozmill/KeyboardHelpers.jsm"
);
var fdh, ch, wh;
function setupModule(module) {
fdh = collector.getModule("folder-display-helpers");
@ -35,8 +37,6 @@ function setupModule(module) {
ch.installInto(module);
wh = collector.getModule("window-helpers");
wh.installInto(module);
kh = collector.getModule("keyboard-helpers");
kh.installInto(module);
}
function test_image_insertion_dialog_persist() {

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

@ -10,7 +10,6 @@
/* import-globals-from ../shared-modules/test-compose-helpers.js */
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-message-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-reply-signature";
@ -19,7 +18,6 @@ var MODULE_REQUIRES = [
"folder-display-helpers",
"compose-helpers",
"window-helpers",
"message-helpers",
];
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");

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

@ -12,7 +12,6 @@
/* import-globals-from ../shared-modules/test-compose-helpers.js */
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-prompt-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-save-changes-on-quit";
@ -20,7 +19,6 @@ var RELATIVE_ROOT = "../shared-modules";
var MODULE_REQUIRES = [
"folder-display-helpers",
"compose-helpers",
"prompt-helpers",
"window-helpers",
];
@ -28,6 +26,10 @@ var SAVE = 0;
var CANCEL = 1;
var DONT_SAVE = 2;
var { gMockPromptService } = ChromeUtils.import(
"resource://testing-common/mozmill/PromptHelpers.jsm"
);
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var cwc = null; // compose window controller

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

@ -7,7 +7,6 @@
/* import-globals-from ../shared-modules/test-compose-helpers.js */
/* import-globals-from ../shared-modules/test-content-tab-helpers.js */
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-keyboard-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-compose-mailto";
@ -16,10 +15,13 @@ var MODULE_REQUIRES = [
"folder-display-helpers",
"compose-helpers",
"window-helpers",
"keyboard-helpers",
"content-tab-helpers",
];
var { input_value } = ChromeUtils.import(
"resource://testing-common/mozmill/KeyboardHelpers.jsm"
);
var folder = null;
var composeHelper = null;
var windowHelper = null;
@ -35,8 +37,6 @@ var url = collector.addHttpResource("../content-policy/html", "content");
function setupModule(module) {
let fdh = collector.getModule("folder-display-helpers");
fdh.installInto(module);
let kh = collector.getModule("keyboard-helpers");
kh.installInto(module);
composeHelper = collector.getModule("compose-helpers");
composeHelper.installInto(module);
windowHelper = collector.getModule("window-helpers");

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

@ -22,8 +22,6 @@
/* import-globals-from ../shared-modules/test-compose-helpers.js */
/* import-globals-from ../shared-modules/test-content-tab-helpers.js */
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-keyboard-helpers.js */
/* import-globals-from ../shared-modules/test-notificationbox-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-general-content-policy";
@ -33,8 +31,6 @@ var MODULE_REQUIRES = [
"window-helpers",
"compose-helpers",
"content-tab-helpers",
"keyboard-helpers",
"notificationbox-helpers",
];
var elib = ChromeUtils.import(
@ -42,6 +38,17 @@ var elib = ChromeUtils.import(
);
var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
var { input_value } = ChromeUtils.import(
"resource://testing-common/mozmill/KeyboardHelpers.jsm"
);
var {
get_notification_button,
wait_for_notification_to_show,
wait_for_notification_to_stop,
} = ChromeUtils.import(
"resource://testing-common/mozmill/NotificationBoxHelpers.jsm"
);
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"

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

@ -8,27 +8,28 @@
"use strict";
/* import-globals-from ../shared-modules/test-attachment-helpers.js */
/* import-globals-from ../shared-modules/test-content-tab-helpers.js */
/* import-globals-from ../shared-modules/test-dom-helpers.js */
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-prompt-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-about-downloads";
var RELATIVE_ROOT = "../shared-modules";
var MODULE_REQUIRES = [
"attachment-helpers",
"content-tab-helpers",
"dom-helpers",
"folder-display-helpers",
"prompt-helpers",
"window-helpers",
];
var elementslib = ChromeUtils.import(
"chrome://mozmill/content/modules/elementslib.jsm"
);
var { gMockFilePicker, gMockFilePickReg } = ChromeUtils.import(
"resource://testing-common/mozmill/AttachmentHelpers.jsm"
);
var downloads = ChromeUtils.import("resource://gre/modules/Downloads.jsm");
var downloadsTab;

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

@ -11,7 +11,6 @@
/* import-globals-from ../shared-modules/test-address-book-helpers.js */
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-nntp-helpers.js */
/* import-globals-from ../shared-modules/test-prompt-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-message-filters";
@ -21,12 +20,16 @@ var MODULE_REQUIRES = [
"window-helpers",
"nntp-helpers",
"address-book-helpers",
"prompt-helpers",
];
var elib = ChromeUtils.import(
"chrome://mozmill/content/modules/elementslib.jsm"
);
var { gMockPromptService } = ChromeUtils.import(
"resource://testing-common/mozmill/PromptHelpers.jsm"
);
var folderA;
function setupModule(module) {

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

@ -5,20 +5,20 @@
"use strict";
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-keyboard-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-instrument-setup";
var RELATIVE_ROOT = "../shared-modules";
var MODULE_REQUIRES = [
"folder-display-helpers",
"window-helpers",
"keyboard-helpers",
];
var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
var elib = ChromeUtils.import(
"chrome://mozmill/content/modules/elementslib.jsm"
);
var { input_value } = ChromeUtils.import(
"resource://testing-common/mozmill/KeyboardHelpers.jsm"
);
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var user = {

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

@ -9,19 +9,23 @@
"use strict";
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-notificationbox-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-phishing-bar";
var RELATIVE_ROOT = "../shared-modules";
var MODULE_REQUIRES = [
"folder-display-helpers",
"window-helpers",
"notificationbox-helpers",
];
var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
var {
assert_notification_displayed,
get_notification_button,
wait_for_notification_to_show,
wait_for_notification_to_stop,
} = ChromeUtils.import(
"resource://testing-common/mozmill/NotificationBoxHelpers.jsm"
);
var folder;
var kBoxId = "mail-notification-top";

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

@ -9,16 +9,15 @@
"use strict";
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-notificationbox-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
var MODULE_NAME = "test-return-receipt";
var RELATIVE_ROOT = "../shared-modules";
var MODULE_REQUIRES = [
"folder-display-helpers",
"window-helpers",
"notificationbox-helpers",
];
var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
var { assert_notification_displayed } = ChromeUtils.import(
"resource://testing-common/mozmill/NotificationBoxHelpers.jsm"
);
var folder;
@ -28,7 +27,6 @@ var kNotificationValue = "mdnRequested";
function setupModule(module) {
collector.getModule("folder-display-helpers").installInto(module);
collector.getModule("window-helpers").installInto(module);
collector.getModule("notificationbox-helpers").installInto(module);
folder = create_folder("ReturnReceiptTest");

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

@ -12,7 +12,6 @@
/* import-globals-from ../shared-modules/test-content-tab-helpers.js */
/* import-globals-from ../shared-modules/test-window-helpers.js */
/* import-globals-from ../shared-modules/test-newmailaccount-helpers.js */
/* import-globals-from ../shared-modules/test-keyboard-helpers.js */
/* import-globals-from ../shared-modules/test-dom-helpers.js */
var MODULE_NAME = "test-newmailaccount";
@ -22,13 +21,13 @@ var MODULE_REQUIRES = [
"content-tab-helpers",
"window-helpers",
"newmailaccount-helpers",
"keyboard-helpers",
"dom-helpers",
];
var elib = ChromeUtils.import(
"chrome://mozmill/content/modules/elementslib.jsm"
);
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"

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

@ -4,38 +4,26 @@
"use strict";
var MODULE_NAME = "attachment-helpers";
var RELATIVE_ROOT = "../shared-modules";
var MODULE_REQUIRES = ["mock-object-helpers"];
this.EXPORTED_SYMBOLS = [
"create_body_part",
"create_deleted_attachment",
"create_detached_attachment",
"create_enclosure_attachment",
"gMockFilePicker",
"gMockFilePickReg",
"select_attachments",
];
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
var { MockObjectReplacer } = ChromeUtils.import(
"resource://testing-common/mozmill/MockObjectHelpers.jsm"
);
var gMockFilePickReg;
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
function setupModule(module) {
let moh = collector.getModule("mock-object-helpers");
gMockFilePickReg = new moh.MockObjectReplacer(
"@mozilla.org/filepicker;1",
MockFilePickerConstructor
);
}
function installInto(module) {
setupModule(module);
// Now copy helper functions
module.create_body_part = create_body_part;
module.create_detached_attachment = create_detached_attachment;
module.create_deleted_attachment = create_deleted_attachment;
module.create_enclosure_attachment = create_enclosure_attachment;
module.gMockFilePickReg = gMockFilePickReg;
module.gMockFilePicker = gMockFilePicker;
module.select_attachments = select_attachments;
}
var gMockFilePickReg = new MockObjectReplacer(
"@mozilla.org/filepicker;1",
MockFilePickerConstructor
);
function MockFilePickerConstructor() {
return gMockFilePicker;

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

@ -4,14 +4,11 @@
"use strict";
var MODULE_NAME = "keyboard-helpers";
function installInto(module) {
// Now copy helper functions
module.input_value = input_value;
module.delete_existing = delete_existing;
module.delete_all_existing = delete_all_existing;
}
this.EXPORTED_SYMBOLS = [
"input_value",
"delete_existing",
"delete_all_existing",
];
/**
* Emulates manual input

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

@ -8,7 +8,7 @@
"use strict";
var MODULE_NAME = "message-helpers";
this.EXPORTED_SYMBOLS = ["to_mime_message"];
var frame = ChromeUtils.import("chrome://mozmill/content/modules/frame.jsm");
var utils = ChromeUtils.import("chrome://mozmill/content/modules/utils.jsm");
@ -17,10 +17,6 @@ var { MsgHdrToMimeMessage } = ChromeUtils.import(
"resource:///modules/gloda/mimemsg.js"
);
function installInto(module) {
module.to_mime_message = to_mime_message;
}
/**
* Given a message header, converts it to a MimeMessage. If aCallback throws,
* the test will be marked failed. See the documentation for MsgHdrToMimeMessage
@ -33,7 +29,6 @@ function to_mime_message(
aAllowDownload,
aOptions
) {
new frame.Runner(collector);
let called = false;
let currentTest = frame.events.currentTest;
MsgHdrToMimeMessage(

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

@ -4,7 +4,7 @@
"use strict";
var MODULE_NAME = "mock-object-helpers";
this.EXPORTED_SYMBOLS = ["MockObjectReplacer", "MockObjectRegisterer"];
var Cm = Components.manager;
@ -18,11 +18,6 @@ XPCOMUtils.defineLazyServiceGetter(
"nsIUUIDGenerator"
);
function installInto(module) {
module.MockObjectReplacer = MockObjectReplacer;
module.MockObjectRegisterer = MockObjectRegisterer;
}
function MockObjectRegisterer(aContractID, aCID, aComponent) {
this._contractID = aContractID;
this._cid = Components.ID("{" + aCID + "}");

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

@ -4,16 +4,14 @@
"use strict";
var MODULE_NAME = "notificationbox-helpers";
function installInto(module) {
module.check_notification_displayed = check_notification_displayed;
module.assert_notification_displayed = assert_notification_displayed;
module.close_notification = close_notification;
module.wait_for_notification_to_stop = wait_for_notification_to_stop;
module.wait_for_notification_to_show = wait_for_notification_to_show;
module.get_notification_button = get_notification_button;
}
this.EXPORTED_SYMBOLS = [
"check_notification_displayed",
"assert_notification_displayed",
"close_notification",
"wait_for_notification_to_stop",
"wait_for_notification_to_show",
"get_notification_button",
];
/**
* A helper function for determining whether or not a notification with

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

@ -4,9 +4,15 @@
"use strict";
var MODULE_NAME = "prompt-helpers";
var RELATIVE_ROOT = "../shared-modules";
var MODULE_REQUIRES = ["mock-object-helpers"];
this.EXPORTED_SYMBOLS = [
"gMockPromptService",
"gMockAuthPromptReg",
"gMockAuthPrompt",
];
var { MockObjectReplacer } = ChromeUtils.import(
"resource://testing-common/mozmill/MockObjectHelpers.jsm"
);
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { XPCOMUtils } = ChromeUtils.import(
@ -17,24 +23,10 @@ var kMockPromptServiceName = "Mock Prompt Service";
var kPromptServiceContractID = "@mozilla.org/embedcomp/prompt-service;1";
var kPromptServiceName = "Prompt Service";
var gMockAuthPromptReg;
function setupModule() {
let moh = collector.getModule("mock-object-helpers");
gMockAuthPromptReg = new moh.MockObjectReplacer(
"@mozilla.org/prompter;1",
MockAuthPromptFactoryConstructor
);
}
function installInto(module) {
setupModule();
// Now copy helper functions
module.gMockPromptService = gMockPromptService;
module.gMockAuthPromptReg = gMockAuthPromptReg;
module.gMockAuthPrompt = gMockAuthPrompt;
}
var gMockAuthPromptReg = new MockObjectReplacer(
"@mozilla.org/prompter;1",
MockAuthPromptFactoryConstructor
);
function MockAuthPromptFactoryConstructor() {
return gMockAuthPromptFactory;

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

@ -9,3 +9,12 @@
TEST_HARNESS_FILES.mozmill.stage['shared-modules'] += [
'test*.js',
]
TESTING_JS_MODULES.mozmill += [
'AttachmentHelpers.jsm',
'KeyboardHelpers.jsm',
'MessageHelpers.jsm',
'MockObjectHelpers.jsm',
'NotificationBoxHelpers.jsm',
'PromptHelpers.jsm',
]

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

@ -6,16 +6,17 @@
var MODULE_NAME = "content-tab-helpers";
var RELATIVE_ROOT = "../shared-modules";
var MODULE_REQUIRES = [
"folder-display-helpers",
"window-helpers",
"mock-object-helpers",
];
var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
var elib = ChromeUtils.import(
"chrome://mozmill/content/modules/elementslib.jsm"
);
var utils = ChromeUtils.import("chrome://mozmill/content/modules/utils.jsm");
var { MockObjectReplacer } = ChromeUtils.import(
"resource://testing-common/mozmill/MockObjectHelpers.jsm"
);
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var NORMAL_TIMEOUT = 6000;
@ -39,8 +40,7 @@ function setupModule() {
mark_failure = folderDisplayHelper.mark_failure;
wh = collector.getModule("window-helpers");
let moh = collector.getModule("mock-object-helpers");
gMockExtProtSvcReg = new moh.MockObjectReplacer(
gMockExtProtSvcReg = new MockObjectReplacer(
EXT_PROTOCOL_SVC_CID,
MockExtProtConstructor
);

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

@ -6,15 +6,16 @@
var MODULE_NAME = "newmailaccount-helpers";
var RELATIVE_ROOT = "../shared-modules";
var MODULE_REQUIRES = [
"folder-display-helpers",
"keyboard-helpers",
"dom-helpers",
];
var MODULE_REQUIRES = ["folder-display-helpers", "dom-helpers"];
var elib = ChromeUtils.import(
"chrome://mozmill/content/modules/elementslib.jsm"
);
var { input_value } = ChromeUtils.import(
"resource://testing-common/mozmill/KeyboardHelpers.jsm"
);
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { fixIterator } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
@ -23,12 +24,11 @@ var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"
);
var mc, fdh, kbh, dh;
var mc, fdh, dh;
function setupModule(module) {
fdh = collector.getModule("folder-display-helpers");
fdh.installInto(module);
kbh = collector.getModule("keyboard-helpers");
dh = collector.getModule("dom-helpers");
mc = fdh.mc;
}
@ -176,7 +176,7 @@ function type_in_search_name(aController, aName) {
aController.keypress(null, "a", { accelKey: true });
aController.keypress(null, "VK_BACK_SPACE", {});
kbh.input_value(aController, aName);
input_value(aController, aName);
}
/* A listener for the Error Console, which allows us to ensure that certain

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

@ -1,146 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var MODULE_NAME = "observer-helpers";
function installInto(module) {
module.ObservationRecorder = ObservationRecorder;
}
/**
* ObservationRecorder observes events, and records its observations for
* later analysis.
*/
function ObservationRecorder() {
this.reset();
}
ObservationRecorder.prototype = {
/**
* Called by the Observer Service when an event is fired.
*/
observe: function OR_observe(aSubject, aTopic, aData) {
if (this._topics.includes(aTopic)) {
if (!(aTopic in this.saw)) {
this.saw[aTopic] = 0;
}
this.saw[aTopic] += 1;
if (!(aTopic in this.subject)) {
this.subject[aTopic] = [];
}
this.subject[aTopic].push(aSubject);
if (!(aTopic in this.data)) {
this.data[aTopic] = [];
}
this.data[aTopic].push(aData);
}
},
/**
* Puts the observer back into its starting state.
*/
reset: function OR_reset() {
this.saw = {};
this.data = {};
this.subject = {};
this._topics = [];
},
/**
* Resets observations for one or more particular topics.
*
* @param aTopics A string representing the topic that we should
* be resetting observations for. You can also
* pass in an Array of strings.
*
* Example: obs.resetTopic("topic");
* obs.resetTopic(["topic1", "topic2"]);
*/
resetTopic: function OR_resetTopic(aTopics) {
if (!Array.isArray(aTopics)) {
aTopics = [aTopics];
}
for (let topic of aTopics.entries()) {
if (topic in this.saw) {
delete this.saw[topic];
}
if (topic in this.subject) {
delete this.subject[topic];
}
if (topic in this.data) {
delete this.data[topic];
}
}
},
/**
* Gets the ObservationRecorder ready to observe events. Must be called
* before any recording can be done. Subsequent calls to planFor will
* add to the list of topics that the ObservationRecorder is ready for.
*
* @param aTopics A string representing the topic that the ObservationRecorder
* should be observing. You can also pass in an Array of
* strings.
*
* Example: obs.planFor("topic");
* obs.planFor(["topic1", "topic2"]);
*/
planFor: function OR_planFor(aTopics) {
if (!Array.isArray(aTopics)) {
aTopics = [aTopics];
}
this._topics = this._topics.concat(aTopics);
},
/**
* Stops the ObservationRecorder from noticing events previously
* planned for. Does not erase any recorded data for these
* events.
*
* @param aTopics A string representing the topic that the ObservationRecorder
* is already observing. You can also pass in an Array of
* strings.
*
* Example: obs.stopNoticing("topic");
* obs.stopNoticing(["topic1", "topic2"]);
*/
stopNoticing: function OR_stopNoticing(aTopics) {
if (!Array.isArray(aTopics)) {
aTopics = [aTopics];
}
this._topics = this._topics.filter(topic => !aTopics.includes(topic));
},
/**
* Returns true of a particular topic was observed at least once.
*
* @param aTopic the topic to check if the ObservationRecorder saw.
*/
didSee: function OR_didSee(aTopic) {
return aTopic in this.saw && this.saw[aTopic];
},
/**
* Returns the number of times a particular topic was observed.
*
* @param aTopic the topic to count the number of observations of.
*/
numSightings: function OR_numSightings(aTopic) {
if (!(aTopic in this.saw)) {
return 0;
}
return this.saw[aTopic];
},
};

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

@ -6,22 +6,20 @@
var MODULE_NAME = "subscribe-window-helpers";
var RELATIVE_ROOT = "../shared-modules";
var MODULE_REQUIRES = [
"window-helpers",
"folder-display-helpers",
"keyboard-helpers",
];
var MODULE_REQUIRES = ["window-helpers", "folder-display-helpers"];
var { input_value, delete_all_existing } = ChromeUtils.import(
"resource://testing-common/mozmill/KeyboardHelpers.jsm"
);
var folderDisplayHelper;
var mc;
var windowHelper;
var kh;
function setupModule() {
folderDisplayHelper = collector.getModule("folder-display-helpers");
mc = folderDisplayHelper.mc;
windowHelper = collector.getModule("window-helpers");
kh = collector.getModule("keyboard-helpers");
}
function installInto(module) {
@ -61,8 +59,8 @@ function open_subscribe_window_from_context_menu(aFolder, aFunction) {
*/
function enter_text_in_search_box(swc, text) {
let textbox = swc.eid("namefield");
kh.delete_all_existing(swc, textbox);
kh.input_value(swc, text, textbox);
delete_all_existing(swc, textbox);
input_value(swc, text, textbox);
}
/**