type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
---|---|---|---|---|
ArrowFunction |
async () => {
w = new BrowserWindow({
show: false,
webPreferences: {
nodeIntegration: true,
contextIsolation: false
}
});
await w.loadURL('about:blank');
const emitted = emittedOnce(app, 'render-process-gone');
w.webContents.executeJavaScript('process.crash()');
const [, webContents, details] = await emitted;
expect(webContents).to.equal(w.webContents);
expect(details.reason).to.be.oneOf(['crashed', 'abnormal-exit']);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('should emit desktop-capturer-get-sources event when desktopCapturer.getSources() is invoked', async () => {
w = new BrowserWindow({
show: false,
webPreferences: {
nodeIntegration: true,
contextIsolation: false
}
});
await w.loadURL('about:blank');
const promise = emittedOnce(app, 'desktop-capturer-get-sources');
w.webContents.executeJavaScript('require(\'electron\').desktopCapturer.getSources({ types: [\'screen\'] })');
const [, webContents] = await promise;
expect(webContents).to.equal(w.webContents);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
w = new BrowserWindow({
show: false,
webPreferences: {
nodeIntegration: true,
contextIsolation: false
}
});
await w.loadURL('about:blank');
const promise = emittedOnce(app, 'desktop-capturer-get-sources');
w.webContents.executeJavaScript('require(\'electron\').desktopCapturer.getSources({ types: [\'screen\'] })');
const [, webContents] = await promise;
expect(webContents).to.equal(w.webContents);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('should emit remote-require event when remote.require() is invoked', async () => {
w = new BrowserWindow({
show: false,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
contextIsolation: false
}
});
await w.loadURL('about:blank');
const promise = emittedOnce(app, 'remote-require');
w.webContents.executeJavaScript('require(\'electron\').remote.require(\'test\')');
const [, webContents, moduleName] = await promise;
expect(webContents).to.equal(w.webContents);
expect(moduleName).to.equal('test');
});
it('should emit remote-get-global event when remote.getGlobal() is invoked', async () => {
w = new BrowserWindow({
show: false,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
contextIsolation: false
}
});
await w.loadURL('about:blank');
const promise = emittedOnce(app, 'remote-get-global');
w.webContents.executeJavaScript('require(\'electron\').remote.getGlobal(\'test\')');
const [, webContents, globalName] = await promise;
expect(webContents).to.equal(w.webContents);
expect(globalName).to.equal('test');
});
it('should emit remote-get-builtin event when remote.getBuiltin() is invoked', async () => {
w = new BrowserWindow({
show: false,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
contextIsolation: false
}
});
await w.loadURL('about:blank');
const promise = emittedOnce(app, 'remote-get-builtin');
w.webContents.executeJavaScript('require(\'electron\').remote.app');
const [, webContents, moduleName] = await promise;
expect(webContents).to.equal(w.webContents);
expect(moduleName).to.equal('app');
});
it('should emit remote-get-current-window event when remote.getCurrentWindow() is invoked', async () => {
w = new BrowserWindow({
show: false,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
contextIsolation: false
}
});
await w.loadURL('about:blank');
const promise = emittedOnce(app, 'remote-get-current-window');
w.webContents.executeJavaScript('{ require(\'electron\').remote.getCurrentWindow() }');
const [, webContents] = await promise;
expect(webContents).to.equal(w.webContents);
});
it('should emit remote-get-current-web-contents event when remote.getCurrentWebContents() is invoked', async () => {
w = new BrowserWindow({
show: false,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
contextIsolation: false
}
});
await w.loadURL('about:blank');
const promise = emittedOnce(app, 'remote-get-current-web-contents');
w.webContents.executeJavaScript('{ require(\'electron\').remote.getCurrentWebContents() }');
const [, webContents] = await promise;
expect(webContents).to.equal(w.webContents);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
w = new BrowserWindow({
show: false,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
contextIsolation: false
}
});
await w.loadURL('about:blank');
const promise = emittedOnce(app, 'remote-require');
w.webContents.executeJavaScript('require(\'electron\').remote.require(\'test\')');
const [, webContents, moduleName] = await promise;
expect(webContents).to.equal(w.webContents);
expect(moduleName).to.equal('test');
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
w = new BrowserWindow({
show: false,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
contextIsolation: false
}
});
await w.loadURL('about:blank');
const promise = emittedOnce(app, 'remote-get-global');
w.webContents.executeJavaScript('require(\'electron\').remote.getGlobal(\'test\')');
const [, webContents, globalName] = await promise;
expect(webContents).to.equal(w.webContents);
expect(globalName).to.equal('test');
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
w = new BrowserWindow({
show: false,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
contextIsolation: false
}
});
await w.loadURL('about:blank');
const promise = emittedOnce(app, 'remote-get-builtin');
w.webContents.executeJavaScript('require(\'electron\').remote.app');
const [, webContents, moduleName] = await promise;
expect(webContents).to.equal(w.webContents);
expect(moduleName).to.equal('app');
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
w = new BrowserWindow({
show: false,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
contextIsolation: false
}
});
await w.loadURL('about:blank');
const promise = emittedOnce(app, 'remote-get-current-window');
w.webContents.executeJavaScript('{ require(\'electron\').remote.getCurrentWindow() }');
const [, webContents] = await promise;
expect(webContents).to.equal(w.webContents);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
w = new BrowserWindow({
show: false,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
contextIsolation: false
}
});
await w.loadURL('about:blank');
const promise = emittedOnce(app, 'remote-get-current-web-contents');
w.webContents.executeJavaScript('{ require(\'electron\').remote.getCurrentWebContents() }');
const [, webContents] = await promise;
expect(webContents).to.equal(w.webContents);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
const platformIsNotSupported =
(process.platform === 'win32') ||
(process.platform === 'linux' && !app.isUnityRunning());
const expectedBadgeCount = 42;
after(() => { app.badgeCount = 0; });
ifdescribe(!platformIsNotSupported)('on supported platform', () => {
describe('with properties', () => {
it('sets a badge count', function () {
app.badgeCount = expectedBadgeCount;
expect(app.badgeCount).to.equal(expectedBadgeCount);
});
});
describe('with functions', () => {
it('sets a numerical badge count', function () {
app.setBadgeCount(expectedBadgeCount);
expect(app.getBadgeCount()).to.equal(expectedBadgeCount);
});
it('sets an non numeric (dot) badge count', function () {
app.setBadgeCount();
// Badge count should be zero when non numeric (dot) is requested
expect(app.getBadgeCount()).to.equal(0);
});
});
});
ifdescribe(process.platform !== 'win32' && platformIsNotSupported)('on unsupported platform', () => {
describe('with properties', () => {
it('does not set a badge count', function () {
app.badgeCount = 9999;
expect(app.badgeCount).to.equal(0);
});
});
describe('with functions', () => {
it('does not set a badge count)', function () {
app.setBadgeCount(9999);
expect(app.getBadgeCount()).to.equal(0);
});
});
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => { app.badgeCount = 0; } | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
describe('with properties', () => {
it('sets a badge count', function () {
app.badgeCount = expectedBadgeCount;
expect(app.badgeCount).to.equal(expectedBadgeCount);
});
});
describe('with functions', () => {
it('sets a numerical badge count', function () {
app.setBadgeCount(expectedBadgeCount);
expect(app.getBadgeCount()).to.equal(expectedBadgeCount);
});
it('sets an non numeric (dot) badge count', function () {
app.setBadgeCount();
// Badge count should be zero when non numeric (dot) is requested
expect(app.getBadgeCount()).to.equal(0);
});
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('sets a badge count', function () {
app.badgeCount = expectedBadgeCount;
expect(app.badgeCount).to.equal(expectedBadgeCount);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('sets a numerical badge count', function () {
app.setBadgeCount(expectedBadgeCount);
expect(app.getBadgeCount()).to.equal(expectedBadgeCount);
});
it('sets an non numeric (dot) badge count', function () {
app.setBadgeCount();
// Badge count should be zero when non numeric (dot) is requested
expect(app.getBadgeCount()).to.equal(0);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
describe('with properties', () => {
it('does not set a badge count', function () {
app.badgeCount = 9999;
expect(app.badgeCount).to.equal(0);
});
});
describe('with functions', () => {
it('does not set a badge count)', function () {
app.setBadgeCount(9999);
expect(app.getBadgeCount()).to.equal(0);
});
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('does not set a badge count', function () {
app.badgeCount = 9999;
expect(app.badgeCount).to.equal(0);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('does not set a badge count)', function () {
app.setBadgeCount(9999);
expect(app.getBadgeCount()).to.equal(0);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
app.setLoginItemSettings({ openAtLogin: false });
app.setLoginItemSettings({ openAtLogin: false, path: updateExe, args: processStartArgs });
app.setLoginItemSettings({ name: 'additionalEntry', openAtLogin: false });
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('with properties', () => {
it('can set accessibility support enabled', () => {
expect(app.accessibilitySupportEnabled).to.eql(false);
app.accessibilitySupportEnabled = true;
expect(app.accessibilitySupportEnabled).to.eql(true);
});
});
it('with functions', () => {
it('can set accessibility support enabled', () => {
expect(app.isAccessibilitySupportEnabled()).to.eql(false);
app.setAccessibilitySupportEnabled(true);
expect(app.isAccessibilitySupportEnabled()).to.eql(true);
});
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('can set accessibility support enabled', () => {
expect(app.accessibilitySupportEnabled).to.eql(false);
app.accessibilitySupportEnabled = true;
expect(app.accessibilitySupportEnabled).to.eql(true);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
expect(app.accessibilitySupportEnabled).to.eql(false);
app.accessibilitySupportEnabled = true;
expect(app.accessibilitySupportEnabled).to.eql(true);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('can set accessibility support enabled', () => {
expect(app.isAccessibilitySupportEnabled()).to.eql(false);
app.setAccessibilitySupportEnabled(true);
expect(app.isAccessibilitySupportEnabled()).to.eql(true);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
expect(app.isAccessibilitySupportEnabled()).to.eql(false);
app.setAccessibilitySupportEnabled(true);
expect(app.isAccessibilitySupportEnabled()).to.eql(true);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('works for directories with package.json', async () => {
const { appPath } = await runTestApp('app-path');
expect(appPath).to.equal(path.resolve(fixturesPath, 'api/app-path'));
});
it('works for directories with index.js', async () => {
const { appPath } = await runTestApp('app-path/lib');
expect(appPath).to.equal(path.resolve(fixturesPath, 'api/app-path/lib'));
});
it('works for files without extension', async () => {
const { appPath } = await runTestApp('app-path/lib/index');
expect(appPath).to.equal(path.resolve(fixturesPath, 'api/app-path/lib'));
});
it('works for files', async () => {
const { appPath } = await runTestApp('app-path/lib/index.js');
expect(appPath).to.equal(path.resolve(fixturesPath, 'api/app-path/lib'));
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const { appPath } = await runTestApp('app-path');
expect(appPath).to.equal(path.resolve(fixturesPath, 'api/app-path'));
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const { appPath } = await runTestApp('app-path/lib');
expect(appPath).to.equal(path.resolve(fixturesPath, 'api/app-path/lib'));
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const { appPath } = await runTestApp('app-path/lib/index');
expect(appPath).to.equal(path.resolve(fixturesPath, 'api/app-path/lib'));
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const { appPath } = await runTestApp('app-path/lib/index.js');
expect(appPath).to.equal(path.resolve(fixturesPath, 'api/app-path/lib'));
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('returns paths that exist', () => {
const paths = [
fs.existsSync(app.getPath('exe')),
fs.existsSync(app.getPath('home')),
fs.existsSync(app.getPath('temp'))
];
expect(paths).to.deep.equal([true, true, true]);
});
it('throws an error when the name is invalid', () => {
expect(() => {
app.getPath('does-not-exist' as any);
}).to.throw(/Failed to get 'does-not-exist' path/);
});
it('returns the overridden path', () => {
app.setPath('music', __dirname);
expect(app.getPath('music')).to.equal(__dirname);
});
if (process.platform === 'win32') {
it('gets the folder for recent files', () => {
const recent = app.getPath('recent');
// We expect that one of our test machines have overriden this
// to be something crazy, it'll always include the word "Recent"
// unless people have been registry-hacking like crazy
expect(recent).to.include('Recent');
});
it('can override the recent files path', () => {
app.setPath('recent', 'C:\\fake-path');
expect(app.getPath('recent')).to.equal('C:\\fake-path');
});
}
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
const paths = [
fs.existsSync(app.getPath('exe')),
fs.existsSync(app.getPath('home')),
fs.existsSync(app.getPath('temp'))
];
expect(paths).to.deep.equal([true, true, true]);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
expect(() => {
app.getPath('does-not-exist' as any);
}).to.throw(/Failed to get 'does-not-exist' path/);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
app.getPath('does-not-exist' as any);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
app.setPath('music', __dirname);
expect(app.getPath('music')).to.equal(__dirname);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
const recent = app.getPath('recent');
// We expect that one of our test machines have overriden this
// to be something crazy, it'll always include the word "Recent"
// unless people have been registry-hacking like crazy
expect(recent).to.include('Recent');
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
app.setPath('recent', 'C:\\fake-path');
expect(app.getPath('recent')).to.equal('C:\\fake-path');
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('throws when a relative path is passed', () => {
const badPath = 'hey/hi/hello';
expect(() => {
app.setPath('music', badPath);
}).to.throw(/Path must be absolute/);
});
it('does not create a new directory by default', () => {
const badPath = path.join(__dirname, 'music');
expect(fs.existsSync(badPath)).to.be.false();
app.setPath('music', badPath);
expect(fs.existsSync(badPath)).to.be.false();
expect(() => { app.getPath(badPath as any); }).to.throw();
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
const badPath = 'hey/hi/hello';
expect(() => {
app.setPath('music', badPath);
}).to.throw(/Path must be absolute/);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
app.setPath('music', badPath);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
const badPath = path.join(__dirname, 'music');
expect(fs.existsSync(badPath)).to.be.false();
app.setPath('music', badPath);
expect(fs.existsSync(badPath)).to.be.false();
expect(() => { app.getPath(badPath as any); }).to.throw();
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => { app.getPath(badPath as any); } | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('throws when a relative path is passed', () => {
const badPath = 'hey/hi/hello';
expect(() => {
app.setAppLogsPath(badPath);
}).to.throw(/Path must be absolute/);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
const badPath = 'hey/hi/hello';
expect(() => {
app.setAppLogsPath(badPath);
}).to.throw(/Path must be absolute/);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
app.setAppLogsPath(badPath);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
let w: BrowserWindow;
before(function () {
if (process.platform === 'linux') {
this.skip();
}
session.fromPartition('empty-certificate').setCertificateVerifyProc((req, cb) => { cb(0); });
});
beforeEach(() => {
w = new BrowserWindow({
show: false,
webPreferences: {
nodeIntegration: true,
partition: 'empty-certificate'
}
});
});
afterEach(() => closeWindow(w).then(() => { w = null as any; }));
after(() => session.fromPartition('empty-certificate').setCertificateVerifyProc(null));
it('can respond with empty certificate list', async () => {
app.once('select-client-certificate', function (event, webContents, url, list, callback) {
console.log('select-client-certificate emitted');
event.preventDefault();
callback();
});
await w.webContents.loadURL(secureUrl);
expect(w.webContents.getTitle()).to.equal('denied');
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
(req, cb) => { cb(0); } | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
w = new BrowserWindow({
show: false,
webPreferences: {
nodeIntegration: true,
partition: 'empty-certificate'
}
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => session.fromPartition('empty-certificate').setCertificateVerifyProc(null) | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
app.once('select-client-certificate', function (event, webContents, url, list, callback) {
console.log('select-client-certificate emitted');
event.preventDefault();
callback();
});
await w.webContents.loadURL(secureUrl);
expect(w.webContents.getTitle()).to.equal('denied');
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
const protocol = 'electron-test';
const updateExe = path.resolve(path.dirname(process.execPath), '..', 'Update.exe');
const processStartArgs = [
'--processStart', `"${path.basename(process.execPath)}"`,
'--process-start-args', '"--hidden"'
];
let Winreg: any;
let classesKey: any;
before(function () {
if (process.platform !== 'win32') {
this.skip();
} else {
Winreg = require('winreg');
classesKey = new Winreg({
hive: Winreg.HKCU,
key: '\\Software\\Classes\\'
});
}
});
after(function (done) {
if (process.platform !== 'win32') {
done();
} else {
const protocolKey = new Winreg({
hive: Winreg.HKCU,
key: `\\Software\\Classes\\${protocol}`
});
// The last test leaves the registry dirty,
// delete the protocol key for those of us who test at home
protocolKey.destroy(() => done());
}
});
beforeEach(() => {
app.removeAsDefaultProtocolClient(protocol);
app.removeAsDefaultProtocolClient(protocol, updateExe, processStartArgs);
});
afterEach(() => {
app.removeAsDefaultProtocolClient(protocol);
expect(app.isDefaultProtocolClient(protocol)).to.equal(false);
app.removeAsDefaultProtocolClient(protocol, updateExe, processStartArgs);
expect(app.isDefaultProtocolClient(protocol, updateExe, processStartArgs)).to.equal(false);
});
it('sets the app as the default protocol client', () => {
expect(app.isDefaultProtocolClient(protocol)).to.equal(false);
app.setAsDefaultProtocolClient(protocol);
expect(app.isDefaultProtocolClient(protocol)).to.equal(true);
});
it('allows a custom path and args to be specified', () => {
expect(app.isDefaultProtocolClient(protocol, updateExe, processStartArgs)).to.equal(false);
app.setAsDefaultProtocolClient(protocol, updateExe, processStartArgs);
expect(app.isDefaultProtocolClient(protocol, updateExe, processStartArgs)).to.equal(true);
expect(app.isDefaultProtocolClient(protocol)).to.equal(false);
});
it('creates a registry entry for the protocol class', async () => {
app.setAsDefaultProtocolClient(protocol);
const keys = await promisify(classesKey.keys).call(classesKey) as any[];
const exists = !!keys.find(key => key.key.includes(protocol));
expect(exists).to.equal(true);
});
it('completely removes a registry entry for the protocol class', async () => {
app.setAsDefaultProtocolClient(protocol);
app.removeAsDefaultProtocolClient(protocol);
const keys = await promisify(classesKey.keys).call(classesKey) as any[];
const exists = !!keys.find(key => key.key.includes(protocol));
expect(exists).to.equal(false);
});
it('only unsets a class registry key if it contains other data', async () => {
app.setAsDefaultProtocolClient(protocol);
const protocolKey = new Winreg({
hive: Winreg.HKCU,
key: `\\Software\\Classes\\${protocol}`
});
await promisify(protocolKey.set).call(protocolKey, 'test-value', 'REG_BINARY', '123');
app.removeAsDefaultProtocolClient(protocol);
const keys = await promisify(classesKey.keys).call(classesKey) as any[];
const exists = !!keys.find(key => key.key.includes(protocol));
expect(exists).to.equal(true);
});
it('sets the default client such that getApplicationNameForProtocol returns Electron', () => {
app.setAsDefaultProtocolClient(protocol);
expect(app.getApplicationNameForProtocol(`${protocol}://`)).to.equal('Electron');
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
app.removeAsDefaultProtocolClient(protocol);
app.removeAsDefaultProtocolClient(protocol, updateExe, processStartArgs);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
app.removeAsDefaultProtocolClient(protocol);
expect(app.isDefaultProtocolClient(protocol)).to.equal(false);
app.removeAsDefaultProtocolClient(protocol, updateExe, processStartArgs);
expect(app.isDefaultProtocolClient(protocol, updateExe, processStartArgs)).to.equal(false);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
expect(app.isDefaultProtocolClient(protocol)).to.equal(false);
app.setAsDefaultProtocolClient(protocol);
expect(app.isDefaultProtocolClient(protocol)).to.equal(true);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
expect(app.isDefaultProtocolClient(protocol, updateExe, processStartArgs)).to.equal(false);
app.setAsDefaultProtocolClient(protocol, updateExe, processStartArgs);
expect(app.isDefaultProtocolClient(protocol, updateExe, processStartArgs)).to.equal(true);
expect(app.isDefaultProtocolClient(protocol)).to.equal(false);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
app.setAsDefaultProtocolClient(protocol);
const keys = await promisify(classesKey.keys).call(classesKey) as any[];
const exists = !!keys.find(key => key.key.includes(protocol));
expect(exists).to.equal(true);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
key => key.key.includes(protocol) | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
app.setAsDefaultProtocolClient(protocol);
app.removeAsDefaultProtocolClient(protocol);
const keys = await promisify(classesKey.keys).call(classesKey) as any[];
const exists = !!keys.find(key => key.key.includes(protocol));
expect(exists).to.equal(false);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
app.setAsDefaultProtocolClient(protocol);
const protocolKey = new Winreg({
hive: Winreg.HKCU,
key: `\\Software\\Classes\\${protocol}`
});
await promisify(protocolKey.set).call(protocolKey, 'test-value', 'REG_BINARY', '123');
app.removeAsDefaultProtocolClient(protocol);
const keys = await promisify(classesKey.keys).call(classesKey) as any[];
const exists = !!keys.find(key => key.key.includes(protocol));
expect(exists).to.equal(true);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
app.setAsDefaultProtocolClient(protocol);
expect(app.getApplicationNameForProtocol(`${protocol}://`)).to.equal('Electron');
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('returns application names for common protocols', function () {
// We can't expect particular app names here, but these protocols should
// at least have _something_ registered. Except on our Linux CI
// environment apparently.
if (process.platform === 'linux') {
this.skip();
}
const protocols = [
'http://',
'https://'
];
protocols.forEach((protocol) => {
expect(app.getApplicationNameForProtocol(protocol)).to.not.equal('');
});
});
it('returns an empty string for a bogus protocol', () => {
expect(app.getApplicationNameForProtocol('bogus-protocol://')).to.equal('');
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
(protocol) => {
expect(app.getApplicationNameForProtocol(protocol)).to.not.equal('');
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
expect(app.getApplicationNameForProtocol('bogus-protocol://')).to.equal('');
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('returns promise rejection for a bogus protocol', async function () {
await expect(
app.getApplicationInfoForProtocol('bogus-protocol://')
).to.eventually.be.rejectedWith(
'Unable to retrieve installation path to app'
);
});
it('returns resolved promise with appPath, displayName and icon', async function () {
const appInfo = await app.getApplicationInfoForProtocol('https://');
expect(appInfo.path).not.to.be.undefined();
expect(appInfo.name).not.to.be.undefined();
expect(appInfo.icon).not.to.be.undefined();
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('returns false for a bogus protocol', () => {
expect(app.isDefaultProtocolClient('bogus-protocol://')).to.equal(false);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
expect(app.isDefaultProtocolClient('bogus-protocol://')).to.equal(false);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
before(function () {
if (process.platform !== 'win32') {
this.skip();
}
});
it('does not launch for argument following a URL', async () => {
const appPath = path.join(fixturesPath, 'api', 'quit-app');
// App should exit with non 123 code.
const first = cp.spawn(process.execPath, [appPath, 'electron-test:?', 'abc']);
const [code] = await emittedOnce(first, 'exit');
expect(code).to.not.equal(123);
});
it('launches successfully for argument following a file path', async () => {
const appPath = path.join(fixturesPath, 'api', 'quit-app');
// App should exit with code 123.
const first = cp.spawn(process.execPath, [appPath, 'e:\\abc', 'abc']);
const [code] = await emittedOnce(first, 'exit');
expect(code).to.equal(123);
});
it('launches successfully for multiple URIs following --', async () => {
const appPath = path.join(fixturesPath, 'api', 'quit-app');
// App should exit with code 123.
const first = cp.spawn(process.execPath, [appPath, '--', 'http://electronjs.org', 'electron-test://testdata']);
const [code] = await emittedOnce(first, 'exit');
expect(code).to.equal(123);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const appPath = path.join(fixturesPath, 'api', 'quit-app');
// App should exit with non 123 code.
const first = cp.spawn(process.execPath, [appPath, 'electron-test:?', 'abc']);
const [code] = await emittedOnce(first, 'exit');
expect(code).to.not.equal(123);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const appPath = path.join(fixturesPath, 'api', 'quit-app');
// App should exit with code 123.
const first = cp.spawn(process.execPath, [appPath, 'e:\\abc', 'abc']);
const [code] = await emittedOnce(first, 'exit');
expect(code).to.equal(123);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const appPath = path.join(fixturesPath, 'api', 'quit-app');
// App should exit with code 123.
const first = cp.spawn(process.execPath, [appPath, '--', 'http://electronjs.org', 'electron-test://testdata']);
const [code] = await emittedOnce(first, 'exit');
expect(code).to.equal(123);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
const iconPath = path.join(__dirname, 'fixtures/assets/icon.ico');
const sizes = {
small: 16,
normal: 32,
large: process.platform === 'win32' ? 32 : 48
};
it('fetches a non-empty icon', async () => {
const icon = await app.getFileIcon(iconPath);
expect(icon.isEmpty()).to.equal(false);
});
it('fetches normal icon size by default', async () => {
const icon = await app.getFileIcon(iconPath);
const size = icon.getSize();
expect(size.height).to.equal(sizes.normal);
expect(size.width).to.equal(sizes.normal);
});
describe('size option', () => {
it('fetches a small icon', async () => {
const icon = await app.getFileIcon(iconPath, { size: 'small' });
const size = icon.getSize();
expect(size.height).to.equal(sizes.small);
expect(size.width).to.equal(sizes.small);
});
it('fetches a normal icon', async () => {
const icon = await app.getFileIcon(iconPath, { size: 'normal' });
const size = icon.getSize();
expect(size.height).to.equal(sizes.normal);
expect(size.width).to.equal(sizes.normal);
});
it('fetches a large icon', async () => {
// macOS does not support large icons
if (process.platform === 'darwin') return;
const icon = await app.getFileIcon(iconPath, { size: 'large' });
const size = icon.getSize();
expect(size.height).to.equal(sizes.large);
expect(size.width).to.equal(sizes.large);
});
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const icon = await app.getFileIcon(iconPath);
expect(icon.isEmpty()).to.equal(false);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const icon = await app.getFileIcon(iconPath);
const size = icon.getSize();
expect(size.height).to.equal(sizes.normal);
expect(size.width).to.equal(sizes.normal);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('fetches a small icon', async () => {
const icon = await app.getFileIcon(iconPath, { size: 'small' });
const size = icon.getSize();
expect(size.height).to.equal(sizes.small);
expect(size.width).to.equal(sizes.small);
});
it('fetches a normal icon', async () => {
const icon = await app.getFileIcon(iconPath, { size: 'normal' });
const size = icon.getSize();
expect(size.height).to.equal(sizes.normal);
expect(size.width).to.equal(sizes.normal);
});
it('fetches a large icon', async () => {
// macOS does not support large icons
if (process.platform === 'darwin') return;
const icon = await app.getFileIcon(iconPath, { size: 'large' });
const size = icon.getSize();
expect(size.height).to.equal(sizes.large);
expect(size.width).to.equal(sizes.large);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const icon = await app.getFileIcon(iconPath, { size: 'small' });
const size = icon.getSize();
expect(size.height).to.equal(sizes.small);
expect(size.width).to.equal(sizes.small);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const icon = await app.getFileIcon(iconPath, { size: 'normal' });
const size = icon.getSize();
expect(size.height).to.equal(sizes.normal);
expect(size.width).to.equal(sizes.normal);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
// macOS does not support large icons
if (process.platform === 'darwin') return;
const icon = await app.getFileIcon(iconPath, { size: 'large' });
const size = icon.getSize();
expect(size.height).to.equal(sizes.large);
expect(size.width).to.equal(sizes.large);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('returns memory and cpu stats of all running electron processes', () => {
const appMetrics = app.getAppMetrics();
expect(appMetrics).to.be.an('array').and.have.lengthOf.at.least(1, 'App memory info object is not > 0');
const types = [];
for (const entry of appMetrics) {
expect(entry.pid).to.be.above(0, 'pid is not > 0');
expect(entry.type).to.be.a('string').that.does.not.equal('');
expect(entry.creationTime).to.be.a('number').that.is.greaterThan(0);
types.push(entry.type);
expect(entry.cpu).to.have.ownProperty('percentCPUUsage').that.is.a('number');
expect(entry.cpu).to.have.ownProperty('idleWakeupsPerSecond').that.is.a('number');
expect(entry.memory).to.have.property('workingSetSize').that.is.greaterThan(0);
expect(entry.memory).to.have.property('peakWorkingSetSize').that.is.greaterThan(0);
if (entry.type === 'Utility' || entry.type === 'GPU') {
expect(entry.serviceName).to.be.a('string').that.does.not.equal('');
}
if (entry.type === 'Utility') {
expect(entry).to.have.property('name').that.is.a('string');
}
if (process.platform === 'win32') {
expect(entry.memory).to.have.property('privateBytes').that.is.greaterThan(0);
}
if (process.platform !== 'linux') {
expect(entry.sandboxed).to.be.a('boolean');
}
if (process.platform === 'win32') {
expect(entry.integrityLevel).to.be.a('string');
}
}
if (process.platform === 'darwin') {
expect(types).to.include('GPU');
}
expect(types).to.include('Browser');
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
const appMetrics = app.getAppMetrics();
expect(appMetrics).to.be.an('array').and.have.lengthOf.at.least(1, 'App memory info object is not > 0');
const types = [];
for (const entry of appMetrics) {
expect(entry.pid).to.be.above(0, 'pid is not > 0');
expect(entry.type).to.be.a('string').that.does.not.equal('');
expect(entry.creationTime).to.be.a('number').that.is.greaterThan(0);
types.push(entry.type);
expect(entry.cpu).to.have.ownProperty('percentCPUUsage').that.is.a('number');
expect(entry.cpu).to.have.ownProperty('idleWakeupsPerSecond').that.is.a('number');
expect(entry.memory).to.have.property('workingSetSize').that.is.greaterThan(0);
expect(entry.memory).to.have.property('peakWorkingSetSize').that.is.greaterThan(0);
if (entry.type === 'Utility' || entry.type === 'GPU') {
expect(entry.serviceName).to.be.a('string').that.does.not.equal('');
}
if (entry.type === 'Utility') {
expect(entry).to.have.property('name').that.is.a('string');
}
if (process.platform === 'win32') {
expect(entry.memory).to.have.property('privateBytes').that.is.greaterThan(0);
}
if (process.platform !== 'linux') {
expect(entry.sandboxed).to.be.a('boolean');
}
if (process.platform === 'win32') {
expect(entry.integrityLevel).to.be.a('string');
}
}
if (process.platform === 'darwin') {
expect(types).to.include('GPU');
}
expect(types).to.include('Browser');
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('returns the graphic features statuses', () => {
const features = app.getGPUFeatureStatus();
expect(features).to.have.ownProperty('webgl').that.is.a('string');
expect(features).to.have.ownProperty('gpu_compositing').that.is.a('string');
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
const features = app.getGPUFeatureStatus();
expect(features).to.have.ownProperty('webgl').that.is.a('string');
expect(features).to.have.ownProperty('gpu_compositing').that.is.a('string');
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
const appPath = path.join(fixturesPath, 'api', 'gpu-info.js');
const getGPUInfo = async (type: string) => {
const appProcess = cp.spawn(process.execPath, [appPath, type]);
let gpuInfoData = '';
let errorData = '';
appProcess.stdout.on('data', (data) => {
gpuInfoData += data;
});
appProcess.stderr.on('data', (data) => {
errorData += data;
});
const [exitCode] = await emittedOnce(appProcess, 'exit');
if (exitCode === 0) {
// return info data on successful exit
return JSON.parse(gpuInfoData);
} else {
// return error if not clean exit
return Promise.reject(new Error(errorData));
}
};
const verifyBasicGPUInfo = async (gpuInfo: any) => {
// Devices information is always present in the available info.
expect(gpuInfo).to.have.ownProperty('gpuDevice')
.that.is.an('array')
.and.does.not.equal([]);
const device = gpuInfo.gpuDevice[0];
expect(device).to.be.an('object')
.and.to.have.property('deviceId')
.that.is.a('number')
.not.lessThan(0);
};
it('succeeds with basic GPUInfo', async () => {
const gpuInfo = await getGPUInfo('basic');
await verifyBasicGPUInfo(gpuInfo);
});
it('succeeds with complete GPUInfo', async () => {
const completeInfo = await getGPUInfo('complete');
if (process.platform === 'linux') {
// For linux and macOS complete info is same as basic info
await verifyBasicGPUInfo(completeInfo);
const basicInfo = await getGPUInfo('basic');
expect(completeInfo).to.deep.equal(basicInfo);
} else {
// Gl version is present in the complete info.
expect(completeInfo).to.have.ownProperty('auxAttributes')
.that.is.an('object');
if (completeInfo.gpuDevice.active) {
expect(completeInfo.auxAttributes).to.have.ownProperty('glVersion')
.that.is.a('string')
.and.does.not.equal([]);
}
}
});
it('fails for invalid info_type', () => {
const invalidType = 'invalid';
const expectedErrorMessage = "Invalid info type. Use 'basic' or 'complete'";
return expect(app.getGPUInfo(invalidType as any)).to.eventually.be.rejectedWith(expectedErrorMessage);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async (type: string) => {
const appProcess = cp.spawn(process.execPath, [appPath, type]);
let gpuInfoData = '';
let errorData = '';
appProcess.stdout.on('data', (data) => {
gpuInfoData += data;
});
appProcess.stderr.on('data', (data) => {
errorData += data;
});
const [exitCode] = await emittedOnce(appProcess, 'exit');
if (exitCode === 0) {
// return info data on successful exit
return JSON.parse(gpuInfoData);
} else {
// return error if not clean exit
return Promise.reject(new Error(errorData));
}
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
(data) => {
gpuInfoData += data;
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
(data) => {
errorData += data;
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async (gpuInfo: any) => {
// Devices information is always present in the available info.
expect(gpuInfo).to.have.ownProperty('gpuDevice')
.that.is.an('array')
.and.does.not.equal([]);
const device = gpuInfo.gpuDevice[0];
expect(device).to.be.an('object')
.and.to.have.property('deviceId')
.that.is.a('number')
.not.lessThan(0);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const gpuInfo = await getGPUInfo('basic');
await verifyBasicGPUInfo(gpuInfo);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const completeInfo = await getGPUInfo('complete');
if (process.platform === 'linux') {
// For linux and macOS complete info is same as basic info
await verifyBasicGPUInfo(completeInfo);
const basicInfo = await getGPUInfo('basic');
expect(completeInfo).to.deep.equal(basicInfo);
} else {
// Gl version is present in the complete info.
expect(completeInfo).to.have.ownProperty('auxAttributes')
.that.is.an('object');
if (completeInfo.gpuDevice.active) {
expect(completeInfo.auxAttributes).to.have.ownProperty('glVersion')
.that.is.a('string')
.and.does.not.equal([]);
}
}
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
const invalidType = 'invalid';
const expectedErrorMessage = "Invalid info type. Use 'basic' or 'complete'";
return expect(app.getGPUInfo(invalidType as any)).to.eventually.be.rejectedWith(expectedErrorMessage);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
let appProcess: cp.ChildProcess = null as any;
let server: net.Server = null as any;
const socketPath = process.platform === 'win32' ? '\\\\.\\pipe\\electron-mixed-sandbox' : '/tmp/electron-mixed-sandbox';
beforeEach(function (done) {
if (process.platform === 'linux' && (process.arch === 'arm64' || process.arch === 'arm')) {
// Our ARM tests are run on VSTS rather than CircleCI, and the Docker
// setup on VSTS disallows syscalls that Chrome requires for setting up
// sandboxing.
// See:
// - https://docs.docker.com/engine/security/seccomp/#significant-syscalls-blocked-by-the-default-profile
// - https://chromium.googlesource.com/chromium/src/+/70.0.3538.124/sandbox/linux/services/credentials.cc#292
// - https://github.com/docker/docker-ce/blob/ba7dfc59ccfe97c79ee0d1379894b35417b40bca/components/engine/profiles/seccomp/seccomp_default.go#L497
// - https://blog.jessfraz.com/post/how-to-use-new-docker-seccomp-profiles/
//
// Adding `--cap-add SYS_ADMIN` or `--security-opt seccomp=unconfined`
// to the Docker invocation allows the syscalls that Chrome needs, but
// are probably more permissive than we'd like.
this.skip();
}
fs.unlink(socketPath, () => {
server = net.createServer();
server.listen(socketPath);
done();
});
});
afterEach(done => {
if (appProcess != null) appProcess.kill();
server.close(() => {
if (process.platform === 'win32') {
done();
} else {
fs.unlink(socketPath, () => done());
}
});
});
describe('when app.enableSandbox() is called', () => {
// TODO(jeremy): figure out why this times out under ASan
ifit(!process.env.IS_ASAN)('adds --enable-sandbox to all renderer processes', done => {
const appPath = path.join(fixturesPath, 'api', 'mixed-sandbox-app');
appProcess = cp.spawn(process.execPath, [appPath, '--app-enable-sandbox']);
server.once('error', error => { done(error); });
server.on('connection', client => {
client.once('data', (data) => {
const argv = JSON.parse(data.toString());
expect(argv.sandbox).to.include('--enable-sandbox');
expect(argv.sandbox).to.not.include('--no-sandbox');
expect(argv.noSandbox).to.include('--enable-sandbox');
expect(argv.noSandbox).to.not.include('--no-sandbox');
expect(argv.noSandboxDevtools).to.equal(true);
expect(argv.sandboxDevtools).to.equal(true);
done();
});
});
});
});
describe('when the app is launched with --enable-sandbox', () => {
// TODO(jeremy): figure out why this times out under ASan
ifit(!process.env.IS_ASAN)('adds --enable-sandbox to all renderer processes', done => {
const appPath = path.join(fixturesPath, 'api', 'mixed-sandbox-app');
appProcess = cp.spawn(process.execPath, [appPath, '--enable-sandbox']);
server.once('error', error => { done(error); });
server.on('connection', client => {
client.once('data', data => {
const argv = JSON.parse(data.toString());
expect(argv.sandbox).to.include('--enable-sandbox');
expect(argv.sandbox).to.not.include('--no-sandbox');
expect(argv.noSandbox).to.include('--enable-sandbox');
expect(argv.noSandbox).to.not.include('--no-sandbox');
expect(argv.noSandboxDevtools).to.equal(true);
expect(argv.sandboxDevtools).to.equal(true);
done();
});
});
});
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
done => {
if (appProcess != null) appProcess.kill();
server.close(() => {
if (process.platform === 'win32') {
done();
} else {
fs.unlink(socketPath, () => done());
}
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
// TODO(jeremy): figure out why this times out under ASan
ifit(!process.env.IS_ASAN)('adds --enable-sandbox to all renderer processes', done => {
const appPath = path.join(fixturesPath, 'api', 'mixed-sandbox-app');
appProcess = cp.spawn(process.execPath, [appPath, '--app-enable-sandbox']);
server.once('error', error => { done(error); });
server.on('connection', client => {
client.once('data', (data) => {
const argv = JSON.parse(data.toString());
expect(argv.sandbox).to.include('--enable-sandbox');
expect(argv.sandbox).to.not.include('--no-sandbox');
expect(argv.noSandbox).to.include('--enable-sandbox');
expect(argv.noSandbox).to.not.include('--no-sandbox');
expect(argv.noSandboxDevtools).to.equal(true);
expect(argv.sandboxDevtools).to.equal(true);
done();
});
});
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
done => {
const appPath = path.join(fixturesPath, 'api', 'mixed-sandbox-app');
appProcess = cp.spawn(process.execPath, [appPath, '--app-enable-sandbox']);
server.once('error', error => { done(error); });
server.on('connection', client => {
client.once('data', (data) => {
const argv = JSON.parse(data.toString());
expect(argv.sandbox).to.include('--enable-sandbox');
expect(argv.sandbox).to.not.include('--no-sandbox');
expect(argv.noSandbox).to.include('--enable-sandbox');
expect(argv.noSandbox).to.not.include('--no-sandbox');
expect(argv.noSandboxDevtools).to.equal(true);
expect(argv.sandboxDevtools).to.equal(true);
done();
});
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
error => { done(error); } | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
client => {
client.once('data', (data) => {
const argv = JSON.parse(data.toString());
expect(argv.sandbox).to.include('--enable-sandbox');
expect(argv.sandbox).to.not.include('--no-sandbox');
expect(argv.noSandbox).to.include('--enable-sandbox');
expect(argv.noSandbox).to.not.include('--no-sandbox');
expect(argv.noSandboxDevtools).to.equal(true);
expect(argv.sandboxDevtools).to.equal(true);
done();
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
(data) => {
const argv = JSON.parse(data.toString());
expect(argv.sandbox).to.include('--enable-sandbox');
expect(argv.sandbox).to.not.include('--no-sandbox');
expect(argv.noSandbox).to.include('--enable-sandbox');
expect(argv.noSandbox).to.not.include('--no-sandbox');
expect(argv.noSandboxDevtools).to.equal(true);
expect(argv.sandboxDevtools).to.equal(true);
done();
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
// TODO(jeremy): figure out why this times out under ASan
ifit(!process.env.IS_ASAN)('adds --enable-sandbox to all renderer processes', done => {
const appPath = path.join(fixturesPath, 'api', 'mixed-sandbox-app');
appProcess = cp.spawn(process.execPath, [appPath, '--enable-sandbox']);
server.once('error', error => { done(error); });
server.on('connection', client => {
client.once('data', data => {
const argv = JSON.parse(data.toString());
expect(argv.sandbox).to.include('--enable-sandbox');
expect(argv.sandbox).to.not.include('--no-sandbox');
expect(argv.noSandbox).to.include('--enable-sandbox');
expect(argv.noSandbox).to.not.include('--no-sandbox');
expect(argv.noSandboxDevtools).to.equal(true);
expect(argv.sandboxDevtools).to.equal(true);
done();
});
});
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
done => {
const appPath = path.join(fixturesPath, 'api', 'mixed-sandbox-app');
appProcess = cp.spawn(process.execPath, [appPath, '--enable-sandbox']);
server.once('error', error => { done(error); });
server.on('connection', client => {
client.once('data', data => {
const argv = JSON.parse(data.toString());
expect(argv.sandbox).to.include('--enable-sandbox');
expect(argv.sandbox).to.not.include('--no-sandbox');
expect(argv.noSandbox).to.include('--enable-sandbox');
expect(argv.noSandbox).to.not.include('--no-sandbox');
expect(argv.noSandboxDevtools).to.equal(true);
expect(argv.sandboxDevtools).to.equal(true);
done();
});
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
client => {
client.once('data', data => {
const argv = JSON.parse(data.toString());
expect(argv.sandbox).to.include('--enable-sandbox');
expect(argv.sandbox).to.not.include('--no-sandbox');
expect(argv.noSandbox).to.include('--enable-sandbox');
expect(argv.noSandbox).to.not.include('--no-sandbox');
expect(argv.noSandboxDevtools).to.equal(true);
expect(argv.sandboxDevtools).to.equal(true);
done();
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
data => {
const argv = JSON.parse(data.toString());
expect(argv.sandbox).to.include('--enable-sandbox');
expect(argv.sandbox).to.not.include('--no-sandbox');
expect(argv.noSandbox).to.include('--enable-sandbox');
expect(argv.noSandbox).to.not.include('--no-sandbox');
expect(argv.noSandboxDevtools).to.equal(true);
expect(argv.sandboxDevtools).to.equal(true);
done();
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('throws when called after app is ready', () => {
expect(() => {
app.disableDomainBlockingFor3DAPIs();
}).to.throw(/before app is ready/);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
expect(() => {
app.disableDomainBlockingFor3DAPIs();
}).to.throw(/before app is ready/);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.