Completing UTs
This commit is contained in:
parent
0b7e7458c9
commit
e546820a4a
3 changed files with 15 additions and 23 deletions
|
@ -1295,13 +1295,12 @@ describe('BrowserWindow module', function () {
|
||||||
})
|
})
|
||||||
sandboxServer.on('connection', (client) => {
|
sandboxServer.on('connection', (client) => {
|
||||||
client.once('data', function (data) {
|
client.once('data', function (data) {
|
||||||
console.log('jhreddy -' + data)
|
|
||||||
if (String(data) === 'false' && state === 'none') {
|
if (String(data) === 'false' && state === 'none') {
|
||||||
state = 'first-launch'
|
state = 'first-launch'
|
||||||
} else if (String(data) === 'true' && state === 'first-launch') {
|
} else if (String(data) === 'true' && state === 'first-launch') {
|
||||||
done()
|
done()
|
||||||
} else {
|
} else {
|
||||||
done(`Unexpected state: ${state}`)
|
done(`Unexpected state: ${data}`)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
process.once('loaded', function () {
|
const { ipcRenderer } = require('electron')
|
||||||
window.argv = process.argv
|
if (process) {
|
||||||
})
|
process.once('loaded', function () {
|
||||||
|
ipcRenderer.send('processArgs', process.argv)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
ipcRenderer.send('processArgs', 'unable to get process args')
|
||||||
|
}
|
24
spec/fixtures/api/mixed-sandbox-app/main.js
vendored
24
spec/fixtures/api/mixed-sandbox-app/main.js
vendored
|
@ -1,10 +1,10 @@
|
||||||
const { app, BrowserWindow, dialog } = require('electron')
|
const { app, BrowserWindow, ipcMain } = require('electron')
|
||||||
const net = require('net')
|
const net = require('net')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
const socketPath = process.platform === 'win32' ? '\\\\.\\pipe\\electron-app-mixed-sandbox' : '/tmp/electron-app-mixed-sandbox'
|
const socketPath = process.platform === 'win32' ? '\\\\.\\pipe\\electron-app-mixed-sandbox' : '/tmp/electron-app-mixed-sandbox'
|
||||||
|
|
||||||
process.on('uncaughtException', () => {
|
process.on('uncaughtException', (error) => {
|
||||||
app.exit(1)
|
app.exit(1)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -14,9 +14,11 @@ app.once('ready', () => {
|
||||||
const client = net.connect(socketPath)
|
const client = net.connect(socketPath)
|
||||||
client.once('connect', () => {
|
client.once('connect', () => {
|
||||||
if (lastArg === '--enable-mixed-sandbox') {
|
if (lastArg === '--enable-mixed-sandbox') {
|
||||||
dialog.showErrorBox('connected', app.getAppPath())
|
ipcMain.on('processArgs', (event, args) => {
|
||||||
|
client.end(String(args.indexOf('--no-sandbox') >= 0))
|
||||||
|
})
|
||||||
let window = new BrowserWindow({
|
let window = new BrowserWindow({
|
||||||
show: true,
|
show: false,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload: path.join(app.getAppPath(), 'electron-app-mixed-sandbox-preload.js'),
|
preload: path.join(app.getAppPath(), 'electron-app-mixed-sandbox-preload.js'),
|
||||||
sandbox: false
|
sandbox: false
|
||||||
|
@ -24,20 +26,6 @@ app.once('ready', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
window.loadURL('data:,window')
|
window.loadURL('data:,window')
|
||||||
let argv = 'test'
|
|
||||||
window.webContents.once('did-finish-load', () => {
|
|
||||||
dialog.showErrorBox('finished-load', 'finished')
|
|
||||||
window.webContents.executeJavaScript('window.argv', false, (result) => {
|
|
||||||
dialog.showErrorBox('hello', result)
|
|
||||||
client.end(String(result))
|
|
||||||
})
|
|
||||||
})
|
|
||||||
// window.webContents.openDevTools()
|
|
||||||
// window.webContents.executeJavaScript('window.argv', true).then((result) => {
|
|
||||||
// dialog.showErrorBox('hello', result)
|
|
||||||
// client.end(String(argv))
|
|
||||||
// })
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
client.end(String(false))
|
client.end(String(false))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue