use of com.google.firebase.perf.v1.GaugeMetadata in project firebase-android-sdk by firebase.
the class FirebasePerfGaugeManagerValidatorTest method testGaugeMetadataWithoutMaxJavaHeapIsNotValid.
@Test
public void testGaugeMetadataWithoutMaxJavaHeapIsNotValid() {
GaugeMetadata gaugeMetadata = GaugeMetadata.newBuilder().setProcessName("processName").setDeviceRamSizeKb(2000).setMaxEncouragedAppJavaHeapMemoryKb(800).build();
GaugeMetric.Builder gaugeMetricBuilder = GaugeMetric.newBuilder();
gaugeMetricBuilder.setSessionId("sessionId");
gaugeMetricBuilder.setGaugeMetadata(gaugeMetadata);
FirebasePerfGaugeMetricValidator validator = new FirebasePerfGaugeMetricValidator(gaugeMetricBuilder.build());
assertThat(validator.isValidPerfMetric()).isFalse();
}
use of com.google.firebase.perf.v1.GaugeMetadata in project firebase-android-sdk by firebase.
the class FirebasePerfGaugeManagerValidatorTest method testGaugeMetricIsValid.
@Test
public void testGaugeMetricIsValid() {
// Construct a list of Cpu metric readings
List<CpuMetricReading> expectedCpuMetricReadings = new ArrayList<>();
expectedCpuMetricReadings.add(createValidCpuMetricReading(/* userTimeUs= */
10, /* systemTimeUs= */
20));
expectedCpuMetricReadings.add(createValidCpuMetricReading(/* userTimeUs= */
20, /* systemTimeUs= */
30));
// Construct a list of Memory metric readings
List<AndroidMemoryReading> expectedMemoryMetricReadings = new ArrayList<>();
expectedMemoryMetricReadings.add(createValidAndroidMetricReading(/* currentUsedAppJavaHeapMemoryKb= */
1234));
expectedMemoryMetricReadings.add(createValidAndroidMetricReading(/* currentUsedAppJavaHeapMemoryKb= */
23456));
// Construct GaugeMetadata
GaugeMetadata gaugeMetadata = createValidGaugeMetadata("processName", /* deviceRamSizeKb= */
2000, /* maxAppJavaHeapMemoryKb= */
1000, /* maxEncouragedAppJavaHeapMemoryKb= */
800);
GaugeMetric.Builder gaugeMetricBuilder = GaugeMetric.newBuilder();
gaugeMetricBuilder.setSessionId("sessionId");
gaugeMetricBuilder.addAllCpuMetricReadings(expectedCpuMetricReadings);
gaugeMetricBuilder.addAllAndroidMemoryReadings(expectedMemoryMetricReadings);
gaugeMetricBuilder.setGaugeMetadata(gaugeMetadata);
FirebasePerfGaugeMetricValidator validator = new FirebasePerfGaugeMetricValidator(gaugeMetricBuilder.build());
assertThat(validator.isValidPerfMetric()).isTrue();
}
Aggregations