|
3 | 3 |
|
4 | 4 | NS_ASSUME_NONNULL_BEGIN |
5 | 5 |
|
| 6 | +/// Keys of the `deepExtension` dictionary in the snapshot response, shared |
| 7 | +/// with the Swift consumer so the response shape has one spelling. |
| 8 | +FOUNDATION_EXPORT NSString *const RunnerAXSnapshotDeepExtensionKey; |
| 9 | +FOUNDATION_EXPORT NSString *const RunnerAXSnapshotDeepExtensionCallsKey; |
| 10 | +FOUNDATION_EXPORT NSString *const RunnerAXSnapshotDeepExtensionNodesAddedKey; |
| 11 | +FOUNDATION_EXPORT NSString *const RunnerAXSnapshotDeepExtensionPendingKey; |
| 12 | +FOUNDATION_EXPORT NSString *const RunnerAXSnapshotDeepExtensionMissedKey; |
| 13 | + |
| 14 | +/// A depth-capped childless node awaiting an element-rooted follow-up request. |
| 15 | +/// Public so the runner unit bundle can drive the extension's miss paths with |
| 16 | +/// fabricated snapshots — the executed contract that missed frontiers are |
| 17 | +/// counted, never silently dropped. |
| 18 | +@interface RunnerAXSnapshotFrontier : NSObject |
| 19 | +@property(nonatomic, strong, nullable) id snapshot; |
| 20 | +@property(nonatomic, strong, nullable) NSMutableDictionary *node; |
| 21 | +@property(nonatomic, assign) NSInteger depth; |
| 22 | +@end |
| 23 | + |
6 | 24 | @interface RunnerAXSnapshotBridge : NSObject |
7 | 25 |
|
| 26 | +/// Captures the app's accessibility tree, then chains element-rooted follow-up |
| 27 | +/// requests from depth-capped frontier nodes (the AX depth limit is |
| 28 | +/// per-request, so re-rooting reaches content the app-rooted request could |
| 29 | +/// not). The response gains a `deepExtension` {calls, nodesAdded, |
| 30 | +/// pendingFrontiers, missedFrontiers} dictionary when any frontier existed and |
| 31 | +/// the call limit allowed extension. Pass 0 to disable extension entirely. |
8 | 32 | + (NSDictionary<NSString *, id> *)snapshotTreeForApplication:(XCUIApplication *)application |
9 | 33 | maxDepth:(NSInteger)maxDepth |
10 | | - maxNodes:(NSInteger)maxNodes; |
| 34 | + maxNodes:(NSInteger)maxNodes |
| 35 | + deepExtensionCallLimit:(NSInteger)deepExtensionCallLimit |
| 36 | + deadline:(nullable NSDate *)deadline; |
11 | 37 |
|
12 | 38 | + (NSInteger)processIdentifierForApplication:(XCUIApplication *)application; |
13 | 39 |
|
| 40 | +/// The frontier-extension loop, exposed for the runner unit bundle: a frontier |
| 41 | +/// whose element vanished or whose re-rooted request fails must count as |
| 42 | +/// missed (see the deepExtension keys above) — an all-miss extension reporting |
| 43 | +/// itself drained would present a capped capture as complete. |
| 44 | ++ (nullable NSDictionary *)extendSnapshotFrontiers:(NSMutableArray<RunnerAXSnapshotFrontier *> *)frontiers |
| 45 | + axClient:(id)axClient |
| 46 | + attributes:(NSArray *)attributes |
| 47 | + maxDepth:(NSInteger)maxDepth |
| 48 | + maxNodes:(NSInteger)maxNodes |
| 49 | + nodeCount:(NSInteger *)nodeCount |
| 50 | + truncated:(BOOL *)truncated |
| 51 | + callsAllowed:(NSInteger)callsAllowed |
| 52 | + deadline:(nullable NSDate *)deadline; |
| 53 | + |
14 | 54 | @end |
15 | 55 |
|
16 | 56 | NS_ASSUME_NONNULL_END |
0 commit comments