test: untangle a chromium-spec test (#16456)

This commit is contained in:
Jeremy Apthorp 2019-01-22 13:26:32 -08:00 committed by GitHub
parent 34ac68c4a8
commit fd8b9450ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -520,27 +520,28 @@ describe('chromium feature', () => {
b = window.open('about:blank') b = window.open('about:blank')
}) })
it('open a blank page when no URL is specified', (done) => { it('open a blank page when no URL is specified', async () => {
let b = null const browserWindowCreated = emittedOnce(app, 'browser-window-created')
app.once('browser-window-created', (event, { webContents }) => { const w = window.open()
webContents.once('did-finish-load', () => { try {
const { location } = b const [, { webContents }] = await browserWindowCreated
b.close() await emittedOnce(webContents, 'did-finish-load')
assert.strictEqual(location.href, 'about:blank') assert.strictEqual(w.location.href, 'about:blank')
} finally {
w.close()
}
})
let c = null it('open a blank page when an empty URL is specified', async () => {
app.once('browser-window-created', (event, { webContents }) => { const browserWindowCreated = emittedOnce(app, 'browser-window-created')
webContents.once('did-finish-load', () => { const w = window.open('')
const { location } = c try {
c.close() const [, { webContents }] = await browserWindowCreated
assert.strictEqual(location.href, 'about:blank') await emittedOnce(webContents, 'did-finish-load')
done() assert.strictEqual(w.location.href, 'about:blank')
}) } finally {
}) w.close()
c = window.open('') }
})
})
b = window.open()
}) })
it('throws an exception when the arguments cannot be converted to strings', () => { it('throws an exception when the arguments cannot be converted to strings', () => {