Files
orca/native/computer-use-macos/Tests/OrcaComputerUseMacOSTests/SessionLockProbeTests.swift
Jinwoo-H 0fa60492c1 fix(computer): report a locked screen instead of missing Accessibility
Behind the lock screen (display sleep, screen saver or a manual lock) macOS reports Accessibility as untrusted. Orca read that as a missing permission, and its recovery hint led agents to open System Settings. Check the session lock first and return screen_locked; permission setup refuses while locked.
2026-11-13 23:10:40 -05:00

16 lines
712 B
Swift

import OrcaComputerUseMacOSCore
import XCTest
final class SessionLockProbeTests: XCTestCase {
func testTheSessionLockFlagDecides() {
XCTAssertTrue(SessionLockProbe.isLocked(session: ["CGSSessionScreenIsLocked": kCFBooleanTrue as Any]))
XCTAssertTrue(SessionLockProbe.isLocked(session: ["CGSSessionScreenIsLocked": NSNumber(value: 1)]))
XCTAssertFalse(SessionLockProbe.isLocked(session: ["CGSSessionScreenIsLocked": kCFBooleanFalse as Any]))
}
func testAnAbsentKeyOrMissingSessionIsUnlocked() {
XCTAssertFalse(SessionLockProbe.isLocked(session: ["kCGSSessionOnConsoleKey": NSNumber(value: 1)]))
XCTAssertFalse(SessionLockProbe.isLocked(session: nil))
}
}