mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-09-24 15:49:09 +00:00
d9b0a06569
* fix: keep non-hibernated tabs active in background * fix: scope background work to hibernation policy * fix: bind background monitoring to its tab * fix: measure hidden local workspaces
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
const assert = require('node:assert/strict');
|
|
const { readFileSync } = require('node:fs');
|
|
const path = require('node:path');
|
|
const test = require('node:test');
|
|
|
|
const root = __dirname;
|
|
|
|
function read(relativePath) {
|
|
return readFileSync(path.join(root, relativePath), 'utf8');
|
|
}
|
|
|
|
test('terminal windows do not throttle work while hidden or unfocused', () => {
|
|
const windowSources = [
|
|
'bridges/windowManager/mainWindow.cjs',
|
|
'bridges/windowManager/terminalPopupWindow.cjs',
|
|
];
|
|
|
|
for (const relativePath of windowSources) {
|
|
const source = read(relativePath);
|
|
assert.match(source, /webPreferences:\s*\{[\s\S]*?backgroundThrottling:\s*false/, relativePath);
|
|
}
|
|
});
|
|
|
|
test('non-terminal windows and the app itself do not block ordinary power saving', () => {
|
|
const sources = [
|
|
'main.cjs',
|
|
'bridges/windowManager/settingsWindow.cjs',
|
|
'bridges/windowManager/externalWindows.cjs',
|
|
'bridges/globalShortcutBridge.cjs',
|
|
];
|
|
|
|
for (const relativePath of sources) {
|
|
const source = read(relativePath);
|
|
assert.doesNotMatch(source, /backgroundThrottling:\s*false|powerSaveBlocker/, relativePath);
|
|
}
|
|
});
|