use of com.google.firebase.perf.v1.ApplicationProcessState in project firebase-android-sdk by firebase.
the class TransportManagerTest method validTraceMetric_knownApplicationProcessState_getLogged.
// endregion
// region ApplicationProcessState Behaviour
@Test
public void validTraceMetric_knownApplicationProcessState_getLogged() {
TraceMetric validTrace = createValidTraceMetric();
testTransportManager.log(validTrace, ApplicationProcessState.BACKGROUND);
fakeExecutorService.runAll();
PerfMetric loggedPerfMetric = getLastLoggedEvent(times(1));
assertThat(loggedPerfMetric.getTraceMetric()).isEqualTo(validTrace);
validateApplicationInfo(loggedPerfMetric, ApplicationProcessState.BACKGROUND);
}
use of com.google.firebase.perf.v1.ApplicationProcessState in project firebase-android-sdk by firebase.
the class TransportManagerTest method validGaugeMetric_withMetadata_isLogged.
@Test
public void validGaugeMetric_withMetadata_isLogged() {
ApplicationProcessState expectedAppState = ApplicationProcessState.FOREGROUND;
GaugeMetadata gaugeMetadata = GaugeMetadata.newBuilder().setDeviceRamSizeKb(2000).setMaxAppJavaHeapMemoryKb(1000).setMaxEncouragedAppJavaHeapMemoryKb(800).build();
GaugeMetric validGauge = GaugeMetric.newBuilder().setSessionId("sessionId").setGaugeMetadata(gaugeMetadata).build();
testTransportManager.log(validGauge, expectedAppState);
fakeExecutorService.runAll();
PerfMetric loggedPerfMetric = getLastLoggedEvent(times(1));
assertThat(loggedPerfMetric.getGaugeMetric().getSessionId()).isEqualTo("sessionId");
assertThat(loggedPerfMetric.getGaugeMetric().getGaugeMetadata().getDeviceRamSizeKb()).isEqualTo(2000);
assertThat(loggedPerfMetric.getGaugeMetric().getGaugeMetadata().getMaxAppJavaHeapMemoryKb()).isEqualTo(1000);
assertThat(loggedPerfMetric.getGaugeMetric().getGaugeMetadata().getMaxEncouragedAppJavaHeapMemoryKb()).isEqualTo(800);
}
use of com.google.firebase.perf.v1.ApplicationProcessState in project firebase-android-sdk by firebase.
the class TransportManagerTest method validGaugeMetric_withMemoryReadings_isLogged.
@Test
public void validGaugeMetric_withMemoryReadings_isLogged() {
ApplicationProcessState expectedAppState = ApplicationProcessState.FOREGROUND;
// Construct a list of Memory metric readings
List<AndroidMemoryReading> expectedMemoryMetricReadings = new ArrayList<>();
expectedMemoryMetricReadings.add(createValidAndroidMetricReading(/* currentUsedAppJavaHeapMemoryKb= */
1234));
expectedMemoryMetricReadings.add(createValidAndroidMetricReading(/* currentUsedAppJavaHeapMemoryKb= */
23456));
GaugeMetric validGauge = GaugeMetric.newBuilder().setSessionId("sessionId").addAllAndroidMemoryReadings(expectedMemoryMetricReadings).build();
testTransportManager.log(validGauge, expectedAppState);
fakeExecutorService.runAll();
PerfMetric loggedPerfMetric = getLastLoggedEvent(times(1));
assertThat(loggedPerfMetric.getGaugeMetric().getAndroidMemoryReadingsList()).containsExactlyElementsIn(expectedMemoryMetricReadings);
assertThat(loggedPerfMetric.getGaugeMetric().getSessionId()).isEqualTo("sessionId");
}
Aggregations