diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /comm/mailnews/local/test/unit/test_pop3Proxy.js | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'comm/mailnews/local/test/unit/test_pop3Proxy.js')
-rw-r--r-- | comm/mailnews/local/test/unit/test_pop3Proxy.js | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/comm/mailnews/local/test/unit/test_pop3Proxy.js b/comm/mailnews/local/test/unit/test_pop3Proxy.js new file mode 100644 index 0000000000..248bbaf92b --- /dev/null +++ b/comm/mailnews/local/test/unit/test_pop3Proxy.js @@ -0,0 +1,60 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ +// Test that POP3 over a proxy works. + +const { NetworkTestUtils } = ChromeUtils.import( + "resource://testing-common/mailnews/NetworkTestUtils.jsm" +); +const { PromiseTestUtils } = ChromeUtils.import( + "resource://testing-common/mailnews/PromiseTestUtils.jsm" +); + +const PORT = 110; + +var server, daemon, incomingServer; + +add_setup(async function () { + // Disable new mail notifications + Services.prefs.setBoolPref("mail.biff.play_sound", false); + Services.prefs.setBoolPref("mail.biff.show_alert", false); + Services.prefs.setBoolPref("mail.biff.show_tray_icon", false); + Services.prefs.setBoolPref("mail.biff.animate_dock_icon", false); + + [daemon, server] = setupServerDaemon(); + server.start(); + NetworkTestUtils.configureProxy("pop.tinderbox.invalid", PORT, server.port); + + // Set up the basic accounts and folders + incomingServer = createPop3ServerAndLocalFolders( + PORT, + "pop.tinderbox.invalid" + ); + + // Add a message to download + daemon.setMessages(["message1.eml"]); +}); + +add_task(async function downloadEmail() { + // Check that we haven't got any messages in the folder, if we have its a test + // setup issue. + equal(localAccountUtils.inboxFolder.getTotalMessages(false), 0); + + // Now get the mail + let urlListener = new PromiseTestUtils.PromiseUrlListener(); + MailServices.pop3.GetNewMail( + null, + urlListener, + localAccountUtils.inboxFolder, + incomingServer + ); + await urlListener.promise; + + // We downloaded a message, so it works! + equal(localAccountUtils.inboxFolder.getTotalMessages(false), 1); +}); + +add_task(async function cleanUp() { + NetworkTestUtils.shutdownServers(); + incomingServer.closeCachedConnections(); + server.stop(); +}); |