Add test for native addon after reload
This commit is contained in:
parent
526086d900
commit
349ea3a15a
2 changed files with 17 additions and 2 deletions
|
@ -1095,19 +1095,30 @@ describe('BrowserWindow module', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
it('opens window of about:blank with cross-scripting enabled', (done) => {
|
it('opens window of about:blank with cross-scripting enabled', (done) => {
|
||||||
ipcMain.once('answer', function (event, content) {
|
ipcMain.once('answer', (event, content) => {
|
||||||
assert.equal(content, 'Hello')
|
assert.equal(content, 'Hello')
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
w.loadURL('file://' + path.join(fixtures, 'api', 'native-window-open.html#blank'))
|
w.loadURL('file://' + path.join(fixtures, 'api', 'native-window-open.html#blank'))
|
||||||
})
|
})
|
||||||
it('opens window of same domain with cross-scripting enabled', (done) => {
|
it('opens window of same domain with cross-scripting enabled', (done) => {
|
||||||
ipcMain.once('answer', function (event, content) {
|
ipcMain.once('answer', (event, content) => {
|
||||||
assert.equal(content, 'Hello')
|
assert.equal(content, 'Hello')
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
w.loadURL('file://' + path.join(fixtures, 'api', 'native-window-open.html#file'))
|
w.loadURL('file://' + path.join(fixtures, 'api', 'native-window-open.html#file'))
|
||||||
})
|
})
|
||||||
|
it('loads native addons correctly after reload', (done) => {
|
||||||
|
ipcMain.once('answer', (event, content) => {
|
||||||
|
assert.equal(content, 'function')
|
||||||
|
ipcMain.once('answer', (event, content) => {
|
||||||
|
assert.equal(content, 'function')
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
w.reload()
|
||||||
|
})
|
||||||
|
w.loadURL('file://' + path.join(fixtures, 'api', 'native-window-open.html#native-addon'))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
4
spec/fixtures/api/native-window-open.html
vendored
4
spec/fixtures/api/native-window-open.html
vendored
|
@ -15,6 +15,10 @@
|
||||||
const content = popup.document.querySelector('h1').innerText;
|
const content = popup.document.querySelector('h1').innerText;
|
||||||
ipcRenderer.send('answer', content);
|
ipcRenderer.send('answer', content);
|
||||||
};
|
};
|
||||||
|
},
|
||||||
|
'native-addon': () => {
|
||||||
|
const runas = require('runas');
|
||||||
|
ipcRenderer.send('answer', typeof runas);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const test = location.hash.slice(1);
|
const test = location.hash.slice(1);
|
||||||
|
|
Loading…
Reference in a new issue