Bug 482768 xpcshell tests broken on trunk due to mozilla-central changes. r=KaiRo.
authorMark Banner <bugzilla@standard8.plus.com>
Fri, 27 Mar 2009 13:22:12 +0000
changeset 2297 90ad0990c8a6bc8d51315d3083ec5cd8d628f0e3
parent 2296 90b63564abccf71d5ddb4f7ca338bd9ff165ed00
child 2298 5b7638646d00da628bf654030fa8fdd87993fa40
push idunknown
push userunknown
push dateunknown
reviewersKaiRo
bugs482768
Bug 482768 xpcshell tests broken on trunk due to mozilla-central changes. r=KaiRo.
config/rules.mk
mailnews/Makefile.in
mailnews/addrbook/test/resources/abLists1.mab
mailnews/addrbook/test/resources/abLists2.mab
mailnews/addrbook/test/resources/abSetup.js
mailnews/addrbook/test/resources/readme.txt
mailnews/addrbook/test/unit/head_addrbook.js
mailnews/addrbook/test/unit/test_bug387403.js
mailnews/addrbook/test/unit/test_cardForEmail.js
mailnews/addrbook/test/unit/test_collection_2.js
mailnews/addrbook/test/unit/test_mailList1.js
mailnews/addrbook/test/unit/test_nsAbAutoCompleteSearch1.js
mailnews/addrbook/test/unit/test_nsAbAutoCompleteSearch2.js
mailnews/addrbook/test/unit/test_nsIAbCard.js
mailnews/base/test/resources/msgFolderListenerSetup.js
mailnews/base/test/unit/head_mailbase.js
mailnews/base/test/unit/test_bccInDatabase.js
mailnews/base/test/unit/test_bug366491.js
mailnews/base/test/unit/test_bug404489.js
mailnews/base/test/unit/test_bug428427.js
mailnews/base/test/unit/test_bug465805.js
mailnews/base/test/unit/test_bug471682.js
mailnews/base/test/unit/test_folderCompact.js
mailnews/base/test/unit/test_getMsgTextFromStream.js
mailnews/base/test/unit/test_junkWhitelisting.js
mailnews/base/test/unit/test_nsIMsgFolderListenerLocal.js
mailnews/base/test/unit/test_nsMsgDBView.js
mailnews/base/test/unit/test_searchAddressInAb.js
mailnews/base/test/unit/test_searchJunk.js
mailnews/base/test/unit/test_searchTag.js
mailnews/compose/test/unit/head_compose.js
mailnews/compose/test/unit/test_bug155172.js
mailnews/compose/test/unit/test_bug474774.js
mailnews/compose/test/unit/test_nsMsgCompose1.js
mailnews/compose/test/unit/test_sendBackground.js
mailnews/compose/test/unit/test_sendMailMessage.js
mailnews/compose/test/unit/test_sendMessageFile.js
mailnews/compose/test/unit/test_sendMessageLater.js
mailnews/compose/test/unit/test_sendMessageLater2.js
mailnews/compose/test/unit/test_sendMessageLater3.js
mailnews/compose/test/unit/test_smtpPassword.js
mailnews/compose/test/unit/test_smtpPassword2.js
mailnews/db/gloda/test/resources/glodaTestHelper.js
mailnews/db/gloda/test/resources/messageGenerator.js
mailnews/db/gloda/test/resources/mockIndexer.js
mailnews/db/gloda/test/resources/mockTimer.js
mailnews/db/gloda/test/unit/resources/glodaTestHelper.js
mailnews/db/gloda/test/unit/resources/mockIndexer.js
mailnews/db/gloda/test/unit/resources/mockTimer.js
mailnews/db/gloda/test/unit/test_cleanup_msf_databases.js
mailnews/db/gloda/test/unit/test_gloda_content.js
mailnews/db/gloda/test/unit/test_index_adaptive.js
mailnews/db/gloda/test/unit/test_index_messages.js
mailnews/db/gloda/test/unit/test_index_messages_in_bulk.js
mailnews/db/gloda/test/unit/test_intl.js
mailnews/db/gloda/test/unit/test_mime_emitter.js
mailnews/db/gloda/test/unit/test_noun_mimetype.js
mailnews/db/gloda/test/unit/test_query_core.js
mailnews/db/gloda/test/unit/test_query_messages.js
mailnews/db/msgdb/test/unit/head_maildb.js
mailnews/db/msgdb/test/unit/test_maildb.js
mailnews/db/msgdb/test/unit/test_references_parsing.js
mailnews/extensions/bayesian-spam-filter/test/resources/ham1.eml
mailnews/extensions/bayesian-spam-filter/test/resources/ham2.eml
mailnews/extensions/bayesian-spam-filter/test/resources/spam1.eml
mailnews/extensions/bayesian-spam-filter/test/resources/spam2.eml
mailnews/extensions/bayesian-spam-filter/test/resources/spam3.eml
mailnews/extensions/bayesian-spam-filter/test/resources/spam4.eml
mailnews/extensions/bayesian-spam-filter/test/resources/tokenTest.eml
mailnews/extensions/bayesian-spam-filter/test/resources/trainingfile.js
mailnews/extensions/bayesian-spam-filter/test/unit/head_bayes.js
mailnews/extensions/bayesian-spam-filter/test/unit/resources/ham1.eml
mailnews/extensions/bayesian-spam-filter/test/unit/resources/ham2.eml
mailnews/extensions/bayesian-spam-filter/test/unit/resources/spam1.eml
mailnews/extensions/bayesian-spam-filter/test/unit/resources/spam2.eml
mailnews/extensions/bayesian-spam-filter/test/unit/resources/spam3.eml
mailnews/extensions/bayesian-spam-filter/test/unit/resources/spam4.eml
mailnews/extensions/bayesian-spam-filter/test/unit/resources/tokenTest.eml
mailnews/extensions/bayesian-spam-filter/test/unit/resources/trainingfile.js
mailnews/extensions/bayesian-spam-filter/test/unit/test_bug228675.js
mailnews/imap/test/unit/head_server.js
mailnews/imap/test/unit/test_bug460636.js
mailnews/imap/test/unit/test_compactOfflineStore.js
mailnews/imap/test/unit/test_downloadOffline.js
mailnews/imap/test/unit/test_nsIMsgFolderListenerIMAP.js
mailnews/import/test/resources/AB_README
mailnews/import/test/resources/addressbook.json
mailnews/import/test/resources/basic_addressbook.csv
mailnews/import/test/resources/basic_ldif_addressbook.ldif
mailnews/import/test/resources/import_helper.js
mailnews/import/test/unit/head_import.js
mailnews/import/test/unit/resources/AB_README
mailnews/import/test/unit/resources/addressbook.json
mailnews/import/test/unit/resources/basic_addressbook.csv
mailnews/import/test/unit/resources/basic_ldif_addressbook.ldif
mailnews/import/test/unit/resources/import_helper.js
mailnews/import/test/unit/test_bug_437556.js
mailnews/import/test/unit/test_ldif_import.js
mailnews/local/test/unit/head_maillocal.js
mailnews/local/test/unit/test_msgCopy.js
mailnews/local/test/unit/test_pop3Password.js
mailnews/local/test/unit/test_pop3Password2.js
mailnews/local/test/unit/test_pop3Password3.js
mailnews/mime/test/unit/head_mime.js
mailnews/news/test/postings/auto-add/post1.eml
mailnews/news/test/postings/auto-add/post2.eml
mailnews/news/test/postings/auto-add/post3.eml
mailnews/news/test/postings/auto-add/post4.eml
mailnews/news/test/postings/auto-add/post5.eml
mailnews/news/test/postings/auto-add/post6.eml
mailnews/news/test/postings/auto-add/post7.eml
mailnews/news/test/postings/post1.eml
mailnews/news/test/unit/head_server_setup.js
mailnews/news/test/unit/postings/auto-add/post1.eml
mailnews/news/test/unit/postings/auto-add/post2.eml
mailnews/news/test/unit/postings/auto-add/post3.eml
mailnews/news/test/unit/postings/auto-add/post4.eml
mailnews/news/test/unit/postings/auto-add/post5.eml
mailnews/news/test/unit/postings/auto-add/post6.eml
mailnews/news/test/unit/postings/auto-add/post7.eml
mailnews/news/test/unit/postings/post1.eml
mailnews/news/test/unit/test_nntpPassword.js
mailnews/news/test/unit/test_nntpPassword2.js
mailnews/news/test/unit/test_nntpPassword3.js
mailnews/news/test/unit/test_server.js
mailnews/test/data/abLists1.mab
mailnews/test/data/abLists2.mab
mailnews/test/data/readme.txt
mailnews/test/fakeserver/pop3d.js
mailnews/test/resources/abSetup.js
mailnews/test/resources/messageGenerator.js
mailnews/test/resources/msgFolderListenerSetup.js
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -122,127 +122,65 @@ ifdef ENABLE_TESTS
 ifdef XPCSHELL_TESTS
 ifndef MODULE
 $(error Must define MODULE when defining XPCSHELL_TESTS.)
 endif
 
 testxpcobjdir = $(MOZDEPTH)/_tests/xpcshell
 
 # Test file installation
-ifdef MOZILLA_1_9_1_BRANCH
-
-libs::
-	@$(EXIT_ON_ERROR) \
-	for testdir in $(XPCSHELL_TESTS); do \
-	  $(INSTALL) \
-	    $(srcdir)/$$testdir/*.js \
-	    $(testxpcobjdir)/$(MODULE)/$$testdir; \
-	done
-
-# Path formats on Windows are hard.  We require a topsrcdir formatted so that
-# it may be passed to nsILocalFile.initWithPath (in other words, an absolute
-# path of the form X:\path\to\topsrcdir), which we store in NATIVE_TOPSRCDIR.
-# We require a forward-slashed path to topsrcdir so that it may be combined
-# with a relative forward-slashed path for loading scripts, both dynamically
-# and statically for head/test/tail JS files.  Of course, on non-Windows none
-# of this matters, and things will work correctly because everything's
-# forward-slashed, everywhere, always.
-ifdef CYGWIN_WRAPPER
-NATIVE_TOPSRCDIR   := `cygpath -wa $(MOZILLA_SRCDIR)`
-FWDSLASH_TOPSRCDIR := `cygpath -ma $(MOZILLA_SRCDIR)`
+ifdef NSINSTALL_BIN
+# nsinstall in moztools can't recursively copy directories, so use nsinstall.py
+TEST_INSTALLER = $(PYTHON) $(MOZILLA_SRCDIR)/config/nsinstall.py
 else
-FWDSLASH_TOPSRCDIR := $(MOZILLA_SRCDIR)
-ifeq ($(HOST_OS_ARCH),WINNT)
-NATIVE_TOPSRCDIR   := $(subst /,\\,$(WIN_TOP_SRC)/mozilla)
-else 
-NATIVE_TOPSRCDIR   := $(MOZILLA_SRCDIR)
+TEST_INSTALLER = $(INSTALL)
 endif
-endif # CYGWIN_WRAPPER
-
-testxpcsrcdir = $(MOZILLA_SRCDIR)/testing/xpcshell
-
-# Test execution
-check::
-	@$(EXIT_ON_ERROR) \
-	for testdir in $(XPCSHELL_TESTS); do \
-	  $(RUN_TEST_PROGRAM) \
-	    $(testxpcsrcdir)/test_all.sh \
-	      $(DIST)/bin/xpcshell \
-	      $(FWDSLASH_TOPSRCDIR) \
-	      $(NATIVE_TOPSRCDIR) \
-	      $(testxpcobjdir)/$(MODULE)/$$testdir; \
-	done
-
-# Test execution
-check-interactive::
-	@$(EXIT_ON_ERROR) \
-	$(RUN_TEST_PROGRAM) \
-	  $(testxpcsrcdir)/test_one.sh \
-	    $(DIST)/bin/xpcshell \
-	    $(FWDSLASH_TOPSRCDIR) \
-	    $(NATIVE_TOPSRCDIR) \
-	    $(testxpcobjdir)/$(MODULE)/$$testdir \
-	    $(SOLO_FILE) 1;
-
-# Test execution
-check-one::
-	@$(EXIT_ON_ERROR) \
-	$(RUN_TEST_PROGRAM) \
-	  $(testxpcsrcdir)/test_one.sh \
-	    $(DIST)/bin/xpcshell \
-	    $(FWDSLASH_TOPSRCDIR) \
-	    $(NATIVE_TOPSRCDIR) \
-	    $(testxpcobjdir)/$(MODULE)/$$testdir \
-	    $(SOLO_FILE) 0;
-
-else # MOZILLA_1_9_1_BRANCH
 
 define _INSTALL_TESTS
-$(INSTALL) $(wildcard $(srcdir)/$(dir)/*.js) $(testxpcobjdir)/$(MODULE)/$(dir)
+$(TEST_INSTALLER) $(wildcard $(srcdir)/$(dir)/*) $(testxpcobjdir)/$(MODULE)/$(dir)
+@echo "$(MODULE)/$(dir)" >> $(testxpcobjdir)/all-test-dirs.list
 
 endef # do not remove the blank line!
 
 SOLO_FILE ?= $(error Specify a test filename in SOLO_FILE when using check-interactive or check-one)
 
 libs::
 	$(foreach dir,$(XPCSHELL_TESTS),$(_INSTALL_TESTS))
+	$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl \
+	  $(testxpcobjdir)/all-test-dirs.list \
+	  $(addprefix $(MODULE)/,$(XPCSHELL_TESTS))
 
 testxpcsrcdir = $(MOZILLA_SRCDIR)/testing/xpcshell
 
 # Execute all tests in the $(XPCSHELL_TESTS) directories.
 check::
 	$(PYTHON) \
           $(testxpcsrcdir)/runxpcshelltests.py \
           $(DIST)/bin/xpcshell \
-          $(MOZILLA_SRCDIR) \
           $(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(MODULE)/$(dir))
 
 # Execute a single test, specified in $(SOLO_FILE), but don't automatically
 # start the test. Instead, present the xpcshell prompt so the user can
 # attach a debugger and then start the test.
 check-interactive::
 	$(PYTHON) \
           $(testxpcsrcdir)/runxpcshelltests.py \
           --test=$(SOLO_FILE) \
           --interactive \
           $(DIST)/bin/xpcshell \
-          $(MOZILLA_SRCDIR) \
           $(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(MODULE)/$(dir))
 
 # Execute a single test, specified in $(SOLO_FILE)
 check-one::
 	$(PYTHON) \
           $(testxpcsrcdir)/runxpcshelltests.py \
           --test=$(SOLO_FILE) \
           $(DIST)/bin/xpcshell \
-          $(MOZILLA_SRCDIR) \
           $(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(MODULE)/$(dir))
 
-endif # MOZILLA_1_9_1_BRANCH
-
 endif # XPCSHELL_TESTS
 
 ifdef CPP_UNIT_TESTS
 
 # Compile the tests to $(DIST)/bin.  Make lots of niceties available by default
 # through TestHarness.h, by modifying the list of includes and the libs against
 # which stuff links.
 CPPSRCS += $(CPP_UNIT_TESTS)
--- a/mailnews/Makefile.in
+++ b/mailnews/Makefile.in
@@ -60,8 +60,13 @@ endif
 
 PREF_JS_EXPORTS = $(srcdir)/mailnews.js
 
 DEFINES += -DOS_ARCH=$(OS_ARCH) \
            -DMOZ_WIDGET_TOOLKIT=$(MOZ_WIDGET_TOOLKIT) \
            $(NULL)
 
 include $(topsrcdir)/config/rules.mk
+
+libs::
+	$(INSTALL) $(wildcard $(srcdir)/test/resources/*.js) $(MOZDEPTH)/_tests/xpcshell/mailnews/resources
+	$(INSTALL) $(wildcard $(srcdir)/test/data/*) $(MOZDEPTH)/_tests/xpcshell/mailnews/data
+	$(INSTALL) $(wildcard $(srcdir)/test/fakeserver/*.js) $(MOZDEPTH)/_tests/xpcshell/mailnews/fakeserver
deleted file mode 100644
--- a/mailnews/addrbook/test/resources/readme.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-This resources (mailnews/test/resources) directory contains various support
-files for the testing of mailnews.
-
----------------------------
-xpcshell Test Support Files
----------------------------
-
-Profile Directory setup and clean up scripts are in mailnews/test/resources
-and are included automatically by the head_addrbook.js and tail_addrbook.js
-files.
-
-abSetup.js
-----------
-
-Has kPABData and kCABData objects with the default address book setups in them.
-
----------------------
-General Support Files
----------------------
-
-abLists1.mab
-------------
-
-An address book with 5 cards and 3 lists. The cards only have the email and
-prefer mail format set:
-
-test1@invalid.com  unknown
-test2@invalid.com  unknown
-test3@invalid.com  unknown
-test4@invalid.com  plain text
-test5@invalid.com  html
-
-There are 3 lists, TestList1, TestList2 and TestList3. They have the following
-cards:
-
-TestList1:
-
-test1@invalid.com
-test2@invalid.com
-test3@invalid.com
-
-TestList2:
-
-test4@invalid.com
-
-TestList3:
-
-test5@invalid.com
-
-
-abLists2.mab
-------------
-
-The same as abLists1.mab, but with com.invalid instead of invalid.com, and ListTestX instead of TestListX.
--- a/mailnews/addrbook/test/unit/head_addrbook.js
+++ b/mailnews/addrbook/test/unit/head_addrbook.js
@@ -1,5 +1,5 @@
 // Import the main scripts that mailnews tests need to set up and tear down
-do_import_script("../mailnews/test/resources/mailDirService.js");
+load("../../mailnews/resources/mailDirService.js");
 
 // Import the required setup scripts.
-do_import_script("../mailnews/addrbook/test/resources/abSetup.js");
+load("../../mailnews/resources/abSetup.js");
--- a/mailnews/addrbook/test/unit/test_bug387403.js
+++ b/mailnews/addrbook/test/unit/test_bug387403.js
@@ -1,14 +1,14 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /**
  * Test for bug 387403 crash when opening e-mail with broken vcard.
  */
 
-do_import_script("../mailnews/test/resources/mailTestUtils.js");
+load("../../mailnews/resources/mailTestUtils.js");
 
 function run_test() {
   var abManager = Components.classes["@mozilla.org/abmanager;1"]
                             .getService(Components.interfaces.nsIAbManager);
 
   // Before bug 387403 this would hang, eating up all the memory until it
   // crashed.
   abManager.escapedVCardToAbCard("begin:vcard\nfn;quoted-printable:Xxxx=C5=82xx  Xxx\nn;quoted-printable:Xxx;Xxxx=C5=82xx \nadr;quoted-printable;quoted-printable;dom:;;xx. Xxxxxxxxxxxx X;Xxxxxx=C3=3");
--- a/mailnews/addrbook/test/unit/test_cardForEmail.js
+++ b/mailnews/addrbook/test/unit/test_cardForEmail.js
@@ -15,17 +15,17 @@ function check_correct_card(card) {
   do_check_eq(card.lastName, "LastName1");
   do_check_eq(card.displayName, "DisplayName1");
   do_check_eq(card.primaryEmail, "PrimaryEmail1@test.invalid");
   do_check_eq(card.getProperty("SecondEmail", "BAD"), "SecondEmail1\u00D0@test.invalid");
 }
 
 function run_test() {
   // Test setup - copy the data file into place
-  var testAB = do_get_file("../mailnews/addrbook/test/unit/data/cardForEmail.mab");
+  var testAB = do_get_file("data/cardForEmail.mab");
 
   // Copy the file to the profile directory for a PAB
   testAB.copyTo(gProfileDir, kPABData.fileName);
 
   // Test - Get the directory
   var abManager = Components.classes["@mozilla.org/abmanager;1"]
                             .getService(Components.interfaces.nsIAbManager);
 
--- a/mailnews/addrbook/test/unit/test_collection_2.js
+++ b/mailnews/addrbook/test/unit/test_collection_2.js
@@ -23,17 +23,17 @@ function run_test()
     Components.classes["@mozilla.org/addressbook/services/addressCollector;1"]
               .getService(Components.interfaces.nsIAbAddressCollector);
 
   // Set the new pref afterwards to ensure we change correctly
   prefService.setCharPref("mail.collect_addressbook", kCABData.URI);
 
   // For this test use an address book that isn't the one we're collecting
   // to.
-  var testAB = do_get_file("../mailnews/addrbook/test/unit/data/collect.mab");
+  var testAB = do_get_file("data/collect.mab");
 
   testAB.copyTo(gProfileDir, kPABData.fileName);
 
   // XXX Getting all directories ensures we create all ABs because the
   // address collecter can't currently create ABs itself (bug 314448).
   var temp = abManager.directories;
 
   addressCollect.collectAddress("Other Book <other@book.invalid>", true,
--- a/mailnews/addrbook/test/unit/test_mailList1.js
+++ b/mailnews/addrbook/test/unit/test_mailList1.js
@@ -27,17 +27,17 @@ function checkLists(childNodes, number) 
   }
 
   mailListArray.forEach(function (value) { do_check_neq(value, null); });
 }
 
 function run_test() {
   // Create a new card
   // Test setup - copy the data file into place
-  var testAB = do_get_file("../mailnews/addrbook/test/resources/abLists1.mab");
+  var testAB = do_get_file("../../mailnews/data/abLists1.mab");
 
   // Copy the file to the profile directory for a PAB
   testAB.copyTo(gProfileDir, kPABData.fileName);
 
   // Test - Get the directory.
 
   var abManager = Components.classes["@mozilla.org/abmanager;1"]
                             .getService(Components.interfaces.nsIAbManager);
--- a/mailnews/addrbook/test/unit/test_nsAbAutoCompleteSearch1.js
+++ b/mailnews/addrbook/test/unit/test_nsAbAutoCompleteSearch1.js
@@ -86,21 +86,21 @@ acObserver.prototype = {
   onSearchResult: function (aSearch, aResult) {
     this._search = aSearch;
     this._result = aResult;
   }
 };
 
 function run_test() {
   // Copy the data files into place
-  var testAB = do_get_file("../mailnews/addrbook/test/unit/data/autocomplete.mab");
+  var testAB = do_get_file("data/autocomplete.mab");
 
   testAB.copyTo(gProfileDir, kPABData.fileName);
 
-  testAB = do_get_file("../mailnews/addrbook/test/unit/data/cardForEmail.mab");
+  testAB = do_get_file("data/cardForEmail.mab");
 
   testAB.copyTo(gProfileDir, kCABData.fileName);
 
   // Test - Create a new search component
 
   var acs = Components.classes["@mozilla.org/autocomplete/search;1?name=addrbook"]
     .getService(Components.interfaces.nsIAutoCompleteSearch);
 
--- a/mailnews/addrbook/test/unit/test_nsAbAutoCompleteSearch2.js
+++ b/mailnews/addrbook/test/unit/test_nsAbAutoCompleteSearch2.js
@@ -3,18 +3,72 @@
  * Second Test suite for nsAbAutoCompleteSearch - test follow-on lookup after
  * a previous search.
  *
  * We run this test without address books, constructing manually ourselves,
  * so that we can ensure that we're not getting the data out of the address
  * books.
  */
 
-// We import this to allow us to reuse the code of the results object.
-do_import_script("../mailnews/addrbook/src/nsAbAutoCompleteSearch.js");
+Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+
+// taken from nsAbAutoCompleteSearch.js
+const ACR = Components.interfaces.nsIAutoCompleteResult;
+const nsIAbAutoCompleteResult = Components.interfaces.nsIAbAutoCompleteResult;
+
+function nsAbAutoCompleteResult(aSearchString) {
+  // Can't create this in the prototype as we'd get the same array for
+  // all instances
+  this._searchResults = new Array();
+  this.searchString = aSearchString;
+}
+
+nsAbAutoCompleteResult.prototype = {
+  _searchResults: null,
+
+  // nsIAutoCompleteResult
+
+  searchString: null,
+  searchResult: ACR.RESULT_NOMATCH,
+  defaultIndex: -1,
+  errorDescription: null,
+
+  get matchCount() {
+    return this._searchResults.length;
+  },
+
+  getValueAt: function getValueAt(aIndex) {
+    return this._searchResults[aIndex].value;
+  },
+
+  getCommentAt: function getCommentAt(aIndex) {
+    return this._searchResults[aIndex].comment;
+  },
+
+  getStyleAt: function getStyleAt(aIndex) {
+    return "local-abook";
+  },
+
+  getImageAt: function getImageAt(aIndex) {
+    return "";
+  },
+
+  removeValueAt: function removeValueAt(aRowIndex, aRemoveFromDB) {
+  },
+
+  // nsIAbAutoCompleteResult
+
+  getCardAt: function getCardAt(aIndex) {
+    return this._searchResults[aIndex].card;
+  },
+
+  // nsISupports
+
+  QueryInterface: XPCOMUtils.generateQI([ACR, nsIAbAutoCompleteResult])
+}
 
 function createCard(chars, popularity) {
   var card = Components.classes["@mozilla.org/addressbook/cardproperty;1"]
                        .createInstance(Components.interfaces.nsIAbCard);
 
   card.firstName = "firstName".slice(0, chars);
   card.lastName = "lastName".slice(0, chars);
   card.displayName = "displayName".slice(0, chars);
--- a/mailnews/addrbook/test/unit/test_nsIAbCard.js
+++ b/mailnews/addrbook/test/unit/test_nsIAbCard.js
@@ -6,17 +6,17 @@
  * up all the parameters correctly. We'll have to extend them as we develop
  * the address book more, especially looking towards standards etc.
  */
 
 // Main function for the this test so we can check both personal and
 // collected books work correctly in an easy manner.
 function run_test() {
   // Test setup - copy the data file into place
-  var testAB = do_get_file("../mailnews/addrbook/test/unit/data/cardForEmail.mab");
+  var testAB = do_get_file("data/cardForEmail.mab");
 
   // Copy the file to the profile directory for a PAB
   testAB.copyTo(gProfileDir, kPABData.fileName);
 
   // Test - Get the directory
   var abManager = Components.classes["@mozilla.org/abmanager;1"]
                             .getService(Components.interfaces.nsIAbManager);
 
--- a/mailnews/base/test/unit/head_mailbase.js
+++ b/mailnews/base/test/unit/head_mailbase.js
@@ -1,3 +1,3 @@
 // Import the main scripts that mailnews tests need to set up and tear down
-do_import_script("../mailnews/test/resources/mailDirService.js");
-do_import_script("../mailnews/test/resources/mailTestUtils.js");
+load("../../mailnews/resources/mailDirService.js");
+load("../../mailnews/resources/mailTestUtils.js");
--- a/mailnews/base/test/unit/test_bccInDatabase.js
+++ b/mailnews/base/test/unit/test_bccInDatabase.js
@@ -52,17 +52,17 @@ function run_test()
     OnStartCopy: function() {},
     OnProgress: function(aProgress, aProgressMax) {},
     SetMessageKey: function(aKey) { hdr = gLocalInboxFolder.GetMessageHeader(aKey);},
     SetMessageId: function(aMessageId) {},
     OnStopCopy: function(aStatus) { continueTest();}
   };
 
   // Get a message into the local filestore.
-  var draft = do_get_file("../mailnews/test/data/draft1");
+  var draft = do_get_file("../../mailnews/data/draft1");
   do_test_pending();
   copyService.CopyFileMessage(draft, gLocalInboxFolder, null, false, 0,
                               "", copyListener, null);
 }
 
 function continueTest()
 {
   //dump("\nbccList >" + hdr.bccList);
--- a/mailnews/base/test/unit/test_bug366491.js
+++ b/mailnews/base/test/unit/test_bug366491.js
@@ -121,13 +121,13 @@ var doTestingListener =
       do_test_finished();
   }
 };
 
 // helper functions
 
 function getSpec(aFileName)
 {
-  var file = do_get_file("../mailnews/extensions/bayesian-spam-filter/test/resources/" + aFileName);
+  var file = do_get_file("../../test_bayes/unit/resources/" + aFileName);
   var uri = nsIIOService.newFileURI(file).QueryInterface(Ci.nsIURL);
   uri.query = "type=application/x-message-display";
   return uri.spec;
 }
--- a/mailnews/base/test/unit/test_bug404489.js
+++ b/mailnews/base/test/unit/test_bug404489.js
@@ -44,17 +44,17 @@ const gPrefs = Cc["@mozilla.org/preferen
 
 const nsMsgSearchScope = Ci.nsMsgSearchScope;
 const nsMsgSearchAttrib = Ci.nsMsgSearchAttrib;
 const nsMsgSearchOp = Ci.nsMsgSearchOp;
 const Contains = nsMsgSearchOp.Contains;
 const offlineMail = nsMsgSearchScope.offlineMail;
 const gArrayHdrs = ["X-Bugzilla-Who", "Sender"];
 const gFirstHeader = nsMsgSearchAttrib.OtherHeader + 1;
-const fileName = "../mailnews/test/data/SenderHeader";
+const fileName = "../../mailnews/data/SenderHeader";
 
 var Tests =
 [
   /* test header:
   X-Bugzilla-Who: bugmail@example.org
 
   This just shows that normal custom headers work
   */
--- a/mailnews/base/test/unit/test_bug428427.js
+++ b/mailnews/base/test/unit/test_bug428427.js
@@ -37,17 +37,17 @@
 // Test of message count changes in virtual folder views
 
 const copyService = Cc["@mozilla.org/messenger/messagecopyservice;1"]
                       .getService(Ci.nsIMsgCopyService);
 const tagService = Cc["@mozilla.org/messenger/tagservice;1"]
                      .getService(Ci.nsIMsgTagService);
 const dbviewContractId = "@mozilla.org/messenger/msgdbview;1?type=" + "quicksearch";
 const dbView = Cc[dbviewContractId].createInstance(Ci.nsIMsgDBView);
-const bugmail1 = do_get_file("../mailnews/test/data/bugmail1");
+const bugmail1 = do_get_file("../../mailnews/data/bugmail1");
 // I'm only loading msgDBService to help load symbols for debugging
 //const msgDBService = Cc["@mozilla.org/msgDatabase/msgDBService;1"]
 //                     .getService(Ci.nsIMsgDBService);
                      
 // main test
 
 // the headers for the test messages. All messages are identical, but
 // have different properties set on them.
--- a/mailnews/base/test/unit/test_bug465805.js
+++ b/mailnews/base/test/unit/test_bug465805.js
@@ -32,17 +32,17 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 // This tests that we do not crash when loading the email bodySearchCrash,
 // which was fixed in bug 465805
 
-do_import_script("../mailnews/test/resources/searchTestUtils.js");
+load("../../mailnews/resources/searchTestUtils.js");
 
 const copyService = Cc["@mozilla.org/messenger/messagecopyservice;1"].
                       getService(Ci.nsIMsgCopyService);
 
 const nsMsgSearchScope = Ci.nsMsgSearchScope;
 const nsMsgSearchAttrib = Ci.nsMsgSearchAttrib;
 const nsMsgSearchOp = Ci.nsMsgSearchOp;
 
@@ -50,18 +50,18 @@ const Contains = nsMsgSearchOp.Contains;
 
 const offlineMail = nsMsgSearchScope.offlineMail;
 const offlineMailFilter = nsMsgSearchScope.offlineMailFilter;
 
 const Body = nsMsgSearchAttrib.Body;
 
 var Files = 
 [
-  "../mailnews/test/data/bugmail1",
-  "../mailnews/test/data/bodySearchCrash"
+  "../../mailnews/data/bugmail1",
+  "../../mailnews/data/bodySearchCrash"
 ]
 
 var Tests =
 [
 
 // this number appears in bugmail1
   { value: "432710",
     attrib: Body,
--- a/mailnews/base/test/unit/test_bug471682.js
+++ b/mailnews/base/test/unit/test_bug471682.js
@@ -37,17 +37,17 @@
 /*
  * Test of message database validity on local copy from bug 471682. What
  * we want to do here is to copy a couple of message to a new folder, and
  * then compare the date and filesize of the folder file with the
  * stored result in dbfolderinfo. If they don't match, that's bad.
  */
 const copyService = Cc["@mozilla.org/messenger/messagecopyservice;1"]
                       .getService(Ci.nsIMsgCopyService);
-const bugmail1 = do_get_file("../mailnews/test/data/bugmail1");
+const bugmail1 = do_get_file("../../mailnews/data/bugmail1");
 var gHdr; // header of test message in local folder
 
 loadLocalMailAccount();
 // create a subfolder as a target for copies
 var gSubfolder = gLocalInboxFolder.addSubfolder("subfolder");
 
 function run_test()
 {
--- a/mailnews/base/test/unit/test_folderCompact.js
+++ b/mailnews/base/test/unit/test_folderCompact.js
@@ -156,19 +156,19 @@ const gTestArray =
     urlListener.OnStopRunningUrl(null, 0);
   }
 ];
 
 function run_test()
 {
   loadLocalMailAccount();
   // Load up some messages so that we can copy them in later.
-  gMsgFile1 = do_get_file("../mailnews/test/data/bugmail10");
-  gMsgFile2 = do_get_file("../mailnews/test/data/bugmail11");
-  gMsgFile3 = do_get_file("../mailnews/test/data/draft1");
+  gMsgFile1 = do_get_file("../../mailnews/data/bugmail10");
+  gMsgFile2 = do_get_file("../../mailnews/data/bugmail11");
+  gMsgFile3 = do_get_file("../../mailnews/data/draft1");
 
   // Create another folder to move and copy messages around, and force initialization.
   var rootFolder = gLocalIncomingServer.rootMsgFolder;
   gLocalFolder2 = rootFolder.addSubfolder("folder2");
   var folderName = gLocalFolder2.prettiestName;
   // Create a third folder for more testing.
   gLocalFolder3 = rootFolder.addSubfolder("folder3");
   folderName = gLocalFolder3.prettiestName;
--- a/mailnews/base/test/unit/test_getMsgTextFromStream.js
+++ b/mailnews/base/test/unit/test_getMsgTextFromStream.js
@@ -9,17 +9,17 @@
 /**
  * Test suite for GetMsgTextFromStream.
  *
  * Currently tests: text/plain, text/html -- with tags stripped and without,
  * base64, multipart.
  * Does not currently test: quoted-printable, stripping quotes, UTF-8, small values of
  * bytesToRead.
  */
-const kDataRoot = "../mailnews/test/data/"
+const kDataRoot = "../../mailnews/data/"
 
 function create(fileName, bytes, compressQuotes, stripHTML, outContentType)
 {
   return {name: fileName, bytesToRead: bytes, compressQuotes: compressQuotes, stripHTML: stripHTML,
           contentType: outContentType};
 }
 
 const gTestFiles =
--- a/mailnews/base/test/unit/test_junkWhitelisting.js
+++ b/mailnews/base/test/unit/test_junkWhitelisting.js
@@ -34,17 +34,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 /*
  * Testing of junk whitelisting
  */
  
 // add address book setup
-do_import_script("../mailnews/addrbook/test/resources/abSetup.js");
+load("../../mailnews/resources/abSetup.js");
 
 const copyService = Cc["@mozilla.org/messenger/messagecopyservice;1"]
                       .getService(Ci.nsIMsgCopyService);
 const prefs = Cc["@mozilla.org/preferences-service;1"]
                 .getService(Ci.nsIPrefBranch);
 
 /*
  * The address available in the test address book is "PrimaryEmail1@test.invalid"
@@ -59,28 +59,28 @@ const prefs = Cc["@mozilla.org/preferenc
  */
  
  // indices into hdrs[] of email by domain
  const kDomainTest = 0;
  const kDomainExample = 1;
 
 var Files = 
 [
-  "../mailnews/test/data/bugmail1",
-  "../mailnews/test/data/bugmail3"
+  "../../mailnews/data/bugmail1",
+  "../../mailnews/data/bugmail3"
 ]
 
 let hdrs = [];
 
 function run_test()
 {
   loadLocalMailAccount();
 
   // Test setup - copy the data file into place
-  var testAB = do_get_file("../mailnews/addrbook/test/unit/data/cardForEmail.mab");
+  var testAB = do_get_file("../../test_addbook/unit/data/cardForEmail.mab");
 
   // Copy the file to the profile directory for a PAB (this is the personal address book)
   testAB.copyTo(gProfileDir, kPABData.fileName);
 
   var copyListener = 
   {
     OnStartCopy: function() {},
     OnProgress: function(aProgress, aProgressMax) {},
--- a/mailnews/base/test/unit/test_nsIMsgFolderListenerLocal.js
+++ b/mailnews/base/test/unit/test_nsIMsgFolderListenerLocal.js
@@ -14,17 +14,17 @@
   * - Adding new folders
   * - Copy messages from files into the db
   * - Moving and copying one or more messages from one local folder to another
   * - Moving folders, with and without subfolders
   * - Renaming folders
   * - Deleting messages and folders, to trash and from trash (permanently)
   */
 
-do_import_script("../mailnews/base/test/resources/msgFolderListenerSetup.js");
+load("../../mailnews/resources/msgFolderListenerSetup.js");
 
 // Globals
 var gMsgFile1, gMsgFile2, gMsgFile3;
 var gRootFolder;
 var gLocalFolder2;
 var gLocalFolder3;
 var gLocalTrashFolder;
 
@@ -251,19 +251,19 @@ const gTestArray =
 function run_test()
 {
   // Add a listener.
   gMFNService.addListener(gMFListener, gMFNService.all);
 
   loadLocalMailAccount();
 
   // Load up some messages so that we can copy them in later.
-  gMsgFile1 = do_get_file("../mailnews/test/data/bugmail10");
-  gMsgFile2 = do_get_file("../mailnews/test/data/bugmail11");
-  gMsgFile3 = do_get_file("../mailnews/test/data/draft1");
+  gMsgFile1 = do_get_file("../../mailnews/data/bugmail10");
+  gMsgFile2 = do_get_file("../../mailnews/data/bugmail11");
+  gMsgFile3 = do_get_file("../../mailnews/data/draft1");
 
   // "Trash" folder
   gRootFolder = gLocalIncomingServer.rootMsgFolder;
   gLocalTrashFolder = gRootFolder.getChildNamed("Trash");
 
   // "Master" do_test_pending(), paired with a do_test_finished() at the end of all the operations.
   do_test_pending();
 
--- a/mailnews/base/test/unit/test_nsMsgDBView.js
+++ b/mailnews/base/test/unit/test_nsMsgDBView.js
@@ -3,17 +3,17 @@
  * - Ensure sorting and grouping sorta works, including using custom columns.
  *
  * Things we really should do:
  * - Test that secondary sorting works, especially when the primary column is
  *   a custom column.
  */
 
 // this will be migrated out of gloda soon...
-do_import_script("../mailnews/db/gloda/test/resources/messageGenerator.js");
+load("../../mailnews/resources/messageGenerator.js");
 
 var gMessageGenerator;
 var gScenarioFactory;
 
 var gTestFolder;
 
 function setup_globals(aNextFunc, aNextThis, aNextArgs) {
   loadLocalMailAccount();
--- a/mailnews/base/test/unit/test_searchAddressInAb.js
+++ b/mailnews/base/test/unit/test_searchAddressInAb.js
@@ -32,20 +32,20 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 // Testing of to, cc, toorcc in addressbook search features added in bug 187768
 // Added testing of AllAddresses from bug 310359
 
-do_import_script("../mailnews/test/resources/searchTestUtils.js");
+load("../../mailnews/resources/searchTestUtils.js");
 
 // add address book setup
-do_import_script("../mailnews/addrbook/test/resources/abSetup.js");
+load("../../mailnews/resources/abSetup.js");
 
 const ABUri = kPABData.URI;
 
 const copyService = Cc["@mozilla.org/messenger/messagecopyservice;1"].
                       getService(Ci.nsIMsgCopyService);
 
 const nsMsgSearchScope = Ci.nsMsgSearchScope;
 const nsMsgSearchAttrib = Ci.nsMsgSearchAttrib;
@@ -129,36 +129,36 @@ var Tests =
   { value: ABUri,
     attrib: CCopy,
     op: IsntInAB,
     count: 4 },
 ];
 
 var Files = 
 [
-  "../mailnews/test/data/bugmail1",
-  "../mailnews/test/data/bugmail2",
-  "../mailnews/test/data/bugmail3",
-  "../mailnews/test/data/bugmail4",
-  "../mailnews/test/data/bugmail5",
-  "../mailnews/test/data/bugmail6",
-  "../mailnews/test/data/bugmail7",
-  "../mailnews/test/data/bugmail8"
+  "../../mailnews/data/bugmail1",
+  "../../mailnews/data/bugmail2",
+  "../../mailnews/data/bugmail3",
+  "../../mailnews/data/bugmail4",
+  "../../mailnews/data/bugmail5",
+  "../../mailnews/data/bugmail6",
+  "../../mailnews/data/bugmail7",
+  "../../mailnews/data/bugmail8"
 ]
 
 var messageKey, hdr;
 
 function run_test()
 {
   // Setup local mail accounts.
 
   loadLocalMailAccount();
     
     // Test setup - copy the data file into place
-  var testAB = do_get_file("../mailnews/addrbook/test/unit/data/cardForEmail.mab");
+  var testAB = do_get_file("../../test_addbook/unit/data/cardForEmail.mab");
 
   // Copy the file to the profile directory for a PAB
   testAB.copyTo(gProfileDir, kPABData.fileName);
 
   // test that validity table terms are valid
 
   // offline mail table
   testValidityTable(offlineMail, IsInAB, Sender, true);
--- a/mailnews/base/test/unit/test_searchJunk.js
+++ b/mailnews/base/test/unit/test_searchJunk.js
@@ -31,17 +31,17 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 // Testing of search by junk percent and junk score origin
 
-do_import_script("../mailnews/test/resources/searchTestUtils.js");
+load("../../mailnews/resources/searchTestUtils.js");
 
 const copyService = Cc["@mozilla.org/messenger/messagecopyservice;1"]
                       .getService(Ci.nsIMsgCopyService);
 
 const nsMsgSearchScope = Ci.nsMsgSearchScope;
 const nsMsgSearchAttrib = Ci.nsMsgSearchAttrib;
 const nsMsgSearchOp = Ci.nsMsgSearchOp;
 
@@ -50,17 +50,17 @@ const IsLessThan = nsMsgSearchOp.IsLessT
 const Is = nsMsgSearchOp.Is;
 const Isnt = nsMsgSearchOp.Isnt;
 
 const offlineMail = nsMsgSearchScope.offlineMail;
 
 const JunkScoreOrigin = nsMsgSearchAttrib.JunkScoreOrigin;
 const JunkPercent = nsMsgSearchAttrib.JunkPercent;
 
-const fileName = "../mailnews/test/data/bugmail1";
+const fileName = "../../mailnews/data/bugmail1";
 
 /*
  * The search for junkpercent is defined as the effective value,
  * while the "junkpercent" database term is always the result
  * from the bayes filter. This is optimized to make views that
  * rely on junk percent search work with the best value for junk
  * percent, while allowing junk percent from the bayes filter
  * to be saved for analysis.
--- a/mailnews/base/test/unit/test_searchTag.js
+++ b/mailnews/base/test/unit/test_searchTag.js
@@ -36,17 +36,17 @@
 
 /*
  * Testing of tag search features.
  *
  * Specifically tests changes implemented in bug 217034
  * Does not do comprehensive testing.
  *
  */
-do_import_script("../mailnews/test/resources/searchTestUtils.js");
+load("../../mailnews/resources/searchTestUtils.js");
 
 const tagService = Cc["@mozilla.org/messenger/tagservice;1"]
                      .getService(Ci.nsIMsgTagService);
 const copyService = Cc["@mozilla.org/messenger/messagecopyservice;1"]
                       .getService(Ci.nsIMsgCopyService);
 
 const nsMsgSearchScope = Ci.nsMsgSearchScope;
 const nsMsgSearchAttrib = Ci.nsMsgSearchAttrib;
@@ -378,17 +378,17 @@ function run_test()
     OnStartCopy: function() {},
     OnProgress: function(aProgress, aProgressMax) {},
     SetMessageKey: function(aKey) { hdr = gLocalInboxFolder.GetMessageHeader(aKey);},
     SetMessageId: function(aMessageId) {},
     OnStopCopy: function(aStatus) { testKeywordSearch();}
   };
 
   // Get a message into the local filestore. function testKeywordSearch() continues the testing after the copy.
-  var bugmail1 = do_get_file("../mailnews/test/data/bugmail1");
+  var bugmail1 = do_get_file("../../mailnews/data/bugmail1");
   do_test_pending();
   copyService.CopyFileMessage(bugmail1, gLocalInboxFolder, null, false, 0,
                               "", copyListener, null);
 }
 
 // process each test from queue, calls itself upon completion of each search
 var testObject;
 function testKeywordSearch()
--- a/mailnews/compose/test/unit/head_compose.js
+++ b/mailnews/compose/test/unit/head_compose.js
@@ -1,15 +1,15 @@
 // Import the main scripts that mailnews tests need to set up and tear down
-do_import_script("../mailnews/test/resources/mailDirService.js");
-do_import_script("../mailnews/test/resources/mailTestUtils.js");
+load("../../mailnews/resources/mailDirService.js");
+load("../../mailnews/resources/mailTestUtils.js");
 
 // Import the smtp server scripts
-do_import_script("../mailnews/test/fakeserver/maild.js")
-do_import_script("../mailnews/test/fakeserver/smtpd.js")
+load("../../mailnews/fakeserver/maild.js")
+load("../../mailnews/fakeserver/smtpd.js")
 
 const SMTP_PORT = 1024+120;
 
 // Setup the daemon and server
 function setupServerDaemon(handler) {
   if (!handler)
     handler = new SMTP_RFC2822_handler(new smtpDaemon());
   var server = new nsMailServer(handler);
--- a/mailnews/compose/test/unit/test_bug155172.js
+++ b/mailnews/compose/test/unit/test_bug155172.js
@@ -78,23 +78,23 @@ function run_test() {
 
   handler._username = kUsername;
   handler._password = kPassword1;
 
   server = setupServerDaemon(handler);
   server.setDebugLevel(fsDebugAll);
 
   // Passwords File (generated from Mozilla 1.8 branch).
-  var signons = do_get_file("../mailnews/compose/test/unit/data/signons-smtp.txt");
+  var signons = do_get_file("data/signons-smtp.txt");
 
   // Copy the file to the profile directory for a PAB
   signons.copyTo(gProfileDir, "signons.txt");
 
   // Test file
-  var testFile = do_get_file("../mailnews/compose/test/unit/data/message1.eml");
+  var testFile = do_get_file("data/message1.eml");
 
   // Ensure we have at least one mail account
   loadLocalMailAccount();
 
   var smtpServer = getBasicSmtpServer();
   var identity = getSmtpIdentity(kSender, smtpServer);
 
   var smtpService = Cc["@mozilla.org/messengercompose/smtp;1"]
--- a/mailnews/compose/test/unit/test_bug474774.js
+++ b/mailnews/compose/test/unit/test_bug474774.js
@@ -6,17 +6,17 @@
 var type = null;
 var test = null;
 var server;
 var sentFolder;
 var transaction;
 var originalData;
 var finished = false;
 var identity = null;
-var testFile = do_get_file("../mailnews/compose/test/unit/data/429891_testcase.eml");
+var testFile = do_get_file("data/429891_testcase.eml");
 
 const kSender = "from@invalid.com";
 const kTo = "to@invalid.com";
 
 var msgSendLater = Cc["@mozilla.org/messengercompose/sendlater;1"]
   .getService(Ci.nsIMsgSendLater);
 
 // This listener handles the post-sending of the actual message and checks the
--- a/mailnews/compose/test/unit/test_nsMsgCompose1.js
+++ b/mailnews/compose/test/unit/test_nsMsgCompose1.js
@@ -1,15 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /*
  * Test suite for nsMsgCompose functions relating to listeners.
  */
 
 // We need the address book details for this test
-do_import_script("../mailnews/addrbook/test/resources/abSetup.js");
+load("../../mailnews/resources/abSetup.js");
 
 const MsgComposeContractID = "@mozilla.org/messengercompose/compose;1";
 const MsgComposeParamsContractID = "@mozilla.org/messengercompose/composeparams;1";
 const MsgComposeFieldsContractID = "@mozilla.org/messengercompose/composefields;1";
 const nsIMsgCompose = Components.interfaces.nsIMsgCompose;
 const nsIMsgComposeParams = Components.interfaces.nsIMsgComposeParams;
 const nsIMsgCompFields = Components.interfaces.nsIMsgCompFields;
 const nsIAbPreferMailFormat = Components.interfaces.nsIAbPreferMailFormat;
@@ -41,22 +41,22 @@ function checkPopulate(aTo, aNonHTMLReci
 
   do_check_eq(fields.to, aCheckTo);
 
   do_check_eq(nonHTMLRecipients.value, aNonHTMLRecipients);
 }
 
 function run_test() {
   // Test setup - copy the data files into place
-  var testAB = do_get_file("../mailnews/addrbook/test/resources/abLists1.mab");
+  var testAB = do_get_file("../../mailnews/data/abLists1.mab");
 
   // Copy the file to the profile directory for a PAB
   testAB.copyTo(gProfileDir, kPABData.fileName);
 
-  testAB = do_get_file("../mailnews/addrbook/test/resources/abLists2.mab");
+  testAB = do_get_file("../../mailnews/data/abLists2.mab");
 
   // Copy the file to the profile directory for a CAB
   testAB.copyTo(gProfileDir, kCABData.fileName);
 
   // Test - Check we can initalize with fewest specified
   // parameters and don't fail/crash like we did in bug 411646.
 
   var msgCompose = Components.classes[MsgComposeContractID]
--- a/mailnews/compose/test/unit/test_sendBackground.js
+++ b/mailnews/compose/test/unit/test_sendBackground.js
@@ -5,17 +5,17 @@
 var type = null;
 var test = null;
 var server;
 var sentFolder;
 var transaction;
 var originalData;
 var finished = false;
 var identity = null;
-var testFile = do_get_file("../mailnews/compose/test/unit/data/429891_testcase.eml");
+var testFile = do_get_file("data/429891_testcase.eml");
 
 const kSender = "from@invalid.com";
 const kTo = "to@invalid.com";
 
 var gMsgSendLater;
 
 // This listener handles the post-sending of the actual message and checks the
 // sequence and ensures the data is correct.
--- a/mailnews/compose/test/unit/test_sendMailMessage.js
+++ b/mailnews/compose/test/unit/test_sendMailMessage.js
@@ -14,17 +14,17 @@ const kSender = "from@invalid.com";
 const kTo = "to@invalid.com";
 const kUsername = "testsmtp";
 const kPassword = "smtptest";
 
 function test_RFC2822() {
   type = "RFC 2822";
 
   // Test file
-  var testFile = do_get_file("../mailnews/compose/test/unit/data/message1.eml");
+  var testFile = do_get_file("data/message1.eml");
 
   // Ensure we have at least one mail account
   loadLocalMailAccount();
 
   var smtpServer = getBasicSmtpServer();
   var identity = getSmtpIdentity(kSender, smtpServer);
 
   var smtpService = Cc["@mozilla.org/messengercompose/smtp;1"]
--- a/mailnews/compose/test/unit/test_sendMessageFile.js
+++ b/mailnews/compose/test/unit/test_sendMessageFile.js
@@ -113,17 +113,17 @@ msl.prototype = {
 }
 
 function run_test() {
   server = setupServerDaemon();
 
   type = "sendMessageFile";
 
   // Test file - for bug 429891
-  var testFile = do_get_file("../mailnews/compose/test/unit/data/429891_testcase.eml");
+  var testFile = do_get_file("data/429891_testcase.eml");
   originalData = loadFileToString(testFile);
 
   // Ensure we have at least one mail account
   loadLocalMailAccount();
 
   var acctMgr = Cc["@mozilla.org/messenger/account-manager;1"]
                   .getService(Ci.nsIMsgAccountManager);
   acctMgr.setSpecialFolders();
--- a/mailnews/compose/test/unit/test_sendMessageLater.js
+++ b/mailnews/compose/test/unit/test_sendMessageLater.js
@@ -13,17 +13,17 @@
 var type = null;
 var test = null;
 var server;
 var sentFolder;
 var transaction;
 var originalData;
 var finished = false;
 var identity = null;
-var testFile = do_get_file("../mailnews/compose/test/unit/data/429891_testcase.eml");
+var testFile = do_get_file("data/429891_testcase.eml");
 
 const kSender = "from@invalid.com";
 const kTo = "to@invalid.com";
 
 var msgSendLater = Cc["@mozilla.org/messengercompose/sendlater;1"]
   .getService(Ci.nsIMsgSendLater);
 
 // This listener handles the post-sending of the actual message and checks the
--- a/mailnews/compose/test/unit/test_sendMessageLater2.js
+++ b/mailnews/compose/test/unit/test_sendMessageLater2.js
@@ -14,18 +14,18 @@
 var test = "sendMessageLater";
 var server = null;
 var gSentFolder;
 var transaction;
 var originalData;
 var identity = null;
 var gMsgFile =
 [
-  do_get_file("../mailnews/compose/test/unit/data/message1.eml"),
-  do_get_file("../mailnews/compose/test/unit/data/429891_testcase.eml")
+  do_get_file("data/message1.eml"),
+  do_get_file("data/429891_testcase.eml")
 ];
 var gMsgFileData = [];
 var gMsgOrder = [];
 var gCurTestNum = 0;
 var gLastSentMessage = 0;
 
 const kSender = "from@invalid.com";
 const kTo = "to@invalid.com";
--- a/mailnews/compose/test/unit/test_sendMessageLater3.js
+++ b/mailnews/compose/test/unit/test_sendMessageLater3.js
@@ -10,17 +10,17 @@
 var type = null;
 var test = null;
 var server;
 var sentFolder;
 var transaction;
 var originalData;
 var finished = false;
 var identity = null;
-var testFile = do_get_file("../mailnews/compose/test/unit/data/429891_testcase.eml");
+var testFile = do_get_file("data/429891_testcase.eml");
 
 const kSender = "from@invalid.com";
 const kTo = "to@invalid.com";
 
 var msgSendLater = Cc["@mozilla.org/messengercompose/sendlater;1"]
   .getService(Ci.nsIMsgSendLater);
 
 // This allows the send code to attempt to display errors to the user without
--- a/mailnews/compose/test/unit/test_smtpPassword.js
+++ b/mailnews/compose/test/unit/test_smtpPassword.js
@@ -10,23 +10,23 @@ const kTo = "to@invalid.com";
 const kUsername = "testsmtp";
 // This is the same as in the signons file.
 const kPassword = "smtptest";
 
 function run_test() {
   server = setupServerDaemon();
 
   // Passwords File (generated from Mozilla 1.8 branch).
-  var signons = do_get_file("../mailnews/test/data/signons-mailnews1.8.txt");
+  var signons = do_get_file("../../mailnews/data/signons-mailnews1.8.txt");
 
   // Copy the file to the profile directory for a PAB
   signons.copyTo(gProfileDir, "signons.txt");
 
   // Test file
-  var testFile = do_get_file("../mailnews/compose/test/unit/data/message1.eml");
+  var testFile = do_get_file("data/message1.eml");
 
   // Ensure we have at least one mail account
   loadLocalMailAccount();
 
   var smtpServer = getBasicSmtpServer();
   var identity = getSmtpIdentity(kSender, smtpServer);
 
   var smtpService = Cc["@mozilla.org/messengercompose/smtp;1"]
--- a/mailnews/compose/test/unit/test_smtpPassword2.js
+++ b/mailnews/compose/test/unit/test_smtpPassword2.js
@@ -10,17 +10,17 @@ const kHostname = "localhost";
 const kServerUrl = kProtocol + "://" + kHostname;
 
 function run_test()
 {
   // Login Manager
   var loginMgr = Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager);
 
   // Passwords File (generated from Mozilla 1.8 branch).
-  var signons = do_get_file("../mailnews/test/data/signons-mailnews1.8-multiple.txt");
+  var signons = do_get_file("../../mailnews/data/signons-mailnews1.8-multiple.txt");
 
   // Copy the file to the profile directory for a PAB
   signons.copyTo(gProfileDir, "signons.txt");
 
   // Set up the basic accounts and folders.
   loadLocalMailAccount();
 
   var smtpServer1 = getBasicSmtpServer();
rename from mailnews/db/gloda/test/resources/glodaTestHelper.js
rename to mailnews/db/gloda/test/unit/resources/glodaTestHelper.js
--- a/mailnews/db/gloda/test/resources/glodaTestHelper.js
+++ b/mailnews/db/gloda/test/unit/resources/glodaTestHelper.js
@@ -31,17 +31,17 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 // -- Pull in the POP3 fake-server / local account helper code
-do_import_script("../mailnews/local/test/unit/head_maillocal.js");
+load("../../test_mailnewslocal/unit/head_maillocal.js");
 
 // -- Set the gloda prefs
 const gPrefs = Cc["@mozilla.org/preferences-service;1"]
                  .getService(Ci.nsIPrefBranch);
 // yes to indexing
 gPrefs.setBoolPref("mailnews.database.global.indexer.enabled", true);
 // no to a sweep we don't control
 gPrefs.setBoolPref("mailnews.database.global.indexer.perform_initial_sweep",
rename from mailnews/db/gloda/test/resources/mockIndexer.js
rename to mailnews/db/gloda/test/unit/resources/mockIndexer.js
rename from mailnews/db/gloda/test/resources/mockTimer.js
rename to mailnews/db/gloda/test/unit/resources/mockTimer.js
--- a/mailnews/db/gloda/test/unit/test_cleanup_msf_databases.js
+++ b/mailnews/db/gloda/test/unit/test_cleanup_msf_databases.js
@@ -1,18 +1,18 @@
 /* This file tests whether we cleanup after ourselves, msf-wise.
  * This is very much a white-box test; we want to make sure that all the parts
  *  of the mechanism are actually doing what we think they should be doing.
  * 
  * This test should stand on its own!  It should not be lumped together with
  *  other tests unless you take care to fix all our meddling.
  */
 
-do_import_script("../mailnews/db/gloda/test/resources/messageGenerator.js");
-do_import_script("../mailnews/db/gloda/test/resources/glodaTestHelper.js");
+load("../../mailnews/resources/messageGenerator.js");
+load("resources/glodaTestHelper.js");
 
 // Create a message generator
 var msgGen = new MessageGenerator();
 // Create a message scenario generator using that message generator
 var scenarios = new MessageScenarioFactory(msgGen);
 
 // we need datamodel to be able to manipulate the GlodaFolder prototype...
 Components.utils.import("resource://app/modules/gloda/datamodel.js");
--- a/mailnews/db/gloda/test/unit/test_gloda_content.js
+++ b/mailnews/db/gloda/test/unit/test_gloda_content.js
@@ -4,18 +4,18 @@
  * and fulltext query tests (on messages), but the buck stops here for the
  * content stuff.
  *
  * Currently, we just test that quoting removal and that the content turns out
  * right.  We do not actually verify that the quoted blocks are correct.  (We
  * have no known consumers who care about the quoted blocks.)
  */
 
-do_import_script("../mailnews/db/gloda/test/resources/messageGenerator.js");
-do_import_script("../mailnews/db/gloda/test/resources/glodaTestHelper.js");
+load("../../mailnews/resources/messageGenerator.js");
+load("resources/glodaTestHelper.js");
 
 Components.utils.import("resource://app/modules/gloda/mimemsg.js");
 
 var msgGen = new MessageGenerator();
 
 /* ===== Data ===== */
 var messageInfos = [
   {
--- a/mailnews/db/gloda/test/unit/test_index_adaptive.js
+++ b/mailnews/db/gloda/test/unit/test_index_adaptive.js
@@ -2,19 +2,19 @@
  * Test our adaptive indexing logic; the thing that tries to adjust our
  *  indexing constants based on perceived processor utilization.  We fake all
  *  the load stuff, of course.
  * 
  * Out of necessity, this test knows about the internals of the adaptive
  *  indexing logic.
  */
 
-do_import_script("../mailnews/db/gloda/test/resources/glodaTestHelper.js");
-do_import_script("../mailnews/db/gloda/test/resources/mockIndexer.js");
-do_import_script("../mailnews/db/gloda/test/resources/mockTimer.js");
+load("resources/glodaTestHelper.js");
+load("resources/mockIndexer.js");
+load("resources/mockTimer.js");
 
 /* ===== Mock Objects ==== */
 
 var FakeStopwatch = {
   /* (fake) public interface */
   start: function () {
     this.running = true;
     dump("stopwatch started\n");
--- a/mailnews/db/gloda/test/unit/test_index_messages.js
+++ b/mailnews/db/gloda/test/unit/test_index_messages.js
@@ -2,22 +2,18 @@
  *  properly be triggered by events taking place in thunderbird as well as our
  *  ability to correctly extract/index the right data.
  * In general, if these tests pass, things are probably working quite well.
  *
  * Things we don't test that you think we might test:
  * - Full-text search.  Happens in query testing.
  */
 
-do_import_script("../mailnews/db/gloda/test/resources/messageGenerator.js");
-
-//these are imported by glodaTestHelper's import of head_maillocal
-// do_import_script("../mailnews/test/resources/mailDirService.js");
-// do_import_script("../mailnews/test/resources/mailTestUtils.js");
-do_import_script("../mailnews/db/gloda/test/resources/glodaTestHelper.js");
+load("../../mailnews/resources/messageGenerator.js");
+load("resources/glodaTestHelper.js");
 
 // Create a message generator
 var msgGen = new MessageGenerator();
 // Create a message scenario generator using that message generator
 var scenarios = new MessageScenarioFactory(msgGen);
 
 /* ===== Threading / Conversation Grouping ===== */
 
--- a/mailnews/db/gloda/test/unit/test_index_messages_in_bulk.js
+++ b/mailnews/db/gloda/test/unit/test_index_messages_in_bulk.js
@@ -1,19 +1,15 @@
 /*
  * This file tests indexing a whole bunch of messages at once.  We
  * are primarily concerned about memory utilization and processor load.
  */
 
-do_import_script("../mailnews/db/gloda/test/resources/messageGenerator.js");
-
-//these are imported by glodaTestHelper's import of head_maillocal
-// do_import_script("../mailnews/test/resources/mailDirService.js");
-// do_import_script("../mailnews/test/resources/mailTestUtils.js");
-do_import_script("../mailnews/db/gloda/test/resources/glodaTestHelper.js");
+load("../../mailnews/resources/messageGenerator.js");
+load("resources/glodaTestHelper.js");
 
 // Create a message generator
 var msgGen = new MessageGenerator();
 // Create a message scenario generator using that message generator
 var scenarios = new MessageScenarioFactory(msgGen);
 
 /**
  * Provide a bunch of messages to be indexed.
--- a/mailnews/db/gloda/test/unit/test_intl.js
+++ b/mailnews/db/gloda/test/unit/test_intl.js
@@ -1,19 +1,15 @@
 /*
  * Test that i18n goes through das pipes acceptably.  Currently this means:
  * - Subject, Body, and Attachment names are properly indexed.
  */
 
-do_import_script("../mailnews/db/gloda/test/resources/messageGenerator.js");
-
-//these are imported by glodaTestHelper's import of head_maillocal
-// do_import_script("../mailnews/test/resources/mailDirService.js");
-// do_import_script("../mailnews/test/resources/mailTestUtils.js");
-do_import_script("../mailnews/db/gloda/test/resources/glodaTestHelper.js");
+load("../../mailnews/resources/messageGenerator.js");
+load("resources/glodaTestHelper.js");
 
 // Create a message generator
 var msgGen = new MessageGenerator();
 
 /* ===== Tests ===== */
 
 var intlPhrases = [
   {
--- a/mailnews/db/gloda/test/unit/test_mime_emitter.js
+++ b/mailnews/db/gloda/test/unit/test_mime_emitter.js
@@ -3,18 +3,18 @@
  *  scenarios.
  *
  * We do not test, but should consider testing:
  * - MimeEncryptedPKCS7, whatever that translates to.
  * - apple double
  * - sun attachment
  */
 
-do_import_script("../mailnews/db/gloda/test/resources/messageGenerator.js");
-do_import_script("../mailnews/db/gloda/test/resources/glodaTestHelper.js");
+load("../../mailnews/resources/messageGenerator.js");
+load("resources/glodaTestHelper.js");
 
 Components.utils.import("resource://app/modules/gloda/mimemsg.js");
 
 // Create a message generator
 var msgGen = new MessageGenerator();
 
 var partText = new SyntheticPartLeaf("I am text! Woo!");
 var partHtml = new SyntheticPartLeaf(
--- a/mailnews/db/gloda/test/unit/test_noun_mimetype.js
+++ b/mailnews/db/gloda/test/unit/test_noun_mimetype.js
@@ -1,16 +1,16 @@
 /*
  * Test noun_mimetype.  Exists because I just changed its implementation and I'm
  * afraid I may have damaged it and it's hard to tell, so ironically a unit test
  * is the easiest solution.  (Don't you hate it when the right thing to do is
  * also the easy thing to do?)
  */
 
-do_import_script("../mailnews/db/gloda/test/resources/glodaTestHelper.js");
+load("resources/glodaTestHelper.js");
 
 Components.utils.import("resource://app/modules/gloda/noun_mimetype.js");
 
 /* ===== Tests ===== */
 
 var passResults = [];
 var curPassResults;
 /**
--- a/mailnews/db/gloda/test/unit/test_query_core.js
+++ b/mailnews/db/gloda/test/unit/test_query_core.js
@@ -1,17 +1,17 @@
 /*
  * Test the mechanics our query functionality.  Tests in this file are intended
  *  to cover extreme boundary cases and things that are just unlikely to happen
  *  in reasonable message use-cases.  (Which is to say, it could be hard to
  *  formulate a set of synthetic messages that result in the situation we want
  *  to test for.)  
  */
 
-do_import_script("../mailnews/db/gloda/test/resources/glodaTestHelper.js");
+load("resources/glodaTestHelper.js");
 
 /* ===== Test Noun ===== */
 /*
  * Introduce a simple noun type for our testing so that we can avoid having to
  * deal with the semantics of messages/friends and all their complexity. 
  */
 
 Widget = function () {
--- a/mailnews/db/gloda/test/unit/test_query_messages.js
+++ b/mailnews/db/gloda/test/unit/test_query_messages.js
@@ -1,13 +1,13 @@
 /* This file tests our querying support.
  */
 
-do_import_script("../mailnews/db/gloda/test/resources/messageGenerator.js");
-do_import_script("../mailnews/db/gloda/test/resources/glodaTestHelper.js");
+load("../../mailnews/resources/messageGenerator.js");
+load("resources/glodaTestHelper.js");
 
 // Create a message generator
 var msgGen = new MessageGenerator();
 // Create a message scenario generator using that message generator
 var scenarios = new MessageScenarioFactory(msgGen);
 
 /* ===== Populate ===== */
 var world = {
--- a/mailnews/db/msgdb/test/unit/head_maildb.js
+++ b/mailnews/db/msgdb/test/unit/head_maildb.js
@@ -1,2 +1,3 @@
 // Import the main scripts that mailnews tests need to set up and tear down
-do_import_script("../mailnews/test/resources/mailDirService.js");
+load("../../mailnews/resources/mailDirService.js");
+load("../../mailnews/resources/mailTestUtils.js");
--- a/mailnews/db/msgdb/test/unit/test_maildb.js
+++ b/mailnews/db/msgdb/test/unit/test_maildb.js
@@ -1,15 +1,13 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /*
  * Test suite for msg database functions.
  */
 
-do_import_script("../mailnews/test/resources/mailTestUtils.js");
-
 function run_test() {
   loadLocalMailAccount();
   // Get the root folder
   var root = gLocalIncomingServer.rootFolder;
 
   root.createSubfolder("dbTest", null);
   var dbService = Components.classes["@mozilla.org/msgDatabase/msgDBService;1"]
                           .getService(Components.interfaces.nsIMsgDBService);
--- a/mailnews/db/msgdb/test/unit/test_references_parsing.js
+++ b/mailnews/db/msgdb/test/unit/test_references_parsing.js
@@ -1,19 +1,15 @@
 /*
  * Test nsMsgHdr's In-Reply-To/References parsing logic.
  */
 
-// Import the main scripts that mailnews tests need to set up and tear down
-do_import_script("../mailnews/test/resources/mailDirService.js");
-do_import_script("../mailnews/test/resources/mailTestUtils.js");
-
 const copyService = Cc["@mozilla.org/messenger/messagecopyservice;1"]
                       .getService(Ci.nsIMsgCopyService);
-const anyOldMessage = do_get_file("../mailnews/test/data/bugmail1");
+const anyOldMessage = do_get_file("../../mailnews/data/bugmail1");
 
 var refsAndResults = [
   // an empty string is not a reference.
   ["", []],
   // super valid things
   ["<abc@def>", ["abc@def"]],
   ["<up@down> <left@right> <ying@yang>",
     ["up@down", "left@right", "ying@yang"]],
--- a/mailnews/extensions/bayesian-spam-filter/test/unit/head_bayes.js
+++ b/mailnews/extensions/bayesian-spam-filter/test/unit/head_bayes.js
@@ -1,13 +1,13 @@
 // Import the main scripts that mailnews tests need to set up and tear down
-do_import_script("../mailnews/test/resources/mailDirService.js");
-do_import_script("../mailnews/test/resources/mailTestUtils.js");
+load("../../mailnews/resources/mailDirService.js");
+load("../../mailnews/resources/mailTestUtils.js");
 
 function getSpec(aFileName)
 {
-  var file = do_get_file("../mailnews/extensions/bayesian-spam-filter/test/resources/" + aFileName);
+  var file = do_get_file("resources/" + aFileName);
   var uri = Cc["@mozilla.org/network/io-service;1"]
                .getService(Ci.nsIIOService)
                .newFileURI(file).QueryInterface(Ci.nsIURL);
   uri.query = "type=application/x-message-display";
   return uri.spec;
 }
rename from mailnews/extensions/bayesian-spam-filter/test/resources/ham1.eml
rename to mailnews/extensions/bayesian-spam-filter/test/unit/resources/ham1.eml
rename from mailnews/extensions/bayesian-spam-filter/test/resources/ham2.eml
rename to mailnews/extensions/bayesian-spam-filter/test/unit/resources/ham2.eml
rename from mailnews/extensions/bayesian-spam-filter/test/resources/spam1.eml
rename to mailnews/extensions/bayesian-spam-filter/test/unit/resources/spam1.eml
rename from mailnews/extensions/bayesian-spam-filter/test/resources/spam2.eml
rename to mailnews/extensions/bayesian-spam-filter/test/unit/resources/spam2.eml
rename from mailnews/extensions/bayesian-spam-filter/test/resources/spam3.eml
rename to mailnews/extensions/bayesian-spam-filter/test/unit/resources/spam3.eml
rename from mailnews/extensions/bayesian-spam-filter/test/resources/spam4.eml
rename to mailnews/extensions/bayesian-spam-filter/test/unit/resources/spam4.eml
rename from mailnews/extensions/bayesian-spam-filter/test/resources/tokenTest.eml
rename to mailnews/extensions/bayesian-spam-filter/test/unit/resources/tokenTest.eml
rename from mailnews/extensions/bayesian-spam-filter/test/resources/trainingfile.js
rename to mailnews/extensions/bayesian-spam-filter/test/unit/resources/trainingfile.js
--- a/mailnews/extensions/bayesian-spam-filter/test/unit/test_bug228675.js
+++ b/mailnews/extensions/bayesian-spam-filter/test/unit/test_bug228675.js
@@ -33,17 +33,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 // tests reduction in size of training.dat
 
 // main setup
 
-do_import_script("../mailnews/extensions/bayesian-spam-filter/test/resources/trainingfile.js");
+load("resources/trainingfile.js");
 
 const nsIPrefBranch = Cc["@mozilla.org/preferences-service;1"]
                         .getService(Ci.nsIPrefBranch);
 
 // before shrink, the trained messages have 76 tokens. Force shrink.
 nsIPrefBranch.setIntPref("mailnews.bayesian_spam_filter.junk_maxtokens", 75);
 
 const nsIJunkMailPlugin = Cc["@mozilla.org/messenger/filter-plugin;1?name=bayesianfilter"]
--- a/mailnews/imap/test/unit/head_server.js
+++ b/mailnews/imap/test/unit/head_server.js
@@ -1,15 +1,15 @@
 // Import fakeserver
-do_import_script("../mailnews/test/fakeserver/maild.js");
-do_import_script("../mailnews/test/fakeserver/imapd.js");
+load("../../mailnews/fakeserver/maild.js");
+load("../../mailnews/fakeserver/imapd.js");
 
 // And mailnews scripts
-do_import_script("../mailnews/test/resources/mailDirService.js");
-do_import_script("../mailnews/test/resources/mailTestUtils.js");
+load("../../mailnews/resources/mailDirService.js");
+load("../../mailnews/resources/mailTestUtils.js");
 
 const IMAP_PORT = 1024 + 143;
 
 function makeServer(daemon, infoString) {
   if (infoString in configurations)
     return makeHandler(daemon, configurations[infoString].join(","));
 
   var handler = new IMAP_RFC3501_handler(daemon);
--- a/mailnews/imap/test/unit/test_bug460636.js
+++ b/mailnews/imap/test/unit/test_bug460636.js
@@ -3,17 +3,17 @@
  */
 
 var gIMAPDaemon, gServer, gIMAPIncomingServer, gSavedMsgFile;
 
 const gIMAPService = Cc["@mozilla.org/messenger/messageservice;1?type=imap"]
                        .getService(Ci.nsIMsgMessageService);
 
 const gFileName = "bug460636";
-const gMsgFile = do_get_file("../mailnews/test/data/" + gFileName);
+const gMsgFile = do_get_file("../../mailnews/data/" + gFileName);
                      
 function run_test()
 {
   /*
    * Set up an IMAP server. The bug is only triggered when nsMsgSaveAsListener
    * is used (i.e., for IMAP and NNTP).
    */
   gIMAPDaemon = new imapDaemon();
--- a/mailnews/imap/test/unit/test_compactOfflineStore.js
+++ b/mailnews/imap/test/unit/test_compactOfflineStore.js
@@ -10,21 +10,21 @@ const gIMAPService = Cc["@mozilla.org/me
                        .getService(Ci.nsIMsgMessageService);
 
 // Globals
 var gRootFolder;
 var gIMAPInbox, gIMAPTrashFolder;
 var gIMAPDaemon, gServer, gIMAPIncomingServer;
 var gImapInboxOfflineStoreSize;
 
-const gMsgFile1 = do_get_file("../mailnews/test/data/bugmail10");
-const gMsgFile2 = do_get_file("../mailnews/test/data/bugmail11");
-const gMsgFile3 = do_get_file("../mailnews/test/data/draft1");
-const gMsgFile4 = do_get_file("../mailnews/test/data/bugmail7");
-const gMsgFile5 = do_get_file("../mailnews/test/data/bugmail6");
+const gMsgFile1 = do_get_file("../../mailnews/data/bugmail10");
+const gMsgFile2 = do_get_file("../../mailnews/data/bugmail11");
+const gMsgFile3 = do_get_file("../../mailnews/data/draft1");
+const gMsgFile4 = do_get_file("../../mailnews/data/bugmail7");
+const gMsgFile5 = do_get_file("../../mailnews/data/bugmail6");
 
 // Copied straight from the example files
 const gMsgId1 = "200806061706.m56H6RWT004933@mrapp54.mozilla.org";
 const gMsgId2 = "200804111417.m3BEHTk4030129@mrapp51.mozilla.org";
 const gMsgId3 = "4849BF7B.2030800@example.com";
 const gMsgId4 = "bugmail7.m47LtAEf007542@mrapp51.mozilla.org";
 const gMsgId5 = "bugmail6.m47LtAEf007542@mrapp51.mozilla.org";
 
--- a/mailnews/imap/test/unit/test_downloadOffline.js
+++ b/mailnews/imap/test/unit/test_downloadOffline.js
@@ -5,17 +5,17 @@
  */
 
 var gIMAPDaemon, gServer, gIMAPIncomingServer;
 
 const gIMAPService = Cc["@mozilla.org/messenger/messageservice;1?type=imap"]
                        .getService(Ci.nsIMsgMessageService);
 
 const gFileName = "bug460636";
-const gMsgFile = do_get_file("../mailnews/test/data/" + gFileName);
+const gMsgFile = do_get_file("../../mailnews/data/" + gFileName);
                      
 function run_test()
 {
   loadLocalMailAccount();
 
   /*
    * Set up an IMAP server.
    */
--- a/mailnews/imap/test/unit/test_nsIMsgFolderListenerIMAP.js
+++ b/mailnews/imap/test/unit/test_nsIMsgFolderListenerIMAP.js
@@ -10,27 +10,27 @@
 * Test suite for nsIMsgFolderListener events due to IMAP operations
 *
 * Currently tested
 * - Adding new folders
 * - Copying messages from files to mailboxes
 * - Adding new messages directly to mailboxes
 */
 
-do_import_script("../mailnews/base/test/resources/msgFolderListenerSetup.js");
+load("../../mailnews/resources/msgFolderListenerSetup.js");
 
 // Globals
 var gRootFolder;
 var gIMAPInbox, gIMAPFolder2, gIMAPFolder3, gIMAPTrashFolder;
 var gIMAPDaemon, gServer, gIMAPIncomingServer;
-const gMsgFile1 = do_get_file("../mailnews/test/data/bugmail10");
-const gMsgFile2 = do_get_file("../mailnews/test/data/bugmail11");
-const gMsgFile3 = do_get_file("../mailnews/test/data/draft1");
-const gMsgFile4 = do_get_file("../mailnews/test/data/bugmail7");
-const gMsgFile5 = do_get_file("../mailnews/test/data/bugmail6");
+const gMsgFile1 = do_get_file("../../mailnews/data/bugmail10");
+const gMsgFile2 = do_get_file("../../mailnews/data/bugmail11");
+const gMsgFile3 = do_get_file("../../mailnews/data/draft1");
+const gMsgFile4 = do_get_file("../../mailnews/data/bugmail7");
+const gMsgFile5 = do_get_file("../../mailnews/data/bugmail6");
 
 // Copied straight from the example files
 const gMsgId1 = "200806061706.m56H6RWT004933@mrapp54.mozilla.org";
 const gMsgId2 = "200804111417.m3BEHTk4030129@mrapp51.mozilla.org";
 const gMsgId3 = "4849BF7B.2030800@example.com";
 const gMsgId4 = "bugmail7.m47LtAEf007542@mrapp51.mozilla.org";
 const gMsgId5 = "bugmail6.m47LtAEf007542@mrapp51.mozilla.org";
 
--- a/mailnews/import/test/unit/head_import.js
+++ b/mailnews/import/test/unit/head_import.js
@@ -1,4 +1,4 @@
 // Set up the profile directory for verifying the success of imports
-do_import_script("../mailnews/test/resources/mailDirService.js");
+load("../../mailnews/resources/mailDirService.js");
 // Import the script with basic import functions
-do_import_script("../mailnews/import/test/resources/import_helper.js");
+load("resources/import_helper.js");
rename from mailnews/import/test/resources/AB_README
rename to mailnews/import/test/unit/resources/AB_README
rename from mailnews/import/test/resources/addressbook.json
rename to mailnews/import/test/unit/resources/addressbook.json
rename from mailnews/import/test/resources/basic_addressbook.csv
rename to mailnews/import/test/unit/resources/basic_addressbook.csv
rename from mailnews/import/test/resources/basic_ldif_addressbook.ldif
rename to mailnews/import/test/unit/resources/basic_ldif_addressbook.ldif
rename from mailnews/import/test/resources/import_helper.js
rename to mailnews/import/test/unit/resources/import_helper.js
--- a/mailnews/import/test/resources/import_helper.js
+++ b/mailnews/import/test/unit/resources/import_helper.js
@@ -240,17 +240,17 @@ AbImportHelper.prototype =
    *
    * @param aName The name of the array in addressbook.json.
    * @return An array of "cards".
    */
   getJsonCards: function(aName)
   {
     if (!aName)
       do_throw("Error - getJSONAb requires an address book name");
-    var file = do_get_file("../mailnews/import/test/resources/addressbook.json");
+    var file = do_get_file("resources/addressbook.json");
     if (!file || !file.exists() || !file.isFile())
       do_throw("Unable to get JSON file");
 
     var fis = Cc["@mozilla.org/network/file-input-stream;1"]
                .createInstance(Ci.nsIFileInputStream);
     fis.init(file, 0x01, 0444, 0);
     var istream = Cc["@mozilla.org/intl/converter-input-stream;1"]
                    .createInstance(Ci.nsIConverterInputStream);
--- a/mailnews/import/test/unit/test_bug_437556.js
+++ b/mailnews/import/test/unit/test_bug_437556.js
@@ -1,15 +1,15 @@
 /**
  * Test for a regression of Bug 437556: mailnews crashes while importing an 
  * address book if a field map is required but not set.
  */
 function run_test()
 {
-  var file = do_get_file("../mailnews/import/test/resources/basic_addressbook.csv");
+  var file = do_get_file("resources/basic_addressbook.csv");
   var errorStr = Cc["@mozilla.org/supports-string;1"]
                   .createInstance(Ci.nsISupportsString);
   // get the Address Book text import interface and make sure it succeeded
   var helper = new AbImportHelper(file, "CSV");
   var abInterface = helper.getInterface("addressbook", ".csv");
   do_check_neq(abInterface, null);
   // prepare to start the import
   abInterface.SetData("addressLocation", file);
--- a/mailnews/import/test/unit/test_ldif_import.js
+++ b/mailnews/import/test/unit/test_ldif_import.js
@@ -9,12 +9,12 @@
  *                export/import in text format *(only tests the import).
  */
 function run_test()
 {
   // Due to the import code using nsIAbManager off the main thread, we need
   // to ensure that it is initialized before we start the main test.
   var abMgr = Cc["@mozilla.org/abmanager;1"].getService(Ci.nsIAbManager);
 
-  var file = do_get_file("../mailnews/import/test/resources/basic_ldif_addressbook.ldif");
+  var file = do_get_file("resources/basic_ldif_addressbook.ldif");
   new AbImportHelper(file, "LDIF", "basic_ldif_addressbook",
                      "basic_addressbook").beginImport();
 }
--- a/mailnews/local/test/unit/head_maillocal.js
+++ b/mailnews/local/test/unit/head_maillocal.js
@@ -1,15 +1,15 @@
 // Import the main scripts that mailnews tests need to set up and tear down
-do_import_script("../mailnews/test/resources/mailDirService.js");
-do_import_script("../mailnews/test/resources/mailTestUtils.js");
+load("../../mailnews/resources/mailDirService.js");
+load("../../mailnews/resources/mailTestUtils.js");
 
 // Import the pop3 server scripts
-do_import_script("../mailnews/test/fakeserver/maild.js")
-do_import_script("../mailnews/test/fakeserver/pop3d.js")
+load("../../mailnews/fakeserver/maild.js")
+load("../../mailnews/fakeserver/pop3d.js")
 
 const POP3_PORT = 1024+110;
 
 // Setup the daemon and server
 // If the debugOption is set, then it will be applied to the server.
 function setupServerDaemon(debugOption) {
   var daemon = new pop3Daemon();
   var handler = new POP3_RFC1939_handler(daemon);
--- a/mailnews/local/test/unit/test_msgCopy.js
+++ b/mailnews/local/test/unit/test_msgCopy.js
@@ -33,17 +33,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 // Test of setting keywords with CopyFileMessage
 
 const copyService = Cc["@mozilla.org/messenger/messagecopyservice;1"]
                       .getService(Ci.nsIMsgCopyService);
-const bugmail11 = do_get_file("../mailnews/test/data/bugmail11");
+const bugmail11 = do_get_file("../../mailnews/data/bugmail11");
                      
 // main test
 
 var hdrs = [];
 
 // tag used with test messages
 var tag1 = "istag";
 
--- a/mailnews/local/test/unit/test_pop3Password.js
+++ b/mailnews/local/test/unit/test_pop3Password.js
@@ -118,17 +118,17 @@ function run_test() {
     .getService(Components.interfaces.nsIPrefBranch);
 
   prefSvc.setBoolPref("mail.biff.play_sound", false);
   prefSvc.setBoolPref("mail.biff.show_alert", false);
   prefSvc.setBoolPref("mail.biff.show_tray_icon", false);
   prefSvc.setBoolPref("mail.biff.animate_dock_icon", false);
 
   // Passwords File (generated from Mozilla 1.8 branch).
-  var signons = do_get_file("../mailnews/test/data/signons-mailnews1.8.txt");
+  var signons = do_get_file("../../mailnews/data/signons-mailnews1.8.txt");
 
   // Copy the file to the profile directory for a PAB
   signons.copyTo(gProfileDir, "signons.txt");
 
   // Set up the Server
   var serverArray = setupServerDaemon();
   daemon = serverArray[0];
   server = serverArray[1];
--- a/mailnews/local/test/unit/test_pop3Password2.js
+++ b/mailnews/local/test/unit/test_pop3Password2.js
@@ -147,17 +147,17 @@ function run_test() {
   prefSvc.setCharPref("mail.server.server2.name", "testpop3 on localhost");
   prefSvc.setIntPref("mail.server.server2.port", 1134);
   prefSvc.setCharPref("mail.server.server2.realhostname", "localhost");
   prefSvc.setCharPref("mail.server.server2.realuserName", "testpop3");
   prefSvc.setCharPref("mail.server.server2.type", "pop3");
   prefSvc.setCharPref("mail.server.server2.userName", "othername");
 
   // Passwords File (generated from Mozilla 1.8 branch).
-  var signons = do_get_file("../mailnews/test/data/signons-mailnews1.8-alt.txt");
+  var signons = do_get_file("../../mailnews/data/signons-mailnews1.8-alt.txt");
 
   // Copy the file to the profile directory
   signons.copyTo(gProfileDir, "signons.txt");
 
   // Set up the Server
   var serverArray = setupServerDaemon();
   daemon = serverArray[0];
   server = serverArray[1];
--- a/mailnews/local/test/unit/test_pop3Password3.js
+++ b/mailnews/local/test/unit/test_pop3Password3.js
@@ -10,17 +10,17 @@ const kHostname = "localhost";
 const kServerUrl = "mailbox://" + kHostname;
 
 function run_test()
 {
   // Login Manager
   var loginMgr = Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager);
 
   // Passwords File (generated from Mozilla 1.8 branch).
-  var signons = do_get_file("../mailnews/test/data/signons-mailnews1.8-multiple.txt");
+  var signons = do_get_file("../../mailnews/data/signons-mailnews1.8-multiple.txt");
 
   // Copy the file to the profile directory for a PAB
   signons.copyTo(gProfileDir, "signons.txt");
 
   // Set up the basic accounts and folders.
   // We would use createPop3ServerAndLocalFolders() however we want to have
   // a different username and NO password for this test (as we expect to load
   // it from signons.txt).
--- a/mailnews/mime/test/unit/head_mime.js
+++ b/mailnews/mime/test/unit/head_mime.js
@@ -1,2 +1,2 @@
 // Import the main scripts that mailnews tests need to set up and tear down
-do_import_script("../mailnews/test/resources/mailDirService.js");
+load("../../mailnews/resources/mailDirService.js");
--- a/mailnews/news/test/unit/head_server_setup.js
+++ b/mailnews/news/test/unit/head_server_setup.js
@@ -1,14 +1,14 @@
 // Import the servers
-do_import_script("../mailnews/test/fakeserver/maild.js");
-do_import_script("../mailnews/test/fakeserver/nntpd.js");
+load("../../mailnews/fakeserver/maild.js");
+load("../../mailnews/fakeserver/nntpd.js");
 
 // Generic mailnews resource scripts
-do_import_script("../mailnews/test/resources/mailDirService.js");
+load("../../mailnews/resources/mailDirService.js");
 
 const kSimpleNewsArticle =
   "From: John Doe <john.doe@example.com>\n"+
   "Date: Sat, 24 Mar 1990 10:59:24 -0500\n"+
   "Newsgroups: test.subscribe.simple\n"+
   "Subject: H2G2 -- What does it mean?\n"+
   "Message-ID: <TSS1@nntp.test>\n"+
   "\n"+
@@ -26,17 +26,17 @@ var groups = [
 // Sets up the NNTP daemon object for use in fake server
 function setupNNTPDaemon() {
   var daemon = new nntpDaemon();
 
   groups.forEach(function (element) {
     daemon.addGroup(element[0]);
   });
 
-  var auto_add = do_get_file("../mailnews/news/test/postings/auto-add/");
+  var auto_add = do_get_file("postings/auto-add/");
   var files = [];
   var enumerator = auto_add.directoryEntries;
   while (enumerator.hasMoreElements())
     files.push(enumerator.getNext().QueryInterface(Ci.nsIFile));
 
   files.sort(function (a, b) {
     if (a.leafName == b.leafName) return 0;
     return a.leafName < b.leafName ? -1 : 1;
rename from mailnews/news/test/postings/auto-add/post1.eml
rename to mailnews/news/test/unit/postings/auto-add/post1.eml
rename from mailnews/news/test/postings/auto-add/post2.eml
rename to mailnews/news/test/unit/postings/auto-add/post2.eml
rename from mailnews/news/test/postings/auto-add/post3.eml
rename to mailnews/news/test/unit/postings/auto-add/post3.eml
rename from mailnews/news/test/postings/auto-add/post4.eml
rename to mailnews/news/test/unit/postings/auto-add/post4.eml
rename from mailnews/news/test/postings/auto-add/post5.eml
rename to mailnews/news/test/unit/postings/auto-add/post5.eml
rename from mailnews/news/test/postings/auto-add/post6.eml
rename to mailnews/news/test/unit/postings/auto-add/post6.eml
rename from mailnews/news/test/postings/auto-add/post7.eml
rename to mailnews/news/test/unit/postings/auto-add/post7.eml
rename from mailnews/news/test/postings/post1.eml
rename to mailnews/news/test/unit/postings/post1.eml
--- a/mailnews/news/test/unit/test_nntpPassword.js
+++ b/mailnews/news/test/unit/test_nntpPassword.js
@@ -12,17 +12,17 @@ var daemon = setupNNTPDaemon();
 // Define these up here for checking with the transaction
 var type = null;
 var test = null;
 
 function run_test() {
   type = "RFC 4643";
 
   // Passwords File (generated from Mozilla 1.8 branch).
-  var signons = do_get_file("../mailnews/test/data/signons-mailnews1.8.txt");
+  var signons = do_get_file("../../mailnews/data/signons-mailnews1.8.txt");
 
   // Copy the file to the profile directory for a PAB
   signons.copyTo(gProfileDir, "signons.txt");
 
   var handler = new NNTP_RFC4643_extension(daemon);
 
   var server = new nsMailServer(handler);
   server.start(NNTP_PORT);
--- a/mailnews/news/test/unit/test_nntpPassword2.js
+++ b/mailnews/news/test/unit/test_nntpPassword2.js
@@ -41,17 +41,17 @@ function run_test() {
   prefSvc.setCharPref("mail.server.server2.name", "testnntp on localhost");
   prefSvc.setIntPref("mail.server.server2.port", NNTP_PORT);
   prefSvc.setCharPref("mail.server.server2.realhostname", "localhost");
   prefSvc.setCharPref("mail.server.server2.type", "nntp");
 
   type = "RFC 4643";
 
   // Passwords File (generated from Mozilla 1.8 branch).
-  var signons = do_get_file("../mailnews/test/data/signons-mailnews1.8-alt.txt");
+  var signons = do_get_file("../../mailnews/data/signons-mailnews1.8-alt.txt");
 
   // Copy the file to the profile directory
   signons.copyTo(gProfileDir, "signons.txt");
 
   var handler = new NNTP_RFC4643_extension(daemon);
 
   var server = new nsMailServer(handler);
   server.start(NNTP_PORT);
--- a/mailnews/news/test/unit/test_nntpPassword3.js
+++ b/mailnews/news/test/unit/test_nntpPassword3.js
@@ -1,28 +1,28 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /**
  * Extra tests for forgetting newsgroup usernames and passwords.
  */
 
-do_import_script("../mailnews/test/resources/mailTestUtils.js");
+load("../../mailnews/resources/mailTestUtils.js");
 
 const kUsername = "testnews";
 const kPassword = "newstest";
 const kProtocol = "nntp";
 const kHostname = "localhost";
 const kServerUrl = "news://" + kHostname;
 
 function run_test()
 {
   // Login Manager
   var loginMgr = Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager);
 
   // Passwords File (generated from Mozilla 1.8 branch).
-  var signons = do_get_file("../mailnews/test/data/signons-mailnews1.8.txt");
+  var signons = do_get_file("../../mailnews/data/signons-mailnews1.8.txt");
 
   // Copy the file to the profile directory for a PAB
   signons.copyTo(gProfileDir, "signons.txt");
 
   // Set up the basic accounts and folders.
   loadLocalMailAccount();
 
   var acctMgr = Cc["@mozilla.org/messenger/account-manager;1"]
--- a/mailnews/news/test/unit/test_server.js
+++ b/mailnews/news/test/unit/test_server.js
@@ -81,17 +81,17 @@ function testRFC977() {
     server.performTest();
     transaction = server.playTransaction();
     do_check_transaction(transaction, ["MODE READER",
         "LISTGROUP test.subscribe.empty"]);*/
 
     // Test - posting
     test = "news with post";
     server.resetTest();
-    var url = create_post(prefix, "../mailnews/news/test/postings/post1.eml");
+    var url = create_post(prefix, "postings/post1.eml");
     setupProtocolTest(NNTP_PORT, url);
     server.performTest();
     transaction = server.playTransaction();
     do_check_transaction(transaction, ["MODE READER", "POST"]);
   } catch (e) {
     dump("NNTP Protocol test "+test+" failed for type RFC 977:\n");
     try {
       var trans = server.playTransaction();
rename from mailnews/addrbook/test/resources/abLists1.mab
rename to mailnews/test/data/abLists1.mab
rename from mailnews/addrbook/test/resources/abLists2.mab
rename to mailnews/test/data/abLists2.mab
--- a/mailnews/test/data/readme.txt
+++ b/mailnews/test/data/readme.txt
@@ -7,8 +7,42 @@ documentation.
 signons-mailnews1.8.txt
 -----------------------
 
 This is a passwords file from gecko 1.8/gecko 1.9/early 1.9.1
 (TB 1.5/2.0/pre 3.0 beta 1, SM 1.0/1.5/early 2.0). It is used as a test input
 for several test_*Password.js files to check that we load usernames and
 passwords correctly from the legacy file.
 
+abLists1.mab
+------------
+
+An address book with 5 cards and 3 lists. The cards only have the email and
+prefer mail format set:
+
+test1@invalid.com  unknown
+test2@invalid.com  unknown
+test3@invalid.com  unknown
+test4@invalid.com  plain text
+test5@invalid.com  html
+
+There are 3 lists, TestList1, TestList2 and TestList3. They have the following
+cards:
+
+TestList1:
+
+test1@invalid.com
+test2@invalid.com
+test3@invalid.com
+
+TestList2:
+
+test4@invalid.com
+
+TestList3:
+
+test5@invalid.com
+
+
+abLists2.mab
+------------
+
+The same as abLists1.mab, but with com.invalid instead of invalid.com, and ListTestX instead of TestListX.
--- a/mailnews/test/fakeserver/pop3d.js
+++ b/mailnews/test/fakeserver/pop3d.js
@@ -1,13 +1,13 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 // This file implements test POP3 servers
 
 function readFile(fileName) {
-  var file = do_get_file("../mailnews/local/test/unit/data/" + fileName);
+  var file = do_get_file("data/" + fileName);
 
   // If these fail, there is a problem with the test
   do_check_neq(file, null);
   do_check_true(file.exists());
 
   var ioService = Cc["@mozilla.org/network/io-service;1"]
                     .getService(Ci.nsIIOService);
 
rename from mailnews/addrbook/test/resources/abSetup.js
rename to mailnews/test/resources/abSetup.js
rename from mailnews/db/gloda/test/resources/messageGenerator.js
rename to mailnews/test/resources/messageGenerator.js
rename from mailnews/base/test/resources/msgFolderListenerSetup.js
rename to mailnews/test/resources/msgFolderListenerSetup.js