|
@@ -11,17 +11,17 @@ const {app, BrowserWindow, ipcMain} = remote
|
|
|
|
|
|
const isCI = remote.getGlobal('isCi')
|
|
|
|
|
|
-describe('electron module', function () {
|
|
|
- it('does not expose internal modules to require', function () {
|
|
|
- assert.throws(function () {
|
|
|
+describe('electron module', () => {
|
|
|
+ it('does not expose internal modules to require', () => {
|
|
|
+ assert.throws(() => {
|
|
|
require('clipboard')
|
|
|
}, /Cannot find module 'clipboard'/)
|
|
|
})
|
|
|
|
|
|
- describe('require("electron")', function () {
|
|
|
+ describe('require("electron")', () => {
|
|
|
let window = null
|
|
|
|
|
|
- beforeEach(function () {
|
|
|
+ beforeEach(() => {
|
|
|
window = new BrowserWindow({
|
|
|
show: false,
|
|
|
width: 400,
|
|
@@ -29,24 +29,22 @@ describe('electron module', function () {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- afterEach(function () {
|
|
|
- return closeWindow(window).then(function () { window = null })
|
|
|
+ afterEach(() => {
|
|
|
+ return closeWindow(window).then(() => { window = null })
|
|
|
})
|
|
|
|
|
|
- it('always returns the internal electron module', function (done) {
|
|
|
- ipcMain.once('answer', function () {
|
|
|
- done()
|
|
|
- })
|
|
|
- window.loadURL('file://' + path.join(__dirname, 'fixtures', 'api', 'electron-module-app', 'index.html'))
|
|
|
+ it('always returns the internal electron module', (done) => {
|
|
|
+ ipcMain.once('answer', () => done())
|
|
|
+ window.loadURL(`file://${path.join(__dirname, 'fixtures', 'api', 'electron-module-app', 'index.html')}`)
|
|
|
})
|
|
|
})
|
|
|
})
|
|
|
|
|
|
-describe('app module', function () {
|
|
|
+describe('app module', () => {
|
|
|
let server, secureUrl
|
|
|
const certPath = path.join(__dirname, 'fixtures', 'certificates')
|
|
|
|
|
|
- before(function () {
|
|
|
+ before(() => {
|
|
|
const options = {
|
|
|
key: fs.readFileSync(path.join(certPath, 'server.key')),
|
|
|
cert: fs.readFileSync(path.join(certPath, 'server.pem')),
|
|
@@ -58,7 +56,7 @@ describe('app module', function () {
|
|
|
rejectUnauthorized: false
|
|
|
}
|
|
|
|
|
|
- server = https.createServer(options, function (req, res) {
|
|
|
+ server = https.createServer(options, (req, res) => {
|
|
|
if (req.client.authorized) {
|
|
|
res.writeHead(200)
|
|
|
res.end('<title>authorized</title>')
|
|
@@ -68,24 +66,24 @@ describe('app module', function () {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- server.listen(0, '127.0.0.1', function () {
|
|
|
+ server.listen(0, '127.0.0.1', () => {
|
|
|
const port = server.address().port
|
|
|
secureUrl = `https://127.0.0.1:${port}`
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- after(function () {
|
|
|
+ after(() => {
|
|
|
server.close()
|
|
|
})
|
|
|
|
|
|
- describe('app.getVersion()', function () {
|
|
|
- it('returns the version field of package.json', function () {
|
|
|
+ describe('app.getVersion()', () => {
|
|
|
+ it('returns the version field of package.json', () => {
|
|
|
assert.equal(app.getVersion(), '0.1.0')
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- describe('app.setVersion(version)', function () {
|
|
|
- it('overrides the version', function () {
|
|
|
+ describe('app.setVersion(version)', () => {
|
|
|
+ it('overrides the version', () => {
|
|
|
assert.equal(app.getVersion(), '0.1.0')
|
|
|
app.setVersion('test-version')
|
|
|
assert.equal(app.getVersion(), 'test-version')
|
|
@@ -93,14 +91,14 @@ describe('app module', function () {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- describe('app.getName()', function () {
|
|
|
- it('returns the name field of package.json', function () {
|
|
|
+ describe('app.getName()', () => {
|
|
|
+ it('returns the name field of package.json', () => {
|
|
|
assert.equal(app.getName(), 'Electron Test')
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- describe('app.setName(name)', function () {
|
|
|
- it('overrides the name', function () {
|
|
|
+ describe('app.setName(name)', () => {
|
|
|
+ it('overrides the name', () => {
|
|
|
assert.equal(app.getName(), 'Electron Test')
|
|
|
app.setName('test-name')
|
|
|
assert.equal(app.getName(), 'test-name')
|
|
@@ -108,36 +106,35 @@ describe('app module', function () {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- describe('app.getLocale()', function () {
|
|
|
- it('should not be empty', function () {
|
|
|
+ describe('app.getLocale()', () => {
|
|
|
+ it('should not be empty', () => {
|
|
|
assert.notEqual(app.getLocale(), '')
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- describe('app.isInApplicationsFolder()', function () {
|
|
|
- it('should be false during tests', function () {
|
|
|
+ describe('app.isInApplicationsFolder()', () => {
|
|
|
+ it('should be false during tests', () => {
|
|
|
if (process.platform !== 'darwin') return
|
|
|
-
|
|
|
assert.equal(app.isInApplicationsFolder(), false)
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- describe('app.exit(exitCode)', function () {
|
|
|
- var appProcess = null
|
|
|
+ describe('app.exit(exitCode)', () => {
|
|
|
+ let appProcess = null
|
|
|
|
|
|
- afterEach(function () {
|
|
|
+ afterEach(() => {
|
|
|
if (appProcess != null) appProcess.kill()
|
|
|
})
|
|
|
|
|
|
- it('emits a process exit event with the code', function (done) {
|
|
|
- var appPath = path.join(__dirname, 'fixtures', 'api', 'quit-app')
|
|
|
- var electronPath = remote.getGlobal('process').execPath
|
|
|
- var output = ''
|
|
|
+ it('emits a process exit event with the code', (done) => {
|
|
|
+ const appPath = path.join(__dirname, 'fixtures', 'api', 'quit-app')
|
|
|
+ const electronPath = remote.getGlobal('process').execPath
|
|
|
+ let output = ''
|
|
|
appProcess = ChildProcess.spawn(electronPath, [appPath])
|
|
|
- appProcess.stdout.on('data', function (data) {
|
|
|
+ appProcess.stdout.on('data', (data) => {
|
|
|
output += data
|
|
|
})
|
|
|
- appProcess.on('close', function (code) {
|
|
|
+ appProcess.on('close', (code) => {
|
|
|
if (process.platform !== 'win32') {
|
|
|
assert.notEqual(output.indexOf('Exit event with code: 123'), -1)
|
|
|
}
|
|
@@ -146,7 +143,7 @@ describe('app module', function () {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- it('closes all windows', function (done) {
|
|
|
+ it('closes all windows', (done) => {
|
|
|
var appPath = path.join(__dirname, 'fixtures', 'api', 'exit-closes-all-windows-app')
|
|
|
var electronPath = remote.getGlobal('process').execPath
|
|
|
appProcess = ChildProcess.spawn(electronPath, [appPath])
|
|
@@ -157,7 +154,7 @@ describe('app module', function () {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- describe('app.makeSingleInstance', function () {
|
|
|
+ describe('app.makeSingleInstance', () => {
|
|
|
it('prevents the second launch of app', function (done) {
|
|
|
this.timeout(120000)
|
|
|
const appPath = path.join(__dirname, 'fixtures', 'api', 'singleton')
|
|
@@ -178,11 +175,11 @@ describe('app module', function () {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- describe('app.relaunch', function () {
|
|
|
+ describe('app.relaunch', () => {
|
|
|
let server = null
|
|
|
const socketPath = process.platform === 'win32' ? '\\\\.\\pipe\\electron-app-relaunch' : '/tmp/electron-app-relaunch'
|
|
|
|
|
|
- beforeEach(function (done) {
|
|
|
+ beforeEach((done) => {
|
|
|
fs.unlink(socketPath, () => {
|
|
|
server = net.createServer()
|
|
|
server.listen(socketPath)
|
|
@@ -190,14 +187,12 @@ describe('app module', function () {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- afterEach(function (done) {
|
|
|
+ afterEach((done) => {
|
|
|
server.close(() => {
|
|
|
if (process.platform === 'win32') {
|
|
|
done()
|
|
|
} else {
|
|
|
- fs.unlink(socketPath, () => {
|
|
|
- done()
|
|
|
- })
|
|
|
+ fs.unlink(socketPath, () => done())
|
|
|
}
|
|
|
})
|
|
|
})
|
|
@@ -206,11 +201,9 @@ describe('app module', function () {
|
|
|
this.timeout(120000)
|
|
|
|
|
|
let state = 'none'
|
|
|
- server.once('error', (error) => {
|
|
|
- done(error)
|
|
|
- })
|
|
|
+ server.once('error', (error) => done(error))
|
|
|
server.on('connection', (client) => {
|
|
|
- client.once('data', function (data) {
|
|
|
+ client.once('data', (data) => {
|
|
|
if (String(data) === 'false' && state === 'none') {
|
|
|
state = 'first-launch'
|
|
|
} else if (String(data) === 'true' && state === 'first-launch') {
|
|
@@ -226,42 +219,36 @@ describe('app module', function () {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- describe('app.setUserActivity(type, userInfo)', function () {
|
|
|
- if (process.platform !== 'darwin') {
|
|
|
- return
|
|
|
- }
|
|
|
+ describe('app.setUserActivity(type, userInfo)', () => {
|
|
|
+ if (process.platform !== 'darwin') return
|
|
|
|
|
|
- it('sets the current activity', function () {
|
|
|
+ it('sets the current activity', () => {
|
|
|
app.setUserActivity('com.electron.testActivity', {testData: '123'})
|
|
|
assert.equal(app.getCurrentActivityType(), 'com.electron.testActivity')
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- xdescribe('app.importCertificate', function () {
|
|
|
+ xdescribe('app.importCertificate', () => {
|
|
|
if (process.platform !== 'linux') return
|
|
|
|
|
|
var w = null
|
|
|
|
|
|
- afterEach(function () {
|
|
|
- return closeWindow(w).then(function () { w = null })
|
|
|
- })
|
|
|
+ afterEach(() => closeWindow(w).then(() => { w = null }))
|
|
|
|
|
|
- it('can import certificate into platform cert store', function (done) {
|
|
|
+ it('can import certificate into platform cert store', (done) => {
|
|
|
let options = {
|
|
|
certificate: path.join(certPath, 'client.p12'),
|
|
|
password: 'electron'
|
|
|
}
|
|
|
|
|
|
- w = new BrowserWindow({
|
|
|
- show: false
|
|
|
- })
|
|
|
+ w = new BrowserWindow({ show: false })
|
|
|
|
|
|
- w.webContents.on('did-finish-load', function () {
|
|
|
+ w.webContents.on('did-finish-load', () => {
|
|
|
assert.equal(w.webContents.getTitle(), 'authorized')
|
|
|
done()
|
|
|
})
|
|
|
|
|
|
- ipcRenderer.once('select-client-certificate', function (event, webContentsId, list) {
|
|
|
+ ipcRenderer.once('select-client-certificate', (event, webContentsId, list) => {
|
|
|
assert.equal(webContentsId, w.webContents.id)
|
|
|
assert.equal(list.length, 1)
|
|
|
assert.equal(list[0].issuerName, 'Intermediate CA')
|
|
@@ -271,7 +258,7 @@ describe('app module', function () {
|
|
|
event.sender.send('client-certificate-response', list[0])
|
|
|
})
|
|
|
|
|
|
- app.importCertificate(options, function (result) {
|
|
|
+ app.importCertificate(options, (result) => {
|
|
|
assert(!result)
|
|
|
ipcRenderer.sendSync('set-client-certificate-option', false)
|
|
|
w.loadURL(secureUrl)
|
|
@@ -279,79 +266,69 @@ describe('app module', function () {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- describe('BrowserWindow events', function () {
|
|
|
- var w = null
|
|
|
+ describe('BrowserWindow events', () => {
|
|
|
+ let w = null
|
|
|
|
|
|
- afterEach(function () {
|
|
|
- return closeWindow(w).then(function () { w = null })
|
|
|
- })
|
|
|
+ afterEach(() => closeWindow(w).then(() => { w = null }))
|
|
|
|
|
|
- it('should emit browser-window-focus event when window is focused', function (done) {
|
|
|
- app.once('browser-window-focus', function (e, window) {
|
|
|
+ it('should emit browser-window-focus event when window is focused', (done) => {
|
|
|
+ app.once('browser-window-focus', (e, window) => {
|
|
|
assert.equal(w.id, window.id)
|
|
|
done()
|
|
|
})
|
|
|
- w = new BrowserWindow({
|
|
|
- show: false
|
|
|
- })
|
|
|
+ w = new BrowserWindow({ show: false })
|
|
|
w.emit('focus')
|
|
|
})
|
|
|
|
|
|
- it('should emit browser-window-blur event when window is blured', function (done) {
|
|
|
- app.once('browser-window-blur', function (e, window) {
|
|
|
+ it('should emit browser-window-blur event when window is blured', (done) => {
|
|
|
+ app.once('browser-window-blur', (e, window) => {
|
|
|
assert.equal(w.id, window.id)
|
|
|
done()
|
|
|
})
|
|
|
- w = new BrowserWindow({
|
|
|
- show: false
|
|
|
- })
|
|
|
+ w = new BrowserWindow({ show: false })
|
|
|
w.emit('blur')
|
|
|
})
|
|
|
|
|
|
- it('should emit browser-window-created event when window is created', function (done) {
|
|
|
- app.once('browser-window-created', function (e, window) {
|
|
|
- setImmediate(function () {
|
|
|
+ it('should emit browser-window-created event when window is created', (done) => {
|
|
|
+ app.once('browser-window-created', (e, window) => {
|
|
|
+ setImmediate(() => {
|
|
|
assert.equal(w.id, window.id)
|
|
|
done()
|
|
|
})
|
|
|
})
|
|
|
- w = new BrowserWindow({
|
|
|
- show: false
|
|
|
- })
|
|
|
+ w = new BrowserWindow({ show: false })
|
|
|
})
|
|
|
|
|
|
- it('should emit web-contents-created event when a webContents is created', function (done) {
|
|
|
- app.once('web-contents-created', function (e, webContents) {
|
|
|
- setImmediate(function () {
|
|
|
+ it('should emit web-contents-created event when a webContents is created', (done) => {
|
|
|
+ app.once('web-contents-created', (e, webContents) => {
|
|
|
+ setImmediate(() => {
|
|
|
assert.equal(w.webContents.id, webContents.id)
|
|
|
done()
|
|
|
})
|
|
|
})
|
|
|
- w = new BrowserWindow({
|
|
|
- show: false
|
|
|
- })
|
|
|
+ w = new BrowserWindow({ show: false })
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- describe('app.setBadgeCount API', function () {
|
|
|
+ describe('app.setBadgeCount API', () => {
|
|
|
const shouldFail = process.platform === 'win32' ||
|
|
|
(process.platform === 'linux' && !app.isUnityRunning())
|
|
|
|
|
|
- afterEach(function () {
|
|
|
+ afterEach(() => {
|
|
|
app.setBadgeCount(0)
|
|
|
})
|
|
|
|
|
|
- it('returns false when failed', function () {
|
|
|
+ it('returns false when failed', () => {
|
|
|
assert.equal(app.setBadgeCount(42), !shouldFail)
|
|
|
})
|
|
|
|
|
|
- it('should set a badge count', function () {
|
|
|
+ it('should set a badge count', () => {
|
|
|
app.setBadgeCount(42)
|
|
|
assert.equal(app.getBadgeCount(), shouldFail ? 0 : 42)
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- describe('app.get/setLoginItemSettings API', function () {
|
|
|
+ describe('app.get/setLoginItemSettings API', () => {
|
|
|
if (process.platform === 'linux') return
|
|
|
|
|
|
const updateExe = path.resolve(path.dirname(process.execPath), '..', 'Update.exe')
|
|
@@ -360,17 +337,17 @@ describe('app module', function () {
|
|
|
'--process-start-args', `"--hidden"`
|
|
|
]
|
|
|
|
|
|
- beforeEach(function () {
|
|
|
+ beforeEach(() => {
|
|
|
app.setLoginItemSettings({openAtLogin: false})
|
|
|
app.setLoginItemSettings({openAtLogin: false, path: updateExe, args: processStartArgs})
|
|
|
})
|
|
|
|
|
|
- afterEach(function () {
|
|
|
+ afterEach(() => {
|
|
|
app.setLoginItemSettings({openAtLogin: false})
|
|
|
app.setLoginItemSettings({openAtLogin: false, path: updateExe, args: processStartArgs})
|
|
|
})
|
|
|
|
|
|
- it('returns the login item status of the app', function () {
|
|
|
+ it('returns the login item status of the app', () => {
|
|
|
app.setLoginItemSettings({openAtLogin: true})
|
|
|
assert.deepEqual(app.getLoginItemSettings(), {
|
|
|
openAtLogin: true,
|
|
@@ -409,35 +386,35 @@ describe('app module', function () {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- describe('isAccessibilitySupportEnabled API', function () {
|
|
|
- it('returns whether the Chrome has accessibility APIs enabled', function () {
|
|
|
+ describe('isAccessibilitySupportEnabled API', () => {
|
|
|
+ it('returns whether the Chrome has accessibility APIs enabled', () => {
|
|
|
assert.equal(typeof app.isAccessibilitySupportEnabled(), 'boolean')
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- describe('getPath(name)', function () {
|
|
|
- it('returns paths that exist', function () {
|
|
|
+ describe('getPath(name)', () => {
|
|
|
+ it('returns paths that exist', () => {
|
|
|
assert.equal(fs.existsSync(app.getPath('exe')), true)
|
|
|
assert.equal(fs.existsSync(app.getPath('home')), true)
|
|
|
assert.equal(fs.existsSync(app.getPath('temp')), true)
|
|
|
})
|
|
|
|
|
|
- it('throws an error when the name is invalid', function () {
|
|
|
- assert.throws(function () {
|
|
|
+ it('throws an error when the name is invalid', () => {
|
|
|
+ assert.throws(() => {
|
|
|
app.getPath('does-not-exist')
|
|
|
}, /Failed to get 'does-not-exist' path/)
|
|
|
})
|
|
|
|
|
|
- it('returns the overridden path', function () {
|
|
|
+ it('returns the overridden path', () => {
|
|
|
app.setPath('music', __dirname)
|
|
|
assert.equal(app.getPath('music'), __dirname)
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- xdescribe('select-client-certificate event', function () {
|
|
|
+ xdescribe('select-client-certificate event', () => {
|
|
|
let w = null
|
|
|
|
|
|
- beforeEach(function () {
|
|
|
+ beforeEach(() => {
|
|
|
w = new BrowserWindow({
|
|
|
show: false,
|
|
|
webPreferences: {
|
|
@@ -446,12 +423,10 @@ describe('app module', function () {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- afterEach(function () {
|
|
|
- return closeWindow(w).then(function () { w = null })
|
|
|
- })
|
|
|
+ afterEach(() => closeWindow(w).then(() => { w = null }))
|
|
|
|
|
|
- it('can respond with empty certificate list', function (done) {
|
|
|
- w.webContents.on('did-finish-load', function () {
|
|
|
+ it('can respond with empty certificate list', (done) => {
|
|
|
+ w.webContents.on('did-finish-load', () => {
|
|
|
assert.equal(w.webContents.getTitle(), 'denied')
|
|
|
server.close()
|
|
|
done()
|
|
@@ -498,7 +473,7 @@ describe('app module', function () {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- describe('getFileIcon() API', function () {
|
|
|
+ describe('getFileIcon() API', () => {
|
|
|
// FIXME Get these specs running on Linux CI
|
|
|
if (process.platform === 'linux' && isCI) return
|
|
|
|
|
@@ -509,16 +484,16 @@ describe('app module', function () {
|
|
|
large: process.platform === 'win32' ? 32 : 48
|
|
|
}
|
|
|
|
|
|
- it('fetches a non-empty icon', function (done) {
|
|
|
- app.getFileIcon(iconPath, function (err, icon) {
|
|
|
+ it('fetches a non-empty icon', (done) => {
|
|
|
+ app.getFileIcon(iconPath, (err, icon) => {
|
|
|
assert.equal(err, null)
|
|
|
assert.equal(icon.isEmpty(), false)
|
|
|
done()
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- it('fetches normal icon size by default', function (done) {
|
|
|
- app.getFileIcon(iconPath, function (err, icon) {
|
|
|
+ it('fetches normal icon size by default', (done) => {
|
|
|
+ app.getFileIcon(iconPath, (err, icon) => {
|
|
|
const size = icon.getSize()
|
|
|
assert.equal(err, null)
|
|
|
assert.equal(size.height, sizes.normal)
|
|
@@ -527,9 +502,9 @@ describe('app module', function () {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- describe('size option', function () {
|
|
|
- it('fetches a small icon', function (done) {
|
|
|
- app.getFileIcon(iconPath, { size: 'small' }, function (err, icon) {
|
|
|
+ describe('size option', () => {
|
|
|
+ it('fetches a small icon', (done) => {
|
|
|
+ app.getFileIcon(iconPath, { size: 'small' }, (err, icon) => {
|
|
|
const size = icon.getSize()
|
|
|
assert.equal(err, null)
|
|
|
assert.equal(size.height, sizes.small)
|
|
@@ -538,7 +513,7 @@ describe('app module', function () {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- it('fetches a normal icon', function (done) {
|
|
|
+ it('fetches a normal icon', (done) => {
|
|
|
app.getFileIcon(iconPath, { size: 'normal' }, function (err, icon) {
|
|
|
const size = icon.getSize()
|
|
|
assert.equal(err, null)
|
|
@@ -548,7 +523,7 @@ describe('app module', function () {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- it('fetches a large icon', function (done) {
|
|
|
+ it('fetches a large icon', (done) => {
|
|
|
// macOS does not support large icons
|
|
|
if (process.platform === 'darwin') return done()
|
|
|
|
|
@@ -563,8 +538,8 @@ describe('app module', function () {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- describe('getAppMetrics() API', function () {
|
|
|
- it('returns memory and cpu stats of all running electron processes', function () {
|
|
|
+ describe('getAppMetrics() API', () => {
|
|
|
+ it('returns memory and cpu stats of all running electron processes', () => {
|
|
|
const appMetrics = app.getAppMetrics()
|
|
|
assert.ok(appMetrics.length > 0, 'App memory info object is not > 0')
|
|
|
const types = []
|
|
@@ -588,15 +563,15 @@ describe('app module', function () {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- describe('getGPUFeatureStatus() API', function () {
|
|
|
- it('returns the graphic features statuses', function () {
|
|
|
+ describe('getGPUFeatureStatus() API', () => {
|
|
|
+ it('returns the graphic features statuses', () => {
|
|
|
const features = app.getGPUFeatureStatus()
|
|
|
assert.equal(typeof features.webgl, 'string')
|
|
|
assert.equal(typeof features.gpu_compositing, 'string')
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- describe('mixed sandbox option', function () {
|
|
|
+ describe('mixed sandbox option', () => {
|
|
|
// FIXME Get these specs running on Linux
|
|
|
if (process.platform === 'linux') return
|
|
|
|
|
@@ -604,7 +579,7 @@ describe('app module', function () {
|
|
|
let server = null
|
|
|
const socketPath = process.platform === 'win32' ? '\\\\.\\pipe\\electron-mixed-sandbox' : '/tmp/electron-mixed-sandbox'
|
|
|
|
|
|
- beforeEach(function (done) {
|
|
|
+ beforeEach((done) => {
|
|
|
fs.unlink(socketPath, () => {
|
|
|
server = net.createServer()
|
|
|
server.listen(socketPath)
|
|
@@ -612,18 +587,14 @@ describe('app module', function () {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- afterEach(function (done) {
|
|
|
- if (appProcess != null) {
|
|
|
- appProcess.kill()
|
|
|
- }
|
|
|
+ afterEach((done) => {
|
|
|
+ if (appProcess != null) appProcess.kill()
|
|
|
|
|
|
server.close(() => {
|
|
|
if (process.platform === 'win32') {
|
|
|
done()
|
|
|
} else {
|
|
|
- fs.unlink(socketPath, () => {
|
|
|
- done()
|
|
|
- })
|
|
|
+ fs.unlink(socketPath, () => done())
|
|
|
}
|
|
|
})
|
|
|
})
|
|
@@ -680,9 +651,9 @@ describe('app module', function () {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- describe('disableDomainBlockingFor3DAPIs() API', function () {
|
|
|
- it('throws when called after app is ready', function () {
|
|
|
- assert.throws(function () {
|
|
|
+ describe('disableDomainBlockingFor3DAPIs() API', () => {
|
|
|
+ it('throws when called after app is ready', () => {
|
|
|
+ assert.throws(() => {
|
|
|
app.disableDomainBlockingFor3DAPIs()
|
|
|
}, /before app is ready/)
|
|
|
})
|