Files
codex/codex-rs/config/src/computer_use_tests.rs
rafael-oai 95118dff65 Add browser and computer use configuration (#40018)
## What changed

- Add typed `browser_use` settings for history access and per-origin access,
  download, upload, and full CDP policies.
- Add typed `computer_use` settings for default app access, macOS bundle IDs,
  Windows AUMIDs, and Windows executable identities.
- Expose the merged settings through app-server config reads and generated
  Rust, TypeScript, and JSON schemas.

## Testing

- Cover TOML serialization round trips, layered config reads with origin
  metadata, and app-server batch writes.

GitOrigin-RevId: 78065f6fec990602071fc81ff639ff97f7ad8cd5
2026-08-21 21:41:55 +00:00

55 lines
1.8 KiB
Rust

use super::*;
use crate::config_toml::ConfigToml;
use pretty_assertions::assert_eq;
#[test]
fn computer_use_config_round_trips() {
let config: ConfigToml = toml::from_str(
r#"
[computer_use]
default_app_access = "deny"
[computer_use.macos.bundle_ids]
"com.apple.Safari" = "allow"
[computer_use.windows.aumids]
"Microsoft.Paint_8wekyb3d8bbwe!App" = "deny"
[[computer_use.windows.exes]]
publisher_name = "CN=Google LLC"
product_name = "Google Chrome"
binary_name = "chrome.exe"
access = "allow"
"#,
)
.expect("computer use config should deserialize");
let expected = ComputerUseConfigToml {
default_app_access: Some(AllowDenyRequirementToml::Deny),
macos: Some(ComputerUseMacosConfigToml {
bundle_ids: Some(BTreeMap::from([(
"com.apple.Safari".to_string(),
AllowDenyRequirementToml::Allow,
)])),
}),
windows: Some(ComputerUseWindowsConfigToml {
aumids: Some(BTreeMap::from([(
"Microsoft.Paint_8wekyb3d8bbwe!App".to_string(),
AllowDenyRequirementToml::Deny,
)])),
exes: Some(vec![ComputerUseWindowsExeConfigToml {
publisher_name: "CN=Google LLC".to_string(),
product_name: "Google Chrome".to_string(),
binary_name: Some("chrome.exe".to_string()),
access: AllowDenyRequirementToml::Allow,
}]),
}),
};
assert_eq!(config.computer_use, Some(expected.clone()));
let serialized = toml::to_string(&config).expect("computer use config should serialize");
let reparsed: ConfigToml =
toml::from_str(&serialized).expect("serialized computer use config should deserialize");
assert_eq!(reparsed.computer_use, Some(expected));
}