@@ -497,6 +497,83 @@ public void getIsServiceCollectionEnabled_sdkDisabledVersionFlagNoFrc_returnDefa
497497 assertThat (testConfigResolver .getIsServiceCollectionEnabled ()).isTrue ();
498498 }
499499
500+ @ Test
501+ public void
502+ getIsPerformanceCollectionConfigValueAvailable_noDeviceCacheNoRemoteConfig_returnsFalse () {
503+ when (mockDeviceCacheManager .getBoolean (FIREBASE_PERFORMANCE_COLLECTION_ENABLED_CACHE_KEY ))
504+ .thenReturn (Optional .absent ());
505+ when (mockRemoteConfigManager .isLastFetchFailed ()).thenReturn (false );
506+ when (mockRemoteConfigManager .getBoolean (FIREBASE_PERFORMANCE_SDK_ENABLED_FRC_KEY ))
507+ .thenReturn (Optional .absent ());
508+ assertThat (testConfigResolver .isCollectionEnabledConfigValueAvailable ()).isFalse ();
509+ }
510+
511+ @ Test
512+ public void
513+ getIsPerformanceCollectionConfigValueAvailable_noDeviceCacheHasRemoteConfigValueFalse_returnsTrue () {
514+ when (mockDeviceCacheManager .getBoolean (FIREBASE_PERFORMANCE_COLLECTION_ENABLED_CACHE_KEY ))
515+ .thenReturn (Optional .absent ());
516+ when (mockRemoteConfigManager .isLastFetchFailed ()).thenReturn (false );
517+ when (mockRemoteConfigManager .getBoolean (FIREBASE_PERFORMANCE_SDK_ENABLED_FRC_KEY ))
518+ .thenReturn (Optional .of (false ));
519+ assertThat (testConfigResolver .isCollectionEnabledConfigValueAvailable ()).isTrue ();
520+ }
521+
522+ @ Test
523+ public void
524+ getIsPerformanceCollectionConfigValueAvailable_HasDeviceCacheNoRemoteConfigValue_returnsTrue () {
525+ when (mockDeviceCacheManager .getBoolean (FIREBASE_PERFORMANCE_COLLECTION_ENABLED_CACHE_KEY ))
526+ .thenReturn (Optional .of (false ));
527+ when (mockRemoteConfigManager .isLastFetchFailed ()).thenReturn (false );
528+ when (mockRemoteConfigManager .getBoolean (FIREBASE_PERFORMANCE_SDK_ENABLED_FRC_KEY ))
529+ .thenReturn (Optional .absent ());
530+ assertThat (testConfigResolver .isCollectionEnabledConfigValueAvailable ()).isTrue ();
531+ }
532+
533+ @ Test
534+ public void
535+ getIsPerformanceCollectionConfigValueAvailable_HasDeviceCacheFalseHasRemoteConfigValueFalse_returnsTrue () {
536+ when (mockDeviceCacheManager .getBoolean (FIREBASE_PERFORMANCE_COLLECTION_ENABLED_CACHE_KEY ))
537+ .thenReturn (Optional .of (false ));
538+ when (mockRemoteConfigManager .isLastFetchFailed ()).thenReturn (false );
539+ when (mockRemoteConfigManager .getBoolean (FIREBASE_PERFORMANCE_SDK_ENABLED_FRC_KEY ))
540+ .thenReturn (Optional .of (false ));
541+ assertThat (testConfigResolver .isCollectionEnabledConfigValueAvailable ()).isTrue ();
542+ }
543+
544+ @ Test
545+ public void
546+ getIsPerformanceCollectionConfigValueAvailable_noDeviceCacheHasRemoteConfigValueTrue_returnsTrue () {
547+ when (mockDeviceCacheManager .getBoolean (FIREBASE_PERFORMANCE_COLLECTION_ENABLED_CACHE_KEY ))
548+ .thenReturn (Optional .of (false ));
549+ when (mockRemoteConfigManager .isLastFetchFailed ()).thenReturn (false );
550+ when (mockRemoteConfigManager .getBoolean (FIREBASE_PERFORMANCE_SDK_ENABLED_FRC_KEY ))
551+ .thenReturn (Optional .of (true ));
552+ assertThat (testConfigResolver .isCollectionEnabledConfigValueAvailable ()).isTrue ();
553+ }
554+
555+ @ Test
556+ public void
557+ getIsPerformanceCollectionConfigValueAvailable_hasDeviceCacheHasRemoteConfigValueFalse_returnsTrue () {
558+ when (mockDeviceCacheManager .getBoolean (FIREBASE_PERFORMANCE_COLLECTION_ENABLED_CACHE_KEY ))
559+ .thenReturn (Optional .of (true ));
560+ when (mockRemoteConfigManager .isLastFetchFailed ()).thenReturn (false );
561+ when (mockRemoteConfigManager .getBoolean (FIREBASE_PERFORMANCE_SDK_ENABLED_FRC_KEY ))
562+ .thenReturn (Optional .of (false ));
563+ assertThat (testConfigResolver .isCollectionEnabledConfigValueAvailable ()).isTrue ();
564+ }
565+
566+ @ Test
567+ public void
568+ getIsPerformanceCollectionConfigValueAvailable_hasDeviceCacheHasRemoteConfig_returnsTrue () {
569+ when (mockDeviceCacheManager .getBoolean (FIREBASE_PERFORMANCE_COLLECTION_ENABLED_CACHE_KEY ))
570+ .thenReturn (Optional .of (true ));
571+ when (mockRemoteConfigManager .isLastFetchFailed ()).thenReturn (false );
572+ when (mockRemoteConfigManager .getBoolean (FIREBASE_PERFORMANCE_SDK_ENABLED_FRC_KEY ))
573+ .thenReturn (Optional .of (true ));
574+ assertThat (testConfigResolver .isCollectionEnabledConfigValueAvailable ()).isTrue ();
575+ }
576+
500577 @ Test
501578 public void getIsPerformanceCollectionEnabled_notDeviceCacheOrMetadata_returnsNull () {
502579 when (mockDeviceCacheManager .getBoolean (FIREBASE_PERFORMANCE_COLLECTION_ENABLED_CACHE_KEY ))
0 commit comments