@@ -245,6 +245,42 @@ type MockDeleteNotificationChannelConfig struct {
245245 err error
246246}
247247
248+ type MockCreateSavedSearchSubscriptionConfig struct {
249+ expectedUserID string
250+ expectedSubscription backend.Subscription
251+ output * backend.SubscriptionResponse
252+ err error
253+ }
254+
255+ type MockDeleteSavedSearchSubscriptionConfig struct {
256+ expectedUserID string
257+ expectedSubscriptionID string
258+ err error
259+ }
260+
261+ type MockGetSavedSearchSubscriptionConfig struct {
262+ expectedUserID string
263+ expectedSubscriptionID string
264+ output * backend.SubscriptionResponse
265+ err error
266+ }
267+
268+ type MockListSavedSearchSubscriptionsConfig struct {
269+ expectedUserID string
270+ expectedPageSize int
271+ expectedPageToken * string
272+ output * backend.SubscriptionPage
273+ err error
274+ }
275+
276+ type MockUpdateSavedSearchSubscriptionConfig struct {
277+ expectedUserID string
278+ expectedSubscriptionID string
279+ expectedUpdateRequest backend.UpdateSubscriptionRequest
280+ output * backend.SubscriptionResponse
281+ err error
282+ }
283+
248284type basicHTTPTestCase [T any ] struct {
249285 name string
250286 cfg * T
@@ -274,6 +310,11 @@ type MockWPTMetricsStorer struct {
274310 getNotificationChannelCfg * MockGetNotificationChannelConfig
275311 listNotificationChannelsCfg * MockListNotificationChannelsConfig
276312 deleteNotificationChannelCfg * MockDeleteNotificationChannelConfig
313+ createSavedSearchSubscriptionCfg * MockCreateSavedSearchSubscriptionConfig
314+ deleteSavedSearchSubscriptionCfg * MockDeleteSavedSearchSubscriptionConfig
315+ getSavedSearchSubscriptionCfg * MockGetSavedSearchSubscriptionConfig
316+ listSavedSearchSubscriptionsCfg * MockListSavedSearchSubscriptionsConfig
317+ updateSavedSearchSubscriptionCfg * MockUpdateSavedSearchSubscriptionConfig
277318 t * testing.T
278319 callCountListMissingOneImplCounts int
279320 callCountListMissingOneImplFeatures int
@@ -295,6 +336,11 @@ type MockWPTMetricsStorer struct {
295336 callCountGetNotificationChannel int
296337 callCountListNotificationChannels int
297338 callCountDeleteNotificationChannel int
339+ callCountCreateSavedSearchSubscription int
340+ callCountDeleteSavedSearchSubscription int
341+ callCountGetSavedSearchSubscription int
342+ callCountListSavedSearchSubscriptions int
343+ callCountUpdateSavedSearchSubscription int
298344}
299345
300346func (m * MockWPTMetricsStorer ) GetIDFromFeatureKey (
@@ -308,6 +354,76 @@ func (m *MockWPTMetricsStorer) GetIDFromFeatureKey(
308354 return m .getIDFromFeatureKeyConfig .result , m .getIDFromFeatureKeyConfig .err
309355}
310356
357+ func (m * MockWPTMetricsStorer ) CreateSavedSearchSubscription (_ context.Context , userID string ,
358+ subscription backend.Subscription ) (* backend.SubscriptionResponse , error ) {
359+ m .callCountCreateSavedSearchSubscription ++
360+ if userID != m .createSavedSearchSubscriptionCfg .expectedUserID {
361+ m .t .Errorf ("unexpected user id %s" , userID )
362+ }
363+ if ! reflect .DeepEqual (subscription , m .createSavedSearchSubscriptionCfg .expectedSubscription ) {
364+ m .t .Errorf ("unexpected subscription %+v" , subscription )
365+ }
366+
367+ return m .createSavedSearchSubscriptionCfg .output , m .createSavedSearchSubscriptionCfg .err
368+ }
369+
370+ func (m * MockWPTMetricsStorer ) DeleteSavedSearchSubscription (_ context.Context , userID , subscriptionID string ) error {
371+ m .callCountDeleteSavedSearchSubscription ++
372+ if userID != m .deleteSavedSearchSubscriptionCfg .expectedUserID {
373+ m .t .Errorf ("unexpected user id %s" , userID )
374+ }
375+ if subscriptionID != m .deleteSavedSearchSubscriptionCfg .expectedSubscriptionID {
376+ m .t .Errorf ("unexpected subscription id %s" , subscriptionID )
377+ }
378+
379+ return m .deleteSavedSearchSubscriptionCfg .err
380+ }
381+
382+ func (m * MockWPTMetricsStorer ) GetSavedSearchSubscription (_ context.Context ,
383+ userID , subscriptionID string ) (* backend.SubscriptionResponse , error ) {
384+ m .callCountGetSavedSearchSubscription ++
385+ if userID != m .getSavedSearchSubscriptionCfg .expectedUserID {
386+ m .t .Errorf ("unexpected user id %s" , userID )
387+ }
388+ if subscriptionID != m .getSavedSearchSubscriptionCfg .expectedSubscriptionID {
389+ m .t .Errorf ("unexpected subscription id %s" , subscriptionID )
390+ }
391+
392+ return m .getSavedSearchSubscriptionCfg .output , m .getSavedSearchSubscriptionCfg .err
393+ }
394+
395+ func (m * MockWPTMetricsStorer ) ListSavedSearchSubscriptions (_ context.Context ,
396+ userID string , pageSize int , pageToken * string ) (* backend.SubscriptionPage , error ) {
397+ m .callCountListSavedSearchSubscriptions ++
398+ if userID != m .listSavedSearchSubscriptionsCfg .expectedUserID {
399+ m .t .Errorf ("unexpected user id %s" , userID )
400+ }
401+ if pageSize != m .listSavedSearchSubscriptionsCfg .expectedPageSize {
402+ m .t .Errorf ("unexpected page size %d" , pageSize )
403+ }
404+ if ! reflect .DeepEqual (pageToken , m .listSavedSearchSubscriptionsCfg .expectedPageToken ) {
405+ m .t .Errorf ("unexpected page token %+v" , pageToken )
406+ }
407+
408+ return m .listSavedSearchSubscriptionsCfg .output , m .listSavedSearchSubscriptionsCfg .err
409+ }
410+
411+ func (m * MockWPTMetricsStorer ) UpdateSavedSearchSubscription (_ context.Context , userID , subscriptionID string ,
412+ req backend.UpdateSubscriptionRequest ) (* backend.SubscriptionResponse , error ) {
413+ m .callCountUpdateSavedSearchSubscription ++
414+ if userID != m .updateSavedSearchSubscriptionCfg .expectedUserID {
415+ m .t .Errorf ("unexpected user id %s" , userID )
416+ }
417+ if subscriptionID != m .updateSavedSearchSubscriptionCfg .expectedSubscriptionID {
418+ m .t .Errorf ("unexpected subscription id %s" , subscriptionID )
419+ }
420+ if ! reflect .DeepEqual (req , m .updateSavedSearchSubscriptionCfg .expectedUpdateRequest ) {
421+ m .t .Errorf ("unexpected update request %+v" , req )
422+ }
423+
424+ return m .updateSavedSearchSubscriptionCfg .output , m .updateSavedSearchSubscriptionCfg .err
425+ }
426+
311427func (m * MockWPTMetricsStorer ) ListMetricsForFeatureIDBrowserAndChannel (_ context.Context ,
312428 featureID string , browser string , channel string ,
313429 metric backend.WPTMetricView ,
0 commit comments