|
@@ -1,5 +1,6 @@
|
|
|
'use strict'
|
|
|
|
|
|
+const assert = require('assert')
|
|
|
const chai = require('chai')
|
|
|
const ChildProcess = require('child_process')
|
|
|
const dirtyChai = require('dirty-chai')
|
|
@@ -14,6 +15,8 @@ const { expect } = chai
|
|
|
chai.use(dirtyChai)
|
|
|
|
|
|
describe('BrowserView module', () => {
|
|
|
+ const fixtures = path.resolve(__dirname, 'fixtures')
|
|
|
+
|
|
|
let w = null
|
|
|
let view = null
|
|
|
|
|
@@ -178,11 +181,26 @@ describe('BrowserView module', () => {
|
|
|
|
|
|
describe('new BrowserView()', () => {
|
|
|
it('does not crash on exit', async () => {
|
|
|
- const appPath = path.join(__dirname, 'fixtures', 'api', 'leak-exit-browserview.js')
|
|
|
+ const appPath = path.join(fixtures, 'api', 'leak-exit-browserview.js')
|
|
|
const electronPath = remote.getGlobal('process').execPath
|
|
|
const appProcess = ChildProcess.spawn(electronPath, [appPath])
|
|
|
const [code] = await emittedOnce(appProcess, 'close')
|
|
|
expect(code).to.equal(0)
|
|
|
})
|
|
|
})
|
|
|
+
|
|
|
+ describe('window.open()', () => {
|
|
|
+ it('works in BrowserView', (done) => {
|
|
|
+ view = new BrowserView()
|
|
|
+ w.setBrowserView(view)
|
|
|
+ view.webContents.once('new-window', (e, url, frameName, disposition, options, additionalFeatures) => {
|
|
|
+ e.preventDefault()
|
|
|
+ assert.strictEqual(url, 'http://host/')
|
|
|
+ assert.strictEqual(frameName, 'host')
|
|
|
+ assert.strictEqual(additionalFeatures[0], 'this-is-not-a-standard-feature')
|
|
|
+ done()
|
|
|
+ })
|
|
|
+ view.webContents.loadFile(path.join(fixtures, 'pages', 'window-open.html'))
|
|
|
+ })
|
|
|
+ })
|
|
|
})
|