test: convert a few more specs to async/await (#39712)
This commit is contained in:
parent
54d8402a6c
commit
f27b034045
10 changed files with 70 additions and 89 deletions
|
@ -1218,8 +1218,7 @@ describe('webContents module', () => {
|
|||
res.end();
|
||||
});
|
||||
});
|
||||
server.listen(0, '127.0.0.1', () => {
|
||||
const url = 'http://127.0.0.1:' + (server.address() as AddressInfo).port;
|
||||
listen(server).then(({ url }) => {
|
||||
const content = `<iframe src=${url}></iframe>`;
|
||||
w.webContents.on('did-frame-finish-load', (e, isMainFrame) => {
|
||||
if (!isMainFrame) {
|
||||
|
@ -1591,8 +1590,9 @@ describe('webContents module', () => {
|
|||
default:
|
||||
done('unsupported endpoint');
|
||||
}
|
||||
}).listen(0, '127.0.0.1', () => {
|
||||
serverUrl = 'http://127.0.0.1:' + (server.address() as AddressInfo).port;
|
||||
});
|
||||
listen(server).then(({ url }) => {
|
||||
serverUrl = url;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
@ -1721,11 +1721,10 @@ describe('webContents module', () => {
|
|||
}
|
||||
res.end('<a id="a" href="/should_have_referrer" target="_blank">link</a>');
|
||||
});
|
||||
server.listen(0, '127.0.0.1', () => {
|
||||
const url = 'http://127.0.0.1:' + (server.address() as AddressInfo).port + '/';
|
||||
listen(server).then(({ url }) => {
|
||||
w.webContents.once('did-finish-load', () => {
|
||||
w.webContents.setWindowOpenHandler(details => {
|
||||
expect(details.referrer.url).to.equal(url);
|
||||
expect(details.referrer.url).to.equal(url + '/');
|
||||
expect(details.referrer.policy).to.equal('strict-origin-when-cross-origin');
|
||||
return { action: 'allow' };
|
||||
});
|
||||
|
@ -1748,11 +1747,10 @@ describe('webContents module', () => {
|
|||
}
|
||||
res.end('');
|
||||
});
|
||||
server.listen(0, '127.0.0.1', () => {
|
||||
const url = 'http://127.0.0.1:' + (server.address() as AddressInfo).port + '/';
|
||||
listen(server).then(({ url }) => {
|
||||
w.webContents.once('did-finish-load', () => {
|
||||
w.webContents.setWindowOpenHandler(details => {
|
||||
expect(details.referrer.url).to.equal(url);
|
||||
expect(details.referrer.url).to.equal(url + '/');
|
||||
expect(details.referrer.policy).to.equal('strict-origin-when-cross-origin');
|
||||
return { action: 'allow' };
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue