electron/spec/fixtures/api/gpu-info.js

22 lines
557 B
JavaScript
Raw Normal View History

2020-03-20 20:28:31 +00:00
const { app, BrowserWindow } = require('electron');
2020-03-20 20:28:31 +00:00
app.commandLine.appendSwitch('--disable-software-rasterizer');
app.whenReady().then(() => {
2020-03-20 20:28:31 +00:00
const infoType = process.argv.pop();
const w = new BrowserWindow({ show: false });
w.webContents.once('did-finish-load', () => {
app.getGPUInfo(infoType).then(
(gpuInfo) => {
2020-03-20 20:28:31 +00:00
console.log(JSON.stringify(gpuInfo));
app.exit(0);
},
(error) => {
2020-03-20 20:28:31 +00:00
console.error(error);
app.exit(1);
}
2020-03-20 20:28:31 +00:00
);
});
w.loadURL('data:text/html;<canvas></canvas>');
});