Files
claude-code-haha/native/cu-helper/Tests/CuHelperTests/ProcessValidationObservationTests.swift
程序员阿江(Relakkes) 56c6a9aa8e feat(computer-use): align native app automation with Codex
Add a persistent isolated JavaScript worker for native app actions and batch
known operations without a model round trip between each input. Preserve
per-cell context, native errors, screenshot coordinates, and image types.

Align macOS gesture, key, inventory, capture, scroll, and clipboard behavior;
include a signed native receiver fixture and compiled sidecar regression tests.
Keep the Windows pixel route and fix cancellation with session-owned mouse
cleanup, lock revalidation, and portable signing-fixture tests.
2026-09-10 03:34:39 +08:00

29 lines
1.1 KiB
Swift

import XCTest
@testable import cc_haha_computer_use
#if DEBUG
final class ProcessValidationObservationTests: XCTestCase {
@MainActor
func testObserverSeesTheActualFailedComparisonWithoutAllowingTheTarget() throws {
let expected = try XCTUnwrap(ProvenProcessTarget(
pid: .max,
identity: AXTreeProcessIdentity(
bundleID: "dev.cchaha.tests.missing",
executablePath: "/missing/process",
launchTime: 100
)
))
let previous = Injection.targetValidationObserver
defer { Injection.targetValidationObserver = previous }
var observed: [(ProvenProcessTarget, AXTreeProcessIdentity?)] = []
Injection.targetValidationObserver = { observed.append(($0, $1)) }
XCTAssertThrowsError(try Injection.validateAuthorizedTarget(expected)) {
XCTAssertEqual(($0 as? CUError)?.code, "stale_process")
}
XCTAssertEqual(observed.count, 1)
XCTAssertEqual(observed.first?.0, expected)
XCTAssertNil(observed.first?.1)
}
}
#endif