(path, targetFrameCount, callback)
| 30 | }); |
| 31 | |
| 32 | function testRequest(path, targetFrameCount, callback) { |
| 33 | const obs = new PerformanceObserver( |
| 34 | common.mustCallAtLeast((list, observer) => { |
| 35 | const entries = list.getEntries(); |
| 36 | for (let n = 0; n < entries.length; n++) { |
| 37 | const entry = entries[n]; |
| 38 | if (entry.name !== 'Http2Session') continue; |
| 39 | if (entry.detail.type !== 'client') continue; |
| 40 | assert.strictEqual(entry.detail.framesReceived, targetFrameCount); |
| 41 | observer.disconnect(); |
| 42 | callback(); |
| 43 | } |
| 44 | })); |
| 45 | obs.observe({ type: 'http2' }); |
| 46 | const client = |
| 47 | http2.connect(`http://localhost:${server.address().port}`, () => { |
| 48 | const req = client.request({ ':path': path }); |
| 49 | req.resume(); |
| 50 | req.end(); |
| 51 | req.on('end', () => client.close()); |
| 52 | }); |
| 53 | } |
| 54 | |
| 55 | // SETTINGS => SETTINGS => HEADERS => DATA |
| 56 | const MIN_FRAME_COUNT = 4; |
no test coverage detected