use of com.google.firebase.perf.util.ImmutableBundle in project firebase-android-sdk by firebase.
the class ConfigResolverTest method getSessionsSamplingRate_validMetadata_notSaveMetadataInCache.
@Test
public void getSessionsSamplingRate_validMetadata_notSaveMetadataInCache() {
Bundle bundle = new Bundle();
bundle.putFloat("sessions_sampling_percentage", 20.0f);
testConfigResolver.setMetadataBundle(new ImmutableBundle(bundle));
assertThat(testConfigResolver.getSessionsSamplingRate()).isEqualTo(0.2f);
verify(mockDeviceCacheManager, never()).setValue(any(), any());
}
use of com.google.firebase.perf.util.ImmutableBundle in project firebase-android-sdk by firebase.
the class ConfigResolverTest method getIsPerformanceCollectionEnabled_noDeviceCacheAndMetadataIsFalse_returnsFalse.
@Test
public void getIsPerformanceCollectionEnabled_noDeviceCacheAndMetadataIsFalse_returnsFalse() {
// Arrange metadata.
Bundle bundle = new Bundle();
bundle.putBoolean("firebase_performance_collection_enabled", false);
testConfigResolver.setMetadataBundle(new ImmutableBundle(bundle));
when(mockDeviceCacheManager.getBoolean(FIREBASE_PERFORMANCE_COLLECTION_ENABLED_CACHE_KEY)).thenReturn(Optional.absent());
assertThat(testConfigResolver.getIsPerformanceCollectionEnabled()).isFalse();
}
use of com.google.firebase.perf.util.ImmutableBundle in project firebase-android-sdk by firebase.
the class ConfigResolverTest method getIsPerformanceCollectionEnabled_collectionDeactivated_returnsFalse.
@Test
public void getIsPerformanceCollectionEnabled_collectionDeactivated_returnsFalse() {
Bundle bundle = new Bundle();
bundle.putBoolean("firebase_performance_collection_deactivated", true);
testConfigResolver.setMetadataBundle(new ImmutableBundle(bundle));
assertThat(testConfigResolver.getIsPerformanceCollectionEnabled()).isFalse();
}
use of com.google.firebase.perf.util.ImmutableBundle in project firebase-android-sdk by firebase.
the class ConfigResolverTest method getSessionsMemoryCaptureFrequencyBackgroundMs_invalidAndroidMetadataBundle_returnRemoteConfigValue.
@Test
public void getSessionsMemoryCaptureFrequencyBackgroundMs_invalidAndroidMetadataBundle_returnRemoteConfigValue() {
when(mockRemoteConfigManager.getLong(SESSIONS_MEMORY_CAPTURE_FREQUENCY_BG_MS_FRC_KEY)).thenReturn(Optional.of(200L));
assertThat(testConfigResolver.getSessionsMemoryCaptureFrequencyBackgroundMs()).isEqualTo(200L);
// Android Metadata bundle value is negative.
Bundle bundle = new Bundle();
bundle.putInt(SESSIONS_MEMORY_CAPTURE_FREQUENCY_BG_MS_METADATA_KEY, -200);
testConfigResolver.setMetadataBundle(new ImmutableBundle(bundle));
assertThat(testConfigResolver.getSessionsMemoryCaptureFrequencyBackgroundMs()).isEqualTo(200L);
}
use of com.google.firebase.perf.util.ImmutableBundle in project firebase-android-sdk by firebase.
the class ConfigResolverTest method getFragmentSamplingRate_validMetadata_notSaveMetadataInCache.
@Test
public void getFragmentSamplingRate_validMetadata_notSaveMetadataInCache() {
Bundle bundle = new Bundle();
bundle.putFloat("fragment_sampling_percentage", 20.0f);
testConfigResolver.setMetadataBundle(new ImmutableBundle(bundle));
assertThat(testConfigResolver.getFragmentSamplingRate()).isEqualTo(0.2f);
verify(mockDeviceCacheManager, never()).setValue(any(), any());
}
Aggregations