test: remove a bunch of usage of the remote module (#21119)

This commit is contained in:
Jeremy Apthorp 2019-11-14 14:09:03 -08:00 committed by GitHub
parent 4f1536479e
commit 26ecf63ab4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 124 additions and 125 deletions

View file

@ -1,11 +0,0 @@
const path = require('path')
const { remote } = require('electron')
const { Buffer } = window
delete window.Buffer
delete global.Buffer
// Test that remote.js doesn't use Buffer global
remote.require(path.join(__dirname, 'print_name.js')).echo(Buffer.from('bar'))
window.test = Buffer.from('buffer')

View file

@ -1,5 +0,0 @@
const { ipcRenderer, remote } = require('electron')
window.onload = function () {
ipcRenderer.send('remote', typeof remote)
}

View file

@ -1,36 +0,0 @@
exports.print = function (obj) {
return obj.constructor.name
}
exports.echo = function (obj) {
return obj
}
const typedArrays = {
Int8Array,
Uint8Array,
Uint8ClampedArray,
Int16Array,
Uint16Array,
Int32Array,
Uint32Array,
Float32Array,
Float64Array
}
exports.typedArray = function (type, values) {
const constructor = typedArrays[type]
const array = new constructor(values.length)
for (let i = 0; i < values.length; ++i) {
array[i] = values[i]
}
return array
}
exports.getNaN = function () {
return NaN
}
exports.getInfinity = function () {
return Infinity
}