@@ -63,14 +63,25 @@ func newVisionHintsHandler(
6363 systemMock * portmocks.MockSystemPort ,
6464 logger * zap.Logger ,
6565 shutdown func (),
66+ ) * Handler {
67+ return newCaptureHintsHandler (domain .StrategyVision , systemMock , logger , shutdown )
68+ }
69+
70+ // newCaptureHintsHandler builds a handler whose configured hint strategy is
71+ // strategy and whose screen-capture permission comes from systemMock.
72+ func newCaptureHintsHandler (
73+ strategy string ,
74+ systemMock * portmocks.MockSystemPort ,
75+ logger * zap.Logger ,
76+ shutdown func (),
6677) * Handler {
6778 handler := newHandlerWithState (handlerState {
6879 ctx : context .Background (),
6980 logger : logger ,
7081 config : & configpkg.Config {
7182 Hints : configpkg.HintsConfig {
7283 Enabled : true ,
73- Strategy : domain . StrategyVision ,
84+ Strategy : strategy ,
7485 },
7586 },
7687 appState : state .NewAppState (),
@@ -121,6 +132,20 @@ func TestActivateMode_PermissionDialogDoesNotBlockOrHoldLock(t *testing.T) {
121132 }
122133}
123134
135+ func TestActivateMode_ContourStrategyRequestsScreenCapturePermission (t * testing.T ) {
136+ modal := newPermissionModal ()
137+ handler := newCaptureHintsHandler (domain .StrategyContour , modal .system , zap .NewNop (), func () {})
138+
139+ // Contour reads the window's pixels just like vision does, so an
140+ // activation without consent must raise the dialog instead of letting the
141+ // capture fail under the mode handler's lock.
142+ handler .ActivateMode (modecmd.Activation {Mode : domain .ModeHints })
143+
144+ modal .awaitOpen (t )
145+
146+ modal .consent <- ports .ScreenCaptureCanceled
147+ }
148+
124149func TestResumeHintActivationAfterPermission_DoesNotRepromptWhenCheckStillFails (t * testing.T ) {
125150 requests := make (chan struct {}, 2 )
126151 consent := make (chan ports.ScreenCaptureConsent )
0 commit comments