use of com.google.firebase.perf.config.ConfigResolver in project firebase-android-sdk by firebase.
the class PerfSessionTest method setUp.
@Before
public void setUp() {
initMocks(this);
DeviceCacheManager.clearInstance();
ConfigResolver.clearInstance();
appContext.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE).edit().clear().commit();
ConfigResolver configResolver = ConfigResolver.getInstance();
configResolver.setApplicationContext(appContext);
configResolver.setDeviceCacheManager(new DeviceCacheManager(new FakeDirectExecutorService()));
}
use of com.google.firebase.perf.config.ConfigResolver in project firebase-android-sdk by firebase.
the class PerfSessionTest method shouldCollectGaugesAndEvents_perfMonDeactivated_sessionNotVerbose.
@Test
public void shouldCollectGaugesAndEvents_perfMonDeactivated_sessionNotVerbose() {
ConfigResolver configResolver = ConfigResolver.getInstance();
Bundle bundle = new Bundle();
bundle.putFloat("sessions_sampling_percentage", 100f);
bundle.putBoolean("firebase_performance_collection_deactivated", true);
configResolver.setMetadataBundle(new ImmutableBundle(bundle));
// Session will never be verbose if developer deactivated performance monitoring at build time.
assertThat(PerfSession.shouldCollectGaugesAndEvents()).isFalse();
// Case #1: developer has enabled Performance Monitoring during runtime.
configResolver.setIsPerformanceCollectionEnabled(true);
assertThat(PerfSession.shouldCollectGaugesAndEvents()).isFalse();
// Case #2: developer has disabled Performance Monitoring during runtime.
configResolver.setIsPerformanceCollectionEnabled(false);
assertThat(PerfSession.shouldCollectGaugesAndEvents()).isFalse();
}
use of com.google.firebase.perf.config.ConfigResolver in project firebase-android-sdk by firebase.
the class TraceTest method setUp.
@Before
public void setUp() {
currentTime = 1;
initMocks(this);
doAnswer((Answer<Timer>) invocationOnMock -> new Timer(currentTime)).when(mockClock).getTime();
arguments = ArgumentCaptor.forClass(TraceMetric.class);
DeviceCacheManager.clearInstance();
ConfigResolver.clearInstance();
appContext.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE).edit().clear().commit();
ConfigResolver configResolver = ConfigResolver.getInstance();
configResolver.setDeviceCacheManager(new DeviceCacheManager(new FakeDirectExecutorService()));
configResolver.setApplicationContext(appContext);
}
Aggregations