diff options
Diffstat (limited to 'netwerk/test')
-rw-r--r-- | netwerk/test/unit/client-cert.p12 | bin | 2333 -> 2333 bytes | |||
-rw-r--r-- | netwerk/test/unit/test_websocket_server.js | 50 | ||||
-rw-r--r-- | netwerk/test/unit/test_websocket_server_multiclient.js | 9 | ||||
-rw-r--r-- | netwerk/test/unit/xpcshell.ini | 4 |
4 files changed, 54 insertions, 9 deletions
diff --git a/netwerk/test/unit/client-cert.p12 b/netwerk/test/unit/client-cert.p12 Binary files differindex 80c8dad8a0..0f0fd43eba 100644 --- a/netwerk/test/unit/client-cert.p12 +++ b/netwerk/test/unit/client-cert.p12 diff --git a/netwerk/test/unit/test_websocket_server.js b/netwerk/test/unit/test_websocket_server.js index 8d760cb65a..a33413a02f 100644 --- a/netwerk/test/unit/test_websocket_server.js +++ b/netwerk/test/unit/test_websocket_server.js @@ -25,6 +25,24 @@ add_setup(async function setup() { }); }); +function makeChan(uri) { + let chan = NetUtil.newChannel({ + uri, + loadUsingSystemPrincipal: true, + }).QueryInterface(Ci.nsIHttpChannel); + chan.loadFlags = Ci.nsIChannel.LOAD_INITIAL_DOCUMENT_URI; + return chan; +} + +function httpChannelOpenPromise(chan, flags) { + return new Promise(resolve => { + function finish(req, buffer) { + resolve([req, buffer]); + } + chan.asyncOpen(new ChannelListener(finish, null, flags)); + }); +} + async function channelOpenPromise(url, msg) { let conn = new WebSocketConnection(); await conn.open(url); @@ -257,6 +275,37 @@ async function test_h2_ws_with_h2_proxy() { await proxy.stop(); } +async function test_bug_1848013() { + Services.prefs.setBoolPref("network.http.http2.websockets", true); + + let proxy = new NodeHTTPProxyServer(); + await proxy.start(); + + registerCleanupFunction(async () => { + await wss.stop(); + await proxy.stop(); + }); + + let wss = new NodeWebSocketHttp2Server(); + await wss.start(); + Assert.notEqual(wss.port(), null); + await wss.registerMessageHandler((data, ws) => { + ws.send(data); + }); + + // To create a h2 connection before the websocket one. + let chan = makeChan(`https://localhost:${wss.port()}/`); + await httpChannelOpenPromise(chan, CL_ALLOW_UNKNOWN_CL); + + let url = `wss://localhost:${wss.port()}`; + const msg = "test h2 websocket with h1 insecure proxy"; + let [status, res] = await channelOpenPromise(url, msg); + Assert.equal(status, Cr.NS_OK); + Assert.deepEqual(res, [msg]); + + await proxy.stop(); +} + add_task(test_h1_websocket_direct); add_task(test_h2_websocket_direct); add_task(test_h1_ws_with_secure_h1_proxy); @@ -265,3 +314,4 @@ add_task(test_h1_ws_with_h2_proxy); add_task(test_h2_ws_with_h1_insecure_proxy); add_task(test_h2_ws_with_h1_secure_proxy); add_task(test_h2_ws_with_h2_proxy); +add_task(test_bug_1848013); diff --git a/netwerk/test/unit/test_websocket_server_multiclient.js b/netwerk/test/unit/test_websocket_server_multiclient.js index 91c5b5d55f..33e730acbf 100644 --- a/netwerk/test/unit/test_websocket_server_multiclient.js +++ b/netwerk/test/unit/test_websocket_server_multiclient.js @@ -116,20 +116,17 @@ async function test_h1_ws_with_h2_proxy() { // ws h2 with insecure h1.1 proxy async function test_h2_ws_with_insecure_h1_proxy() { - // disabled until bug 1800533 complete - // await spinup_and_check(NodeHTTPProxyServer, NodeWebSocketHttp2Server); + await spinup_and_check(NodeHTTPProxyServer, NodeWebSocketHttp2Server); } // ws h2 with secure h1 proxy async function test_h2_ws_with_secure_h1_proxy() { - // disabled until bug 1800533 complete - // await spinup_and_check(NodeHTTPSProxyServer, NodeWebSocketHttp2Server); + await spinup_and_check(NodeHTTPSProxyServer, NodeWebSocketHttp2Server); } // ws h2 with secure h2 proxy async function test_h2_ws_with_h2_proxy() { - // disabled until bug 1800533 complete - // await spinup_and_check(NodeHTTP2ProxyServer, NodeWebSocketHttp2Server); + await spinup_and_check(NodeHTTP2ProxyServer, NodeWebSocketHttp2Server); } add_task(test_h1_websocket_direct); diff --git a/netwerk/test/unit/xpcshell.ini b/netwerk/test/unit/xpcshell.ini index 456e8ddfc5..ed69ad2627 100644 --- a/netwerk/test/unit/xpcshell.ini +++ b/netwerk/test/unit/xpcshell.ini @@ -403,9 +403,7 @@ skip-if = appname == "thunderbird" [test_bug464591.js] skip-if = appname == "thunderbird" [test_alt-data_simple.js] -skip-if = - win10_2004 && bits == 64 # Bug 1718292 - win11_2009 && bits == 64 && !debug # Bug 1797751 +skip-if = os == "win" # Bug 1760081 run-sequentially = very high failure rate in parallel [test_alt-data_stream.js] [test_alt-data_too_big.js] |