MCPcopy Index your code
hub / github.com/coder/coder / recordDesktopActions

Function recordDesktopActions

coderd/x/chatd/chattool/computeruse_test.go:1022–1047  ·  view source on GitHub ↗
(
	t testing.TB,
	mockConn *agentconnmock.MockAgentConn,
	geometry workspacesdk.DesktopGeometry,
	times int,
	screenshotPNG string,
)

Source from the content-addressed store, hash-verified

1020}
1021
1022func recordDesktopActions(
1023 t testing.TB,
1024 mockConn *agentconnmock.MockAgentConn,
1025 geometry workspacesdk.DesktopGeometry,
1026 times int,
1027 screenshotPNG string,
1028) *[]workspacesdk.DesktopAction {
1029 t.Helper()
1030 actions := make([]workspacesdk.DesktopAction, 0, times)
1031 mockConn.EXPECT().ExecuteDesktopAction(
1032 gomock.Any(),
1033 gomock.AssignableToTypeOf(workspacesdk.DesktopAction{}),
1034 ).DoAndReturn(func(_ context.Context, action workspacesdk.DesktopAction) (workspacesdk.DesktopActionResponse, error) {
1035 actions = append(actions, action)
1036 if action.Action == "screenshot" {
1037 return workspacesdk.DesktopActionResponse{
1038 Output: "screenshot",
1039 ScreenshotData: screenshotPNG,
1040 ScreenshotWidth: geometry.DeclaredWidth,
1041 ScreenshotHeight: geometry.DeclaredHeight,
1042 }, nil
1043 }
1044 return workspacesdk.DesktopActionResponse{Output: action.Action + " performed"}, nil
1045 }).Times(times)
1046 return &actions
1047}
1048
1049func assertDesktopActionScaled(
1050 t testing.TB,

Calls 3

HelperMethod · 0.65
ExecuteDesktopActionMethod · 0.65
EXPECTMethod · 0.45

Tested by

no test coverage detected