Task: 2026/11/17/keep-testagent-downloads-in-the-run-and-the-updater-and-url-handlers-off
4.8 KiB
test_agent
Type: Harness API (may include self-tests).
Source contract: test_agent.h.
Use when
Runtime gate, startup overrides and fixture access. Read the contract below and the source header before use.
Contract and usage
Runtime gate, startup scale override, the macOS App Nap hold
(ApplyStartupOverrides() begins one
NSActivityUserInitiatedAllowingIdleSystemSleep | NSActivityLatencyCritical
NSProcessInfo activity early in Application::run(), before
Test::Start(), and holds it until the process exits, logging one NOTE: TDESKTOP_TEST_APP_NAP=[<value>] applied: hold=<active|off> source=<default|environment> - <reason> row; TDESKTOP_TEST_APP_NAP=allow
leaves it off and any other value is rejected; nothing off macOS), sticky
named events, scenario start, account fixture secrets (TwoStepPassword()
reads 2svpassword.txt, GramAccount() reads test_gram_account.txt,
RewriteGramAccountWords() rewrites the live and golden copies at the rotated
wallet's address after a confirmed rotation, StageGramAccountLiveWords()
stages a proper prefix of the live copy's own words for a self-test and
RestoreGramAccountLiveWords() lengthens such a staged copy back to the words
it was cut from, neither touching the golden sibling; GramAccountLivePath()
/ GramAccountGoldenPath() name the two copies for metadata-only checks).
ApplyStartupOverrides() also keeps a run's downloads, update checks and
URL-handler registration inside the run, each with its own escape passed with
test-run --env and one NOTE: row per process; none of them sets a saved
setting or option
(Downloads, the update checker and URL handlers):
- Unless
TDESKTOP_TEST_DOWNLOADS=product, which reserves nothing, it creates the run's default download folder fresh underEvidenceDir():downloads/, or a newdownloads-XXXXXX/sibling when anything (a folder, a file, a junction) already has that name. RowTDESKTOP_TEST_DOWNLOADS=[<value>] applied: default-folder=<run|product> source=<default|environment> - <reason>; stored path [<stored>] ask=<0|1>, whose reason names the folder used.DefaultDownloadFolder()returns it, absolute with a trailing slash, and is empty without-testagent, under the opt-out and in a build without the harness;File::DefaultDownloadPath()returns it when it is not empty. When no fresh folder can be created it logsTDESKTOP_TEST_DOWNLOADS=[<value>] setup refused: ..., also on stderr, andApplyStartupOverrides()returns false, soApplication::run()quits before the rest of startup. A stored path,Tmp()or the ask-for-path prompt still decide first. The export settings' location label may still name the product's default folder while the export goes to the run folder; an export-folder campaign usesTDESKTOP_TEST_DOWNLOADS=product. -noupdate, whichtest-runpasses, only skips installing an already-ready update at startup. Update checks are suppressed instead:SuppressUpdateChecks()is true for the whole-testagentprocess unlessTDESKTOP_TEST_UPDATER=allow, andCore::Updater::start()returns at its early gate when it is, before any request, update-file probe or timer. The decision is selected once, on the first checker start (the crash window can come beforeApplication::run()) or inApplyStartupOverrides(), and is kept in memory only: nothing is saved. It is false without-testagentand in a build without the harness, reading nothing. RowTDESKTOP_TEST_UPDATER=[<value>] applied: checker=off source=default - update checks suppressed for this process, or withallowchecker=product source=environment - the product decides whether to check.AllowAutomaticUrlRegistration()is false under-testagentunlessTDESKTOP_TEST_URL_SCHEME=register, soApplication::autoRegisterUrlScheme()does not queue the launch's automatictg,tonsiteandtonregistration; it is true without-testagent, in a build without the harness and beforeApplyStartupOverrides()selects it. The copy's ownskip-url-scheme-registerand the version check still apply first, the option is only read, and theregistertgcode still registers on request. RowTDESKTOP_TEST_URL_SCHEME=[<value>] applied: registration=<off|product> source=<default|environment> - <reason>; due=<yes|no> skip-url-scheme-register=<on|off>. A control that lets it run on Windows follows the registry recipe.
Related guidance
Launch and background behavior; account fixtures.
Release builds with the harness: when Active() can be true outside Debug.