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/news/test/unit/test_nntpProxy.js | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.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 '')
-rw-r--r-- | comm/mailnews/news/test/unit/test_nntpProxy.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/comm/mailnews/news/test/unit/test_nntpProxy.js b/comm/mailnews/news/test/unit/test_nntpProxy.js new file mode 100644 index 0000000000..826a057c9d --- /dev/null +++ b/comm/mailnews/news/test/unit/test_nntpProxy.js @@ -0,0 +1,38 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ +// Tests that NNTP over a SOCKS proxy works. + +const { NetworkTestUtils } = ChromeUtils.import( + "resource://testing-common/mailnews/NetworkTestUtils.jsm" +); +const { PromiseTestUtils } = ChromeUtils.import( + "resource://testing-common/mailnews/PromiseTestUtils.jsm" +); + +const PORT = 119; + +var daemon, localserver, server; + +add_setup(async function () { + daemon = setupNNTPDaemon(); + server = makeServer(NNTP_RFC2980_handler, daemon); + server.start(); + NetworkTestUtils.configureProxy("news.tinderbox.invalid", PORT, server.port); + localserver = setupLocalServer(PORT, "news.tinderbox.invalid"); +}); + +add_task(async function findMessages() { + // This is a trivial check that makes sure that we actually do some network + // traffic without caring about the exact network traffic. + let folder = localserver.rootFolder.getChildNamed("test.filter"); + equal(folder.getTotalMessages(false), 0); + let asyncUrlListener = new PromiseTestUtils.PromiseUrlListener(); + folder.getNewMessages(null, asyncUrlListener); + await asyncUrlListener.promise; + equal(folder.getTotalMessages(false), 8); +}); + +add_task(async function cleanUp() { + NetworkTestUtils.shutdownServers(); + localserver.closeCachedConnections(); +}); |