diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
commit | fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch) | |
tree | 4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /netwerk/test/unit/test_channel_close.js | |
parent | Releasing progress-linux version 124.0.1-1~progress7.99u1. (diff) | |
download | firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'netwerk/test/unit/test_channel_close.js')
-rw-r--r-- | netwerk/test/unit/test_channel_close.js | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/netwerk/test/unit/test_channel_close.js b/netwerk/test/unit/test_channel_close.js index f8f78fd211..a143f4c495 100644 --- a/netwerk/test/unit/test_channel_close.js +++ b/netwerk/test/unit/test_channel_close.js @@ -18,32 +18,41 @@ var httpbody = "0123456789"; var live_channels = []; -function run_test() { +add_task(async function test() { httpserver.registerPathHandler(testpath, serverHandler); httpserver.start(-1); + registerCleanupFunction(async () => { + if (httpserver) { + await httpserver.stop(); + } + }); - httpProtocolHandler.EnsureHSTSDataReady().then(function () { - var local_channel; + await httpProtocolHandler.EnsureHSTSDataReady(); - // Opened channel that has no remaining references on shutdown - local_channel = setupChannel(testpath); - local_channel.asyncOpen(new ChannelListener(checkRequest, local_channel)); + // Opened channel that has no remaining references on shutdown + let local_channel = setupChannel(testpath); + local_channel.asyncOpen(new SimpleChannelListener()); - // Opened channel that has no remaining references after being opened - setupChannel(testpath).asyncOpen(new ChannelListener(function () {}, null)); + // Opened channel that has no remaining references after being opened + setupChannel(testpath).asyncOpen(new SimpleChannelListener()); - // Unopened channel that has remaining references on shutdown - live_channels.push(setupChannel(testpath)); + // Unopened channel that has remaining references on shutdown + live_channels.push(setupChannel(testpath)); - // Opened channel that has remaining references on shutdown - live_channels.push(setupChannel(testpath)); + // Opened channel that has remaining references on shutdown + live_channels.push(setupChannel(testpath)); + await new Promise(resolve => { live_channels[1].asyncOpen( - new ChannelListener(checkRequestFinish, live_channels[1]) + new SimpleChannelListener((req, data) => { + Assert.equal(data, httpbody); + resolve(); + }) ); }); - do_test_pending(); -} + await httpserver.stop(); + httpserver = null; +}); function setupChannel(path) { var chan = NetUtil.newChannel({ @@ -59,12 +68,3 @@ function serverHandler(metadata, response) { response.setHeader("Content-Type", "text/plain", false); response.bodyOutputStream.write(httpbody, httpbody.length); } - -function checkRequest(request, data, context) { - Assert.equal(data, httpbody); -} - -function checkRequestFinish(request, data, context) { - checkRequest(request, data, context); - httpserver.stop(do_test_finished); -} |