Enables sandbox for all windows except main
This commit is contained in:
parent
abb839c24b
commit
e211837bcd
67 changed files with 1190 additions and 615 deletions
|
@ -5,6 +5,7 @@ import os from 'os';
|
|||
import Sinon from 'sinon';
|
||||
import { assert } from 'chai';
|
||||
|
||||
import { getOSFunctions } from '../../util/os/shared';
|
||||
import * as Settings from '../../types/Settings';
|
||||
|
||||
describe('Settings', () => {
|
||||
|
@ -21,8 +22,9 @@ describe('Settings', () => {
|
|||
describe('getAudioNotificationSupport', () => {
|
||||
it('returns native support on macOS', () => {
|
||||
sandbox.stub(process, 'platform').value('darwin');
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.strictEqual(
|
||||
Settings.getAudioNotificationSupport(),
|
||||
Settings.getAudioNotificationSupport(OS),
|
||||
Settings.AudioNotificationSupport.Native
|
||||
);
|
||||
});
|
||||
|
@ -30,8 +32,9 @@ describe('Settings', () => {
|
|||
it('returns no support on Windows 7', () => {
|
||||
sandbox.stub(process, 'platform').value('win32');
|
||||
sandbox.stub(os, 'release').returns('7.0.0');
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.strictEqual(
|
||||
Settings.getAudioNotificationSupport(),
|
||||
Settings.getAudioNotificationSupport(OS),
|
||||
Settings.AudioNotificationSupport.None
|
||||
);
|
||||
});
|
||||
|
@ -39,16 +42,18 @@ describe('Settings', () => {
|
|||
it('returns native support on Windows 8', () => {
|
||||
sandbox.stub(process, 'platform').value('win32');
|
||||
sandbox.stub(os, 'release').returns('8.0.0');
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.strictEqual(
|
||||
Settings.getAudioNotificationSupport(),
|
||||
Settings.getAudioNotificationSupport(OS),
|
||||
Settings.AudioNotificationSupport.Native
|
||||
);
|
||||
});
|
||||
|
||||
it('returns custom support on Linux', () => {
|
||||
sandbox.stub(process, 'platform').value('linux');
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.strictEqual(
|
||||
Settings.getAudioNotificationSupport(),
|
||||
Settings.getAudioNotificationSupport(OS),
|
||||
Settings.AudioNotificationSupport.Custom
|
||||
);
|
||||
});
|
||||
|
@ -57,48 +62,56 @@ describe('Settings', () => {
|
|||
describe('isAudioNotificationSupported', () => {
|
||||
it('returns true on macOS', () => {
|
||||
sandbox.stub(process, 'platform').value('darwin');
|
||||
assert.isTrue(Settings.isAudioNotificationSupported());
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.isTrue(Settings.isAudioNotificationSupported(OS));
|
||||
});
|
||||
|
||||
it('returns false on Windows 7', () => {
|
||||
sandbox.stub(process, 'platform').value('win32');
|
||||
sandbox.stub(os, 'release').returns('7.0.0');
|
||||
assert.isFalse(Settings.isAudioNotificationSupported());
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.isFalse(Settings.isAudioNotificationSupported(OS));
|
||||
});
|
||||
|
||||
it('returns true on Windows 8', () => {
|
||||
sandbox.stub(process, 'platform').value('win32');
|
||||
sandbox.stub(os, 'release').returns('8.0.0');
|
||||
assert.isTrue(Settings.isAudioNotificationSupported());
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.isTrue(Settings.isAudioNotificationSupported(OS));
|
||||
});
|
||||
|
||||
it('returns true on Linux', () => {
|
||||
sandbox.stub(process, 'platform').value('linux');
|
||||
assert.isTrue(Settings.isAudioNotificationSupported());
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.isTrue(Settings.isAudioNotificationSupported(OS));
|
||||
});
|
||||
});
|
||||
|
||||
describe('isNotificationGroupingSupported', () => {
|
||||
it('returns true on macOS', () => {
|
||||
sandbox.stub(process, 'platform').value('darwin');
|
||||
assert.isTrue(Settings.isNotificationGroupingSupported());
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.isTrue(Settings.isNotificationGroupingSupported(OS));
|
||||
});
|
||||
|
||||
it('returns true on Windows 7', () => {
|
||||
sandbox.stub(process, 'platform').value('win32');
|
||||
sandbox.stub(os, 'release').returns('7.0.0');
|
||||
assert.isFalse(Settings.isNotificationGroupingSupported());
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.isFalse(Settings.isNotificationGroupingSupported(OS));
|
||||
});
|
||||
|
||||
it('returns true on Windows 8', () => {
|
||||
sandbox.stub(process, 'platform').value('win32');
|
||||
sandbox.stub(os, 'release').returns('8.0.0');
|
||||
assert.isTrue(Settings.isNotificationGroupingSupported());
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.isTrue(Settings.isNotificationGroupingSupported(OS));
|
||||
});
|
||||
|
||||
it('returns true on Linux', () => {
|
||||
sandbox.stub(process, 'platform').value('linux');
|
||||
assert.isTrue(Settings.isNotificationGroupingSupported());
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.isTrue(Settings.isNotificationGroupingSupported(OS));
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -106,88 +119,103 @@ describe('Settings', () => {
|
|||
it('returns true on Windows', () => {
|
||||
sandbox.stub(process, 'platform').value('win32');
|
||||
sandbox.stub(os, 'release').returns('8.0.0');
|
||||
assert.isTrue(Settings.isAutoLaunchSupported());
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.isTrue(Settings.isAutoLaunchSupported(OS));
|
||||
});
|
||||
|
||||
it('returns true on macOS', () => {
|
||||
sandbox.stub(process, 'platform').value('darwin');
|
||||
assert.isTrue(Settings.isAutoLaunchSupported());
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.isTrue(Settings.isAutoLaunchSupported(OS));
|
||||
});
|
||||
|
||||
it('returns false on Linux', () => {
|
||||
sandbox.stub(process, 'platform').value('linux');
|
||||
assert.isFalse(Settings.isAutoLaunchSupported());
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.isFalse(Settings.isAutoLaunchSupported(OS));
|
||||
});
|
||||
});
|
||||
|
||||
describe('isHideMenuBarSupported', () => {
|
||||
it('returns false on macOS', () => {
|
||||
sandbox.stub(process, 'platform').value('darwin');
|
||||
assert.isFalse(Settings.isHideMenuBarSupported());
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.isFalse(Settings.isHideMenuBarSupported(OS));
|
||||
});
|
||||
|
||||
it('returns true on Windows 7', () => {
|
||||
sandbox.stub(process, 'platform').value('win32');
|
||||
sandbox.stub(os, 'release').returns('7.0.0');
|
||||
assert.isTrue(Settings.isHideMenuBarSupported());
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.isTrue(Settings.isHideMenuBarSupported(OS));
|
||||
});
|
||||
|
||||
it('returns true on Windows 8', () => {
|
||||
sandbox.stub(process, 'platform').value('win32');
|
||||
sandbox.stub(os, 'release').returns('8.0.0');
|
||||
assert.isTrue(Settings.isHideMenuBarSupported());
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.isTrue(Settings.isHideMenuBarSupported(OS));
|
||||
});
|
||||
|
||||
it('returns true on Linux', () => {
|
||||
sandbox.stub(process, 'platform').value('linux');
|
||||
assert.isTrue(Settings.isHideMenuBarSupported());
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.isTrue(Settings.isHideMenuBarSupported(OS));
|
||||
});
|
||||
});
|
||||
|
||||
describe('isDrawAttentionSupported', () => {
|
||||
it('returns false on macOS', () => {
|
||||
sandbox.stub(process, 'platform').value('darwin');
|
||||
assert.isFalse(Settings.isDrawAttentionSupported());
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.isFalse(Settings.isDrawAttentionSupported(OS));
|
||||
});
|
||||
|
||||
it('returns true on Windows 7', () => {
|
||||
sandbox.stub(process, 'platform').value('win32');
|
||||
sandbox.stub(os, 'release').returns('7.0.0');
|
||||
assert.isTrue(Settings.isDrawAttentionSupported());
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.isTrue(Settings.isDrawAttentionSupported(OS));
|
||||
});
|
||||
|
||||
it('returns true on Windows 8', () => {
|
||||
sandbox.stub(process, 'platform').value('win32');
|
||||
sandbox.stub(os, 'release').returns('8.0.0');
|
||||
assert.isTrue(Settings.isDrawAttentionSupported());
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.isTrue(Settings.isDrawAttentionSupported(OS));
|
||||
});
|
||||
|
||||
it('returns true on Linux', () => {
|
||||
sandbox.stub(process, 'platform').value('linux');
|
||||
assert.isTrue(Settings.isDrawAttentionSupported());
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.isTrue(Settings.isDrawAttentionSupported(OS));
|
||||
});
|
||||
});
|
||||
|
||||
describe('isSystemTraySupported', () => {
|
||||
it('returns false on macOS', () => {
|
||||
sandbox.stub(process, 'platform').value('darwin');
|
||||
assert.isFalse(Settings.isSystemTraySupported('1.2.3'));
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.isFalse(Settings.isSystemTraySupported(OS, '1.2.3'));
|
||||
});
|
||||
|
||||
it('returns true on Windows 8', () => {
|
||||
sandbox.stub(process, 'platform').value('win32');
|
||||
sandbox.stub(os, 'release').returns('8.0.0');
|
||||
assert.isTrue(Settings.isSystemTraySupported('1.2.3'));
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.isTrue(Settings.isSystemTraySupported(OS, '1.2.3'));
|
||||
});
|
||||
|
||||
it('returns false on Linux production', () => {
|
||||
sandbox.stub(process, 'platform').value('linux');
|
||||
assert.isFalse(Settings.isSystemTraySupported('1.2.3'));
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.isFalse(Settings.isSystemTraySupported(OS, '1.2.3'));
|
||||
});
|
||||
|
||||
it('returns true on Linux beta', () => {
|
||||
sandbox.stub(process, 'platform').value('linux');
|
||||
assert.isTrue(Settings.isSystemTraySupported('1.2.3-beta.4'));
|
||||
const OS = getOSFunctions(os.release());
|
||||
assert.isTrue(Settings.isSystemTraySupported(OS, '1.2.3-beta.4'));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue