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_http3_alt_svc.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_http3_alt_svc.js')
-rw-r--r-- | netwerk/test/unit/test_http3_alt_svc.js | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/netwerk/test/unit/test_http3_alt_svc.js b/netwerk/test/unit/test_http3_alt_svc.js index 201101eb19..46488525ae 100644 --- a/netwerk/test/unit/test_http3_alt_svc.js +++ b/netwerk/test/unit/test_http3_alt_svc.js @@ -5,7 +5,7 @@ let h3AltSvc; let h3Route; let prefs; -let tests = [test_https_alt_svc, testsDone]; +let tests = [test_https_alt_svc, test_https_alt_svc_1, testsDone]; let current_test = 0; @@ -68,7 +68,9 @@ function makeChan(uri) { return chan; } -let WaitForHttp3Listener = function () {}; +let WaitForHttp3Listener = function (expectedH3Version) { + this._expectedH3Version = expectedH3Version; +}; WaitForHttp3Listener.prototype = { onDataAvailableFired: false, @@ -84,7 +86,7 @@ WaitForHttp3Listener.prototype = { read_stream(stream, cnt); }, - onStopRequest: function testOnStopRequest(request, status) { + onStopRequest: function testOnStopRequest(request) { let routed = "NA"; try { routed = request.getRequestHeader("Alt-Used"); @@ -96,13 +98,18 @@ WaitForHttp3Listener.prototype = { try { httpVersion = request.protocolVersion; } catch (e) {} - Assert.equal(httpVersion, "h3-29"); + Assert.equal(httpVersion, this._expectedH3Version); run_next_test(); } else { dump("poll later for alt svc mapping\n"); do_test_pending(); do_timeout(500, () => { - doTest(this.uri, this.expectedRoute, this.h3AltSvc); + doTest( + this.uri, + this.expectedRoute, + this.h3AltSvc, + this._expectedH3Version + ); }); } @@ -110,9 +117,9 @@ WaitForHttp3Listener.prototype = { }, }; -function doTest(uri, expectedRoute, altSvc) { +function doTest(uri, expectedRoute, altSvc, expectedH3Version) { let chan = makeChan(uri); - let listener = new WaitForHttp3Listener(); + let listener = new WaitForHttp3Listener(expectedH3Version); listener.uri = uri; listener.expectedRoute = expectedRoute; listener.h3AltSvc = altSvc; @@ -121,11 +128,23 @@ function doTest(uri, expectedRoute, altSvc) { } // Test Alt-Svc for http3. -// H2 server returns alt-svc=h2=foo2.example.com:8000,h3-29=:h3port,h3-30=foo2.example.com:8443 +// H2 server returns alt-svc=h2=foo2.example.com:8000,h3-29=:h3port function test_https_alt_svc() { dump("test_https_alt_svc()\n"); do_test_pending(); - doTest(httpsOrigin + "http3-test2", h3Route, h3AltSvc); + doTest(httpsOrigin + "http3-test2", h3Route, h3AltSvc, "h3-29"); +} + +// Test if we use the latest version of HTTP/3. +// H2 server returns alt-svc=h3-29=:h3port,h3=:h3port +function test_https_alt_svc_1() { + // Close the previous connection and clear alt-svc mappings. + Services.obs.notifyObservers(null, "last-pb-context-exited"); + Services.obs.notifyObservers(null, "net:cancel-all-connections"); + do_test_pending(); + do_timeout(1000, () => { + doTest(httpsOrigin + "http3-test3", h3Route, h3AltSvc, "h3"); + }); } function testsDone() { |