fakeDesktop is a minimal Desktop implementation for unit tests.
| 46 | |
| 47 | // fakeDesktop is a minimal Desktop implementation for unit tests. |
| 48 | type fakeDesktop struct { |
| 49 | startErr error |
| 50 | cursorPos [2]int |
| 51 | startCfg agentdesktop.DisplayConfig |
| 52 | vncConnErr error |
| 53 | screenshotErr error |
| 54 | screenshotRes agentdesktop.ScreenshotResult |
| 55 | lastShotOpts agentdesktop.ScreenshotOptions |
| 56 | closed bool |
| 57 | |
| 58 | // Track calls for assertions. |
| 59 | lastMove [2]int |
| 60 | lastClick [3]int // x, y, button |
| 61 | lastScroll [4]int // x, y, dx, dy |
| 62 | lastKey string |
| 63 | lastTyped string |
| 64 | lastKeyDown string |
| 65 | lastKeyUp string |
| 66 | |
| 67 | thumbnailData []byte // if set, StopRecording includes a thumbnail |
| 68 | |
| 69 | // Recording tracking (guarded by recMu). |
| 70 | recMu sync.Mutex |
| 71 | recordings map[string]string // ID → file path |
| 72 | stopCalls []string // recording IDs passed to StopRecording |
| 73 | recStopCh chan string // optional: signaled when StopRecording is called |
| 74 | startCount int // incremented on each new recording start |
| 75 | activityCount int // incremented by RecordActivity |
| 76 | } |
| 77 | |
| 78 | func (f *fakeDesktop) Start(context.Context) (agentdesktop.DisplayConfig, error) { |
| 79 | return f.startCfg, f.startErr |
nothing calls this directly
no outgoing calls
no test coverage detected