standardize more

This commit is contained in:
Zeke Sikelianos 2016-03-28 16:19:18 -07:00 committed by Kevin Sawicki
parent 9db733a4ff
commit 5e4696f4a7
6 changed files with 23 additions and 19 deletions

View file

@ -30,7 +30,7 @@ describe('debugger module', function () {
w.webContents.openDevTools() w.webContents.openDevTools()
try { try {
w.webContents.debugger.attach() w.webContents.debugger.attach()
} catch(err) { } catch (err) {
assert(w.webContents.debugger.isAttached()) assert(w.webContents.debugger.isAttached())
done() done()
} }
@ -41,7 +41,7 @@ describe('debugger module', function () {
it('fails when protocol version is not supported', function (done) { it('fails when protocol version is not supported', function (done) {
try { try {
w.webContents.debugger.attach('2.0') w.webContents.debugger.attach('2.0')
} catch(err) { } catch (err) {
assert(!w.webContents.debugger.isAttached()) assert(!w.webContents.debugger.isAttached())
done() done()
} }
@ -50,7 +50,7 @@ describe('debugger module', function () {
it('attaches when no protocol version is specified', function (done) { it('attaches when no protocol version is specified', function (done) {
try { try {
w.webContents.debugger.attach() w.webContents.debugger.attach()
} catch(err) { } catch (err) {
done('unexpected error : ' + err) done('unexpected error : ' + err)
} }
assert(w.webContents.debugger.isAttached()) assert(w.webContents.debugger.isAttached())
@ -67,7 +67,7 @@ describe('debugger module', function () {
}) })
try { try {
w.webContents.debugger.attach() w.webContents.debugger.attach()
} catch(err) { } catch (err) {
done('unexpected error : ' + err) done('unexpected error : ' + err)
} }
w.webContents.debugger.detach() w.webContents.debugger.detach()
@ -79,7 +79,7 @@ describe('debugger module', function () {
w.webContents.loadURL('about:blank') w.webContents.loadURL('about:blank')
try { try {
w.webContents.debugger.attach() w.webContents.debugger.attach()
} catch(err) { } catch (err) {
done('unexpected error : ' + err) done('unexpected error : ' + err)
} }
var callback = function (err, res) { var callback = function (err, res) {
@ -101,7 +101,7 @@ describe('debugger module', function () {
w.webContents.loadURL(url) w.webContents.loadURL(url)
try { try {
w.webContents.debugger.attach() w.webContents.debugger.attach()
} catch(err) { } catch (err) {
done('unexpected error : ' + err) done('unexpected error : ' + err)
} }
w.webContents.debugger.on('message', function (e, method, params) { w.webContents.debugger.on('message', function (e, method, params) {
@ -120,7 +120,7 @@ describe('debugger module', function () {
w.webContents.loadURL('about:blank') w.webContents.loadURL('about:blank')
try { try {
w.webContents.debugger.attach() w.webContents.debugger.attach()
} catch(err) { } catch (err) {
done('unexpected error : ' + err) done('unexpected error : ' + err)
} }
w.webContents.debugger.sendCommand('Test', function (err) { w.webContents.debugger.sendCommand('Test', function (err) {

View file

@ -45,7 +45,7 @@ describe('nativeImage module', () => {
assert.equal(nsimage.length, 8) assert.equal(nsimage.length, 8)
// If all bytes are null, that's Bad // If all bytes are null, that's Bad
assert.equal(nsimage.reduce((acc, x) => acc || (x != 0), false), true) assert.equal(nsimage.reduce((acc, x) => acc || (x !== 0), false), true)
}) })
}) })
}) })

View file

@ -183,7 +183,7 @@ describe('protocol module', function () {
it('fails when sending object other than string', function (done) { it('fails when sending object other than string', function (done) {
var handler = function (request, callback) { var handler = function (request, callback) {
callback(new Date) callback(new Date())
} }
protocol.registerBufferProtocol(protocolName, handler, function (error) { protocol.registerBufferProtocol(protocolName, handler, function (error) {
if (error) { if (error) {
@ -413,7 +413,7 @@ describe('protocol module', function () {
it('fails when sending unsupported content', function (done) { it('fails when sending unsupported content', function (done) {
var handler = function (request, callback) { var handler = function (request, callback) {
callback(new Date) callback(new Date())
} }
protocol.registerBufferProtocol(protocolName, handler, function (error) { protocol.registerBufferProtocol(protocolName, handler, function (error) {
if (error) { if (error) {
@ -491,7 +491,7 @@ describe('protocol module', function () {
it('fails when sending unsupported content', function (done) { it('fails when sending unsupported content', function (done) {
var handler = function (request, callback) { var handler = function (request, callback) {
callback(new Date) callback(new Date())
} }
protocol.registerHttpProtocol(protocolName, handler, function (error) { protocol.registerHttpProtocol(protocolName, handler, function (error) {
if (error) { if (error) {

View file

@ -1,3 +1,5 @@
/* globals WebView */
const assert = require('assert') const assert = require('assert')
const http = require('http') const http = require('http')
const path = require('path') const path = require('path')
@ -231,7 +233,7 @@ describe('session module', function () {
downloadServer.listen(0, '127.0.0.1', function () { downloadServer.listen(0, '127.0.0.1', function () {
var port = downloadServer.address().port var port = downloadServer.address().port
ipcRenderer.sendSync('set-download-option', false, false) ipcRenderer.sendSync('set-download-option', false, false)
var webview = new WebView var webview = new WebView()
webview.src = 'file://' + fixtures + '/api/blank.html' webview.src = 'file://' + fixtures + '/api/blank.html'
webview.addEventListener('did-finish-load', function () { webview.addEventListener('did-finish-load', function () {
webview.downloadURL(url + ':' + port + '/') webview.downloadURL(url + ':' + port + '/')

View file

@ -18,7 +18,7 @@ describe('asar package', function () {
describe('fs.readFileSync', function () { describe('fs.readFileSync', function () {
it('does not leak fd', function () { it('does not leak fd', function () {
var readCalls = 1 var readCalls = 1
while(readCalls <= 10000) { while (readCalls <= 10000) {
fs.readFileSync(path.join(process.resourcesPath, 'atom.asar', 'renderer', 'api', 'ipc.js')) fs.readFileSync(path.join(process.resourcesPath, 'atom.asar', 'renderer', 'api', 'ipc.js'))
readCalls++ readCalls++
} }
@ -530,9 +530,9 @@ describe('asar package', function () {
describe('fs.mkdirSync', function () { describe('fs.mkdirSync', function () {
it('throws error when calling inside asar archive', function () { it('throws error when calling inside asar archive', function () {
var p = path.join(fixtures, 'asar', 'a.asar', 'not-exist') var p = path.join(fixtures, 'asar', 'a.asar', 'not-exist')
assert.throws((function () { assert.throws(function () {
fs.mkdirSync(p) fs.mkdirSync(p)
}), new RegExp('ENOTDIR')) }, new RegExp('ENOTDIR'))
}) })
}) })

View file

@ -103,10 +103,11 @@ describe('chromium feature', function () {
navigator.mediaDevices.enumerateDevices().then((devices) => { navigator.mediaDevices.enumerateDevices().then((devices) => {
const labels = devices.map((device) => device.label) const labels = devices.map((device) => device.label)
const labelFound = labels.some((label) => !!label) const labelFound = labels.some((label) => !!label)
if (labelFound) if (labelFound) {
done() done()
else } else {
done('No device labels found: ' + JSON.stringify(labels)) done('No device labels found: ' + JSON.stringify(labels))
}
}).catch(done) }).catch(done)
}) })
}) })
@ -171,8 +172,9 @@ describe('chromium feature', function () {
it('inherit options of parent window', function (done) { it('inherit options of parent window', function (done) {
var b var b
listener = function (event) { listener = function (event) {
var height, ref1, width var ref1 = remote.getCurrentWindow().getSize()
ref1 = remote.getCurrentWindow().getSize(), width = ref1[0], height = ref1[1] var width = ref1[0]
var height = ref1[1]
assert.equal(event.data, 'size: ' + width + ' ' + height) assert.equal(event.data, 'size: ' + width + ' ' + height)
b.close() b.close()
done() done()