Repository navigation
Rearm idle monitor after timeout changes #9570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
8ecbddb
ef82132
3bd9d87
c6cb1c3
23409f3
8d36604
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,9 @@ set -euo pipefail | |
| source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" | ||
|
|
||
| run_node_test <<'JS' | ||
| const fs = require('fs') | ||
| const idle = requireFromRoot('shell/plugins/services/idle/IdleModel.js') | ||
| const serviceSource = fs.readFileSync(root + '/shell/plugins/services/idle/Service.qml', 'utf8') | ||
|
|
||
| assertEqual(idle.secondsFromConfig('42.9', 10), 42, 'idle floors configured seconds') | ||
| assertEqual(idle.secondsFromConfig('-1', 10), 10, 'idle rejects negative seconds') | ||
|
|
@@ -33,6 +35,23 @@ assertDeepEqual( | |
| { windows: { a: true }, count: 1 }, | ||
| 'idle leaves screensaver windows unchanged without an address' | ||
| ) | ||
|
|
||
| assert( | ||
| /onFirstIdleTimeoutSecondsChanged:[\s\S]*?idleMonitorRearmTimer\.restart\(\)/.test(serviceSource), | ||
| 'idle re-arms its monitor when the configured first timeout changes' | ||
| ) | ||
|
|
||
| const idleMonitor = serviceSource.slice(serviceSource.indexOf(' IdleMonitor {')) | ||
| .split('\n }', 1)[0] | ||
| assert( | ||
| /enabled: root\.idleEnabled && !idleMonitorRearmTimer\.running/.test(idleMonitor), | ||
| 'idle monitor stays disabled for the re-arm timer turn' | ||
| ) | ||
|
|
||
| const rearmTimer = serviceSource.slice(serviceSource.indexOf(' id: idleMonitorRearmTimer')) | ||
| .split('\n }', 1)[0] | ||
| assert(/interval: 150/.test(rearmTimer), 'idle re-arm spans a tested event-loop delay') | ||
| assert(/repeat: false/.test(rearmTimer), 'idle re-arm only pulses the monitor once per timeout change') | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These assertions match QML source text but never change a timeout in a running Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||
| JS | ||
|
|
||
| test_tmp=$(mktemp -d) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.