test: actually test sandbox events in the test that says 'test sandbox events' (#19284)

This commit is contained in:
Jeremy Apthorp 2019-07-16 13:43:23 -07:00 committed by GitHub
parent b5f69e0b9f
commit c5e249b85c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View file

@ -1846,13 +1846,13 @@ describe('BrowserWindow module', () => {
describe('event handling', () => {
let w: BrowserWindow = null as unknown as BrowserWindow
beforeEach(() => {
w = new BrowserWindow({show: false, webPreferences: {nodeIntegration: true}})
w = new BrowserWindow({show: false, webPreferences: {sandbox: true}})
})
it('works for window events', (done) => {
waitForEvents(w, [
'page-title-updated'
], done)
w.loadFile(path.join(fixtures, 'api', 'sandbox.html'), { search: 'window-events' })
w.loadURL(`data:text/html,<script>document.title = 'changed'</script>`)
})
it('works for stop events', (done) => {
@ -1861,7 +1861,7 @@ describe('BrowserWindow module', () => {
'did-fail-load',
'did-stop-loading'
], done)
w.loadFile(path.join(fixtures, 'api', 'sandbox.html'), { search: 'webcontents-stop' })
w.loadURL(`data:text/html,<script>stop()</script>`)
})
it('works for web contents events', (done) => {
@ -1869,7 +1869,8 @@ describe('BrowserWindow module', () => {
'did-finish-load',
'did-frame-finish-load',
'did-navigate-in-page',
'will-navigate',
// TODO(nornagon): sandboxed pages should also emit will-navigate
// 'will-navigate',
'did-start-loading',
'did-stop-loading',
'did-frame-finish-load',