test: re-enable tests that were disabled in chromium rolls (#43968)

* test: fix should support base url for data urls test

Caused by 5802682

* test: fixup extensions can cancel http requests

* chore: document custom protocol handling on Windows change due to Non-Special Scheme URLs shipping

5802682
This commit is contained in:
John Kleinschmidt 2024-09-26 08:53:27 -04:00 committed by GitHub
parent b60013fcf1
commit 40cae71df8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 47 additions and 12 deletions

View file

@ -6,7 +6,7 @@ import * as path from 'node:path';
import * as fs from 'node:fs/promises';
import * as WebSocket from 'ws';
import { emittedNTimes, emittedUntil } from './lib/events-helpers';
import { ifit, listen } from './lib/spec-helpers';
import { ifit, listen, waitUntil } from './lib/spec-helpers';
import { once } from 'node:events';
const uuid = require('uuid');
@ -355,14 +355,20 @@ describe('chrome extensions', () => {
w = new BrowserWindow({ show: false, webPreferences: { session: customSession, sandbox: true, contextIsolation: true } });
});
// FIXME: these tests do not work as intended. the extension is loaded in the browser, but
// the extension's background page has not yet loaded by the time we check behavior, causing
// race conditions in CI vs local.
describe.skip('onBeforeRequest', () => {
describe('onBeforeRequest', () => {
async function haveRejectedFetch () {
try {
await fetch(w.webContents, url);
} catch (ex: any) {
return ex.message === 'Failed to fetch';
}
return false;
}
it('can cancel http requests', async () => {
await w.loadURL(url);
await customSession.loadExtension(path.join(fixtures, 'extensions', 'chrome-webRequest'));
await expect(fetch(w.webContents, url)).to.eventually.be.rejectedWith('Failed to fetch');
await expect(waitUntil(haveRejectedFetch)).to.eventually.be.fulfilled();
});
it('does not cancel http requests when no extension loaded', async () => {