test: convert functions to async & eliminate duplicates (#37316)

test: convert functions to async

Co-authored-by: Milan Burda <miburda@microsoft.com>
This commit is contained in:
Milan Burda 2023-02-20 12:30:57 +01:00 committed by GitHub
parent 969665eaa2
commit f97d68c4bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 225 additions and 343 deletions

View file

@ -4,8 +4,7 @@ import * as http from 'http';
import { emittedNTimes, emittedOnce } from './lib/events-helpers';
import { closeWindow } from './lib/window-helpers';
import { app, BrowserWindow, ipcMain } from 'electron/main';
import { AddressInfo } from 'net';
import { ifdescribe } from './lib/spec-helpers';
import { ifdescribe, listen } from './lib/spec-helpers';
describe('renderer nodeIntegrationInSubFrames', () => {
const generateTests = (description: string, webPreferences: any) => {
@ -218,15 +217,12 @@ ifdescribe(process.platform !== 'linux')('cross-site frame sandboxing', () => {
let crossSiteUrl: string;
let serverUrl: string;
before(function (done) {
before(async function () {
server = http.createServer((req, res) => {
res.end(`<iframe name="frame" src="${crossSiteUrl}" />`);
});
server.listen(0, '127.0.0.1', () => {
serverUrl = `http://127.0.0.1:${(server.address() as AddressInfo).port}/`;
crossSiteUrl = `http://localhost:${(server.address() as AddressInfo).port}/`;
done();
});
serverUrl = (await listen(server)).url;
crossSiteUrl = serverUrl.replace('127.0.0.1', 'localhost');
});
after(() => {