Bug 900881 Make localAccountUtils.js into a testing module - Part 4. Make it a real testing module. r=jcranmer

This commit is contained in:
Mark Banner 2013-08-02 18:11:30 +01:00
Родитель a9345761e8
Коммит 7a4d490a07
32 изменённых файлов: 47 добавлений и 86 удалений

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

@ -2,7 +2,7 @@
* 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/. */
load("../../../../mailnews/resources/localAccountUtils.js");
Components.utils.import("resource://testing-common/mailnews/localAccountUtils.js");
/*
* Test the about:support module.

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

@ -22,6 +22,7 @@ RESDIR = $(srcdir)/test/resources
FAKESERVER := $(srcdir)/test/fakeserver
TESTING_JS_MODULE_DIR = mailnews
TESTING_JS_MODULES += \
$(RESDIR)/localAccountUtils.js \
$(RESDIR)/mailDirService.js \
$(RESDIR)/mailTestUtils.js \
$(FAKESERVER)/auth.js \

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

@ -3,6 +3,7 @@ Components.utils.import("resource:///modules/mailServices.js");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://testing-common/mailnews/mailDirService.js");
Components.utils.import("resource://testing-common/mailnews/mailTestUtils.js");
Components.utils.import("resource://testing-common/mailnews/localAccountUtils.js");
var Cc = Components.classes;
var Ci = Components.interfaces;
@ -12,5 +13,3 @@ var CC = Components.Constructor;
var gProfileDir = ProfileDir.initialize(do_get_profile());
var gDEPTH = "../../../../";
load("../../../../mailnews/resources/localAccountUtils.js");

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

@ -62,8 +62,7 @@ function run_test()
// build up a diverse list of messages
let messages = [];
messages = messages.concat(scenarioFactory.directReply(10));
gCopySource = localAccountUtils.incomingServer
.rootMsgFolder.createLocalSubfolder("copySource");
gCopySource = localAccountUtils.rootFolder.createLocalSubfolder("copySource");
addMessagesToFolder(messages, gCopySource);
mailTestUtils.updateFolderAndNotify(gCopySource, doTest);

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

@ -108,10 +108,8 @@ function run_test()
if (!localAccountUtils.inboxFolder)
localAccountUtils.loadLocalMailAccount();
gCopyFolder = localAccountUtils.incomingServer
.rootFolder.createLocalSubfolder("CopyFolder");
gMoveFolder = localAccountUtils.incomingServer
.rootFolder.createLocalSubfolder("MoveFolder");
gCopyFolder = localAccountUtils.rootFolder.createLocalSubfolder("CopyFolder");
gMoveFolder = localAccountUtils.rootFolder.createLocalSubfolder("MoveFolder");
MailServices.mailSession.AddFolderListener(FolderListener, Ci.nsIFolderListener.event |
Ci.nsIFolderListener.added |

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

@ -115,10 +115,8 @@ function run_test()
if (!localAccountUtils.inboxFolder)
localAccountUtils.loadLocalMailAccount();
gMoveFolder = localAccountUtils.incomingServer.rootMsgFolder
.createLocalSubfolder("MoveFolder");
gMoveFolder2 = localAccountUtils.incomingServer.rootMsgFolder
.createLocalSubfolder("MoveFolder2");
gMoveFolder = localAccountUtils.rootFolder.createLocalSubfolder("MoveFolder");
gMoveFolder2 = localAccountUtils.rootFolder.createLocalSubfolder("MoveFolder2");
MailServices.mailSession.AddFolderListener(FolderListener, Ci.nsIFolderListener.event |
Ci.nsIFolderListener.added |

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

@ -89,8 +89,7 @@ var UrlListener =
function searchTest()
{
// Get the IMAP inbox...
var emptyLocal1 = localAccountUtils.incomingServer
.rootFolder.createLocalSubfolder("empty 1");
var emptyLocal1 = localAccountUtils.rootFolder.createLocalSubfolder("empty 1");
let searchSession = Cc["@mozilla.org/messenger/searchSession;1"]
.createInstance(Ci.nsIMsgSearchSession);

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

@ -4,6 +4,7 @@ Components.utils.import("resource:///modules/IOUtils.js");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://testing-common/mailnews/mailDirService.js");
Components.utils.import("resource://testing-common/mailnews/mailTestUtils.js");
Components.utils.import("resource://testing-common/mailnews/localAccountUtils.js");
var Cc = Components.classes;
var Ci = Components.interfaces;
@ -12,8 +13,6 @@ var CC = Components.Constructor;
var gProfileDir = ProfileDir.initialize(do_get_profile());
load("../../../resources/localAccountUtils.js");
// Import the required setup scripts.
load("../../../resources/abSetup.js");
@ -132,7 +131,7 @@ function createMessage(aAttachment) {
let msgCompose = MailServices.compose.initCompose(params);
let identity = getSmtpIdentity(null, getBasicSmtpServer());
let rootFolder = localAccountUtils.incomingServer.rootMsgFolder;
let rootFolder = localAccountUtils.rootFolder;
gDraftFolder = null;
// Make sure the drafts folder is empty
try {

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

@ -112,8 +112,7 @@ function send_message_later(aMessageHeaderKeys, aStatus) {
.createInstance(Ci.nsIMsgComposeParams);
params.composeFields = compFields;
let msgCompose = MailServices.compose.initCompose(params);
let rootFolder = localAccountUtils.incomingServer.rootMsgFolder;
rootFolder.createLocalSubfolder("Drafts");
localAccountUtils.rootFolder.createLocalSubfolder("Drafts");
let smtpServer = getBasicSmtpServer();
let identity = getSmtpIdentity(kSender, smtpServer);

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

@ -111,8 +111,7 @@ function run_test() {
account.defaultIdentity = identity;
account.incomingServer = incomingServer;
sentFolder = localAccountUtils.incomingServer
.rootMsgFolder.createLocalSubfolder("Sent");
sentFolder = localAccountUtils.rootFolder.createLocalSubfolder("Sent");
do_check_eq(identity.doFcc, true);

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

@ -180,8 +180,7 @@ function run_test()
// Ensure we have at least one mail account
localAccountUtils.loadLocalMailAccount();
MailServices.accounts.setSpecialFolders();
sentFolder = localAccountUtils.incomingServer
.rootMsgFolder.createLocalSubfolder("Sent");
sentFolder = localAccountUtils.rootFolder.createLocalSubfolder("Sent");
// Test 1:
// Plain ASCII recipient address.

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

@ -119,8 +119,7 @@ function run_test() {
var smtpServer = getBasicSmtpServer();
var identity = getSmtpIdentity(kSender, smtpServer);
sentFolder = localAccountUtils.incomingServer
.rootMsgFolder.createLocalSubfolder("Sent");
sentFolder = localAccountUtils.rootFolder.createLocalSubfolder("Sent");
do_check_eq(identity.doFcc, true);

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

@ -194,8 +194,7 @@ function run_test() {
account.defaultIdentity = identity;
account.incomingServer = incomingServer;
sentFolder = localAccountUtils.incomingServer
.rootMsgFolder.createLocalSubfolder("Sent");
sentFolder = localAccountUtils.rootFolder.createLocalSubfolder("Sent");
do_check_eq(identity.doFcc, true);

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

@ -237,7 +237,7 @@ function run_test() {
account.defaultIdentity = identity;
account.incomingServer = incomingServer;
localAccountUtils.incomingServer.rootMsgFolder.createLocalSubfolder("Sent");
localAccountUtils.rootFolder.createLocalSubfolder("Sent");
gSentFolder = msgSendLater.getUnsentMessagesFolder(identity);

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

@ -141,8 +141,7 @@ function run_test() {
account.defaultIdentity = identity;
account.incomingServer = incomingServer;
sentFolder = localAccountUtils.incomingServer
.rootMsgFolder.createLocalSubfolder("Sent");
sentFolder = localAccountUtils.rootFolder.createLocalSubfolder("Sent");
identity.doFcc = false;

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

@ -95,8 +95,7 @@ function run_test() {
let identity = getSmtpIdentity(null, getBasicSmtpServer());
let rootFolder = localAccountUtils.incomingServer.rootMsgFolder;
let draftFolder = rootFolder.createLocalSubfolder("Drafts");
let draftFolder = localAccountUtils.rootFolder.createLocalSubfolder("Drafts");
let progress = Cc["@mozilla.org/messenger/progress;1"]
.createInstance(Ci.nsIMsgProgress);

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

@ -3,6 +3,7 @@ Components.utils.import("resource:///modules/mailServices.js");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://testing-common/mailnews/mailDirService.js");
Components.utils.import("resource://testing-common/mailnews/mailTestUtils.js");
Components.utils.import("resource://testing-common/mailnews/localAccountUtils.js");
var Cc = Components.classes;
var Ci = Components.interfaces;
@ -10,6 +11,3 @@ var Cr = Components.results;
var CC = Components.Constructor;
var gProfileDir = ProfileDir.initialize(do_get_profile());
// Import the main scripts that mailnews tests need to set up and tear down
load("../../../../resources/localAccountUtils.js");

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

@ -3,6 +3,7 @@ Components.utils.import("resource:///modules/mailServices.js");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://testing-common/mailnews/mailDirService.js");
Components.utils.import("resource://testing-common/mailnews/mailTestUtils.js");
Components.utils.import("resource://testing-common/mailnews/localAccountUtils.js");
var Cc = Components.classes;
var Ci = Components.interfaces;
@ -11,9 +12,6 @@ var CC = Components.Constructor;
var gProfileDir = ProfileDir.initialize(do_get_profile());
// Import the main scripts that mailnews tests need to set up and tear down
load("../../../../resources/localAccountUtils.js");
Components.utils.import("resource://gre/modules/Services.jsm");
function getSpec(aFileName)

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

@ -2,6 +2,7 @@ Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource:///modules/mailServices.js");
Components.utils.import("resource://testing-common/mailnews/mailDirService.js");
Components.utils.import("resource://testing-common/mailnews/mailTestUtils.js");
Components.utils.import("resource://testing-common/mailnews/localAccountUtils.js");
var Cc = Components.classes;
var Ci = Components.interfaces;
@ -9,6 +10,3 @@ var Cr = Components.results;
var CC = Components.Constructor;
var gProfileDir = ProfileDir.initialize(do_get_profile());
// Import the main scripts that mailnews tests need to set up and tear down
load("../../../../resources/localAccountUtils.js");

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

@ -8,6 +8,7 @@ Components.utils.import("resource:///modules/mailServices.js");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://testing-common/mailnews/mailDirService.js");
Components.utils.import("resource://testing-common/mailnews/mailTestUtils.js");
Components.utils.import("resource://testing-common/mailnews/localAccountUtils.js");
var Cc = Components.classes;
var Ci = Components.interfaces;
@ -21,9 +22,6 @@ Components.utils.import("resource://testing-common/mailnews/maild.js");
Components.utils.import("resource://testing-common/mailnews/imapd.js");
Components.utils.import("resource://testing-common/mailnews/auth.js");
// And mailnews scripts
load(gDEPTH + "mailnews/resources/localAccountUtils.js");
const IMAP_PORT = 1024 + 143;
function makeServer(daemon, infoString, otherProps) {

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

@ -114,10 +114,8 @@ function setup() {
setupIMAPPump();
gEmptyLocal1 = localAccountUtils.incomingServer.rootFolder
.createLocalSubfolder("empty 1");
gEmptyLocal2 = localAccountUtils.incomingServer
.rootFolder.createLocalSubfolder("empty 2");
gEmptyLocal1 = localAccountUtils.rootFolder.createLocalSubfolder("empty 1");
gEmptyLocal2 = localAccountUtils.rootFolder.createLocalSubfolder("empty 2");
// these hacks are required because we've created the inbox before
// running initial folder discovery, and adding the folder bails

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

@ -355,8 +355,7 @@ function run_test()
Services.prefs.setBoolPref("mail.biff.show_tray_icon", false);
Services.prefs.setBoolPref("mail.biff.animate_dock_icon", false);
gSubfolder = localAccountUtils.incomingServer
.rootFolder.createLocalSubfolder("Subfolder");
gSubfolder = localAccountUtils.rootFolder.createLocalSubfolder("Subfolder");
gIMAPIncomingServer.performExpand(null);
gRootFolder = gIMAPIncomingServer.rootFolder;

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

@ -100,14 +100,10 @@ var tests = [
function setup() {
setupIMAPPump();
gEmptyLocal1 = localAccountUtils.incomingServer
.rootFolder.createLocalSubfolder("empty 1");
gEmptyLocal2 = localAccountUtils.incomingServer
.rootFolder.createLocalSubfolder("empty 2");
gEmptyLocal3 = localAccountUtils.incomingServer
.rootFolder.createLocalSubfolder("empty 3");
gNotEmptyLocal4 = localAccountUtils.incomingServer
.rootFolder.createLocalSubfolder("not empty 4");
gEmptyLocal1 = localAccountUtils.rootFolder.createLocalSubfolder("empty 1");
gEmptyLocal2 = localAccountUtils.rootFolder.createLocalSubfolder("empty 2");
gEmptyLocal3 = localAccountUtils.rootFolder.createLocalSubfolder("empty 3");
gNotEmptyLocal4 = localAccountUtils.rootFolder.createLocalSubfolder("not empty 4");
let messageGenerator = new MessageGenerator();
let message = messageGenerator.makeMessage();

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

@ -3,6 +3,7 @@ Components.utils.import("resource:///modules/mailServices.js");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://testing-common/mailnews/mailDirService.js");
Components.utils.import("resource://testing-common/mailnews/mailTestUtils.js");
Components.utils.import("resource://testing-common/mailnews/localAccountUtils.js");
var Cc = Components.classes;
var Ci = Components.interfaces;
@ -13,9 +14,6 @@ var gProfileDir = ProfileDir.initialize(do_get_profile());
var gDEPTH = "../../../../";
// Import the main scripts that mailnews tests need to set up and tear down
load("../../../resources/localAccountUtils.js");
// Import the pop3 server scripts
Components.utils.import("resource://testing-common/mailnews/maild.js");
Components.utils.import("resource://testing-common/mailnews/auth.js");

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

@ -123,8 +123,7 @@ function run_test()
if (!localAccountUtils.inboxFolder)
localAccountUtils.loadLocalMailAccount();
gMoveFolder = localAccountUtils.incomingServer
.rootFolder.createLocalSubfolder("MoveFolder");
gMoveFolder = localAccountUtils.rootFolder.createLocalSubfolder("MoveFolder");
MailServices.mailSession.AddFolderListener(FolderListener,
Ci.nsIFolderListener.event |

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

@ -115,8 +115,7 @@ function run_test()
if (!localAccountUtils.inboxFolder)
localAccountUtils.loadLocalMailAccount();
gMoveFolder = localAccountUtils.incomingServer
.rootFolder.createLocalSubfolder("MoveFolder");
gMoveFolder = localAccountUtils.rootFolder.createLocalSubfolder("MoveFolder");
MailServices.mailSession.AddFolderListener(FolderListener,
Ci.nsIFolderListener.event |

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

@ -105,8 +105,7 @@ function run_test()
if (!localAccountUtils.inboxFolder)
localAccountUtils.loadLocalMailAccount();
gMoveFolder = localAccountUtils.incomingServer
.rootFolder.createLocalSubfolder("MoveFolder");
gMoveFolder = localAccountUtils.rootFolder.createLocalSubfolder("MoveFolder");
MailServices.mailSession.AddFolderListener(FolderListener,
Ci.nsIFolderListener.event |

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

@ -6,7 +6,7 @@
* This test iterates over the test files in gTestFiles, and streams
* each as a message and makes sure the streaming doesn't assert or crash.
*/
load("../../../resources/localAccountUtils.js");
Components.utils.import("resource://testing-common/mailnews/localAccountUtils.js");
Components.utils.import("resource:///modules/IOUtils.js");
var gTestFiles =[

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

@ -2,6 +2,7 @@ Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource:///modules/mailServices.js");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://testing-common/mailnews/mailDirService.js");
Components.utils.import("resource://testing-common/mailnews/localAccountUtils.js");
var Cc = Components.classes;
var Ci = Components.interfaces;
@ -14,11 +15,6 @@ var gProfileDir = ProfileDir.initialize(do_get_profile());
Components.utils.import("resource://testing-common/mailnews/maild.js");
Components.utils.import("resource://testing-common/mailnews/nntpd.js");
// Generic mailnews resource scripts
load("../../../resources/localAccountUtils.js");
Components.utils.import("resource:///modules/mailServices.js");
const kSimpleNewsArticle =
"From: John Doe <john.doe@example.com>\n"+
"Date: Sat, 24 Mar 1990 10:59:24 -0500\n"+

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

@ -12,6 +12,7 @@
*/
Components.utils.import("resource:///modules/mailServices.js");
Components.utils.import("resource://testing-common/mailnews/localAccountUtils.js");
// Make sure we execute this file exactly once
if (typeof gIMAPpump_js__ == "undefined") {
@ -28,9 +29,6 @@ Components.utils.import("resource://testing-common/mailnews/maild.js");
Components.utils.import("resource://testing-common/mailnews/auth.js");
Components.utils.import("resource://testing-common/mailnews/imapd.js");
// Add localAccountUtils for create_incoming_server
load(gDEPTH + "mailnews/resources/localAccountUtils.js");
// define globals
var gIMAPDaemon; // the imap fake server daemon
var gIMAPServer; // the imap fake server

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

@ -16,6 +16,7 @@
*/
Components.utils.import("resource:///modules/mailServices.js");
Components.utils.import("resource://testing-common/mailnews/localAccountUtils.js");
// We can be executed from multiple depths
// Provide understandable error message
@ -27,9 +28,6 @@ Components.utils.import("resource://testing-common/mailnews/maild.js");
Components.utils.import("resource://testing-common/mailnews/auth.js");
Components.utils.import("resource://testing-common/mailnews/pop3d.js");
// Add localAccountUtils for create_incoming_server
load(gDEPTH + "mailnews/resources/localAccountUtils.js");
function POP3Pump()
{
// public attributes

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

@ -2,10 +2,15 @@
* 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/. */
// Make sure we execute this file exactly once
var gLocalAccountUtils_js__;
if (!gLocalAccountUtils_js__) {
gLocalAccountUtils_js__ = true;
const EXPORTED_SYMBOLS = ['localAccountUtils'];
// MailServices
Components.utils.import("resource:///modules/mailServices.js");
var Cc = Components.classes;
var Ci = Components.interfaces;
var Cr = Components.results;
var CC = Components.Constructor;
// Local Mail Folders. Requires prior setup of profile directory
@ -114,5 +119,3 @@ var localAccountUtils = {
aIncoming.defaultIdentity = identity;
}
};
}; // gLocalAccountUtils_js__