use of com.google.firebase.perf.util.ImmutableBundle in project firebase-android-sdk by firebase.
the class ConfigResolverTest method getSessionsCpuCaptureFrequencyBackgroundMs_validMetadata_notSaveMetadataInCache.
@Test
public void getSessionsCpuCaptureFrequencyBackgroundMs_validMetadata_notSaveMetadataInCache() {
Bundle bundle = new Bundle();
bundle.putInt(SESSIONS_CPU_CAPTURE_FREQUENCY_BG_MS_METADATA_KEY, 20);
testConfigResolver.setMetadataBundle(new ImmutableBundle(bundle));
testConfigResolver.getSessionsCpuCaptureFrequencyBackgroundMs();
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 getSessionsMemoryCaptureFrequencyBackgroundMs_invalidAndroidMetadataBundle_returnDefaultValue.
@Test
public void getSessionsMemoryCaptureFrequencyBackgroundMs_invalidAndroidMetadataBundle_returnDefaultValue() {
when(mockRemoteConfigManager.getLong(SESSIONS_MEMORY_CAPTURE_FREQUENCY_BG_MS_FRC_KEY)).thenReturn(Optional.absent());
when(mockDeviceCacheManager.getLong(SESSIONS_MEMORY_CAPTURE_FREQUENCY_BG_MS_CACHE_KEY)).thenReturn(Optional.absent());
assertThat(testConfigResolver.getSessionsMemoryCaptureFrequencyBackgroundMs()).isEqualTo(0L);
// 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(0L);
}
use of com.google.firebase.perf.util.ImmutableBundle in project firebase-android-sdk by firebase.
the class ConfigResolverTest method getSessionsCpuCaptureFrequencyForegroundMs_validMetadata_notSaveMetadataInCache.
@Test
public void getSessionsCpuCaptureFrequencyForegroundMs_validMetadata_notSaveMetadataInCache() {
Bundle bundle = new Bundle();
bundle.putInt(SESSIONS_CPU_CAPTURE_FREQUENCY_FG_MS_METADATA_KEY, 20);
testConfigResolver.setMetadataBundle(new ImmutableBundle(bundle));
testConfigResolver.getSessionsCpuCaptureFrequencyForegroundMs();
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 getSessionsMemoryCaptureFrequencyForegroundMs_metadataAndRemoteConfigAndCacheAreSet_metadataHasHighestConfigPrecedence.
@Test
public void getSessionsMemoryCaptureFrequencyForegroundMs_metadataAndRemoteConfigAndCacheAreSet_metadataHasHighestConfigPrecedence() {
// Set cache value.
when(mockDeviceCacheManager.getLong(SESSIONS_MEMORY_CAPTURE_FREQUENCY_FG_MS_CACHE_KEY)).thenReturn(Optional.of(200L));
// Set remote config value.
when(mockRemoteConfigManager.getLong(SESSIONS_MEMORY_CAPTURE_FREQUENCY_FG_MS_FRC_KEY)).thenReturn(Optional.of(300L));
// Set Android Manifest value.
Bundle bundle = new Bundle();
bundle.putInt(SESSIONS_MEMORY_CAPTURE_FREQUENCY_FG_MS_METADATA_KEY, 400);
testConfigResolver.setMetadataBundle(new ImmutableBundle(bundle));
assertThat(testConfigResolver.getSessionsMemoryCaptureFrequencyForegroundMs()).isEqualTo(400L);
}
use of com.google.firebase.perf.util.ImmutableBundle in project firebase-android-sdk by firebase.
the class ConfigResolverTest method getSessionsCpuCaptureFrequencyForegroundMs_invalidMetadataBundle_returnCacheValue.
@Test
public void getSessionsCpuCaptureFrequencyForegroundMs_invalidMetadataBundle_returnCacheValue() {
when(mockRemoteConfigManager.getLong(SESSIONS_CPU_CAPTURE_FREQUENCY_FG_MS_FRC_KEY)).thenReturn(Optional.absent());
when(mockDeviceCacheManager.getLong(SESSIONS_CPU_CAPTURE_FREQUENCY_FG_MS_CACHE_KEY)).thenReturn(Optional.of(200L));
assertThat(testConfigResolver.getSessionsCpuCaptureFrequencyForegroundMs()).isEqualTo(200L);
// Android Metadata bundle value is too high.
Bundle bundle = new Bundle();
bundle.putInt(SESSIONS_CPU_CAPTURE_FREQUENCY_FG_MS_METADATA_KEY, -200);
testConfigResolver.setMetadataBundle(new ImmutableBundle(bundle));
assertThat(testConfigResolver.getSessionsCpuCaptureFrequencyForegroundMs()).isEqualTo(200L);
}
Aggregations