add simple unit test for deleting incoming pop3 duplicates, r=standard8, bug 668563
authorDavid Bienvenu <bienvenu@nventure.com>
Tue, 05 Jul 2011 08:33:43 -0700
changeset 8273 2bfa709f04ce425daf07825f288140b27dfb74b3
parent 8272 2a1da01c4f764df9b733da7134797aa7b8ce4f82
child 8274 8c885c3fc9acbf97cfd9d6044137f62cc379bdf0
push id84
push userbugzilla@standard8.plus.com
push dateTue, 16 Aug 2011 21:25:04 +0000
treeherdercomm-beta@6970c86be3cd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstandard8, bug
bugs668563
add simple unit test for deleting incoming pop3 duplicates, r=standard8, bug 668563
mailnews/local/test/unit/test_pop3Duplicates.js
mailnews/local/test/unit/xpcshell.ini
new file mode 100644
--- /dev/null
+++ b/mailnews/local/test/unit/test_pop3Duplicates.js
@@ -0,0 +1,38 @@
+/**
+ * The intent of this file is to test duplicate handling options
+ * in the pop3 download code.
+ */
+load("../../../resources/POP3pump.js");
+Components.utils.import("resource://gre/modules/Services.jsm");
+
+var testSubjects = ["[Bug 397009] A filter will let me tag, but not untag",
+                    "Hello, did you receive my bugmail?"];
+
+function run_test()
+{
+  // Set duplicate action to be delete duplicates.
+  Services.prefs.setIntPref("mail.server.default.dup_action",
+                            Ci.nsIMsgIncomingServer.deleteDups);
+  // add 3 messages, 2 of which are duplicates.
+  gPOP3Pump.files = ["../../../data/bugmail1",
+                     "../../../data/draft1",
+                     "../../../data/bugmail1"];
+  gPOP3Pump.onDone = continueTest;
+  do_test_pending();
+  gPOP3Pump.run();
+}
+
+function continueTest()
+{
+  // get message headers for the inbox folder
+  let enumerator = gLocalInboxFolder.msgDatabase.EnumerateMessages();
+  var msgCount = 0;
+  while (enumerator.hasMoreElements())
+  {
+    let hdr = enumerator.getNext().QueryInterface(Ci.nsIMsgDBHdr);
+    do_check_eq(hdr.subject, testSubjects[msgCount++]);
+  }
+  do_check_eq(msgCount, 2);
+  gPOP3Pump = null;
+  do_test_finished();
+}
--- a/mailnews/local/test/unit/xpcshell.ini
+++ b/mailnews/local/test/unit/xpcshell.ini
@@ -6,16 +6,17 @@ tail = tail_local.js
 [test_fileName.js]
 [test_localSubFolders.js]
 [test_mailboxContentLength.js]
 [test_mailboxProtocol.js]
 [test_msgCopy.js]
 [test_over2GBMailboxes.js]
 [test_over4GBMailboxes.js]
 [test_pop3AuthMethods.js]
+[test_pop3Duplicates.js]
 [test_pop3GSSAPIFail.js]
 [test_pop3GetNewMail.js]
 [test_pop3Password.js]
 [test_pop3Password2.js]
 [test_pop3Password3.js]
 [test_pop3PasswordFailure.js]
 [test_pop3PasswordFailure2.js]
 [test_pop3Pump.js]