Search in sources :

Example 16 with TraceMetric

use of com.google.firebase.perf.v1.TraceMetric in project firebase-android-sdk by firebase.

the class FirebasePerfTraceValidatorTest method testExceedMaxSubtrace.

@Test
public void testExceedMaxSubtrace() {
    TraceMetric.Builder trace = createValidTraceMetric();
    TraceMetric.Builder subtrace = createValidTraceMetric();
    TraceMetric subSubtrace = createValidTraceMetric().build();
    subtrace.addSubtraces(subSubtrace);
    trace.addSubtraces(subtrace);
    assertThat(new FirebasePerfTraceValidator(trace.build()).isValidPerfMetric()).isFalse();
}
Also used : TraceMetric(com.google.firebase.perf.v1.TraceMetric) Test(org.junit.Test)

Example 17 with TraceMetric

use of com.google.firebase.perf.v1.TraceMetric in project firebase-android-sdk by firebase.

the class FirebasePerfTraceValidatorTest method testEmptyCounterId.

@Test
public void testEmptyCounterId() {
    TraceMetric trace = createValidTraceMetric().putCounters("", 10).build();
    assertThat(new FirebasePerfTraceValidator(trace).isValidPerfMetric()).isFalse();
}
Also used : TraceMetric(com.google.firebase.perf.v1.TraceMetric) Test(org.junit.Test)

Example 18 with TraceMetric

use of com.google.firebase.perf.v1.TraceMetric in project firebase-android-sdk by firebase.

the class FirebasePerfTraceValidatorTest method testIsValid.

@Test
public void testIsValid() {
    TraceMetric.Builder trace = createValidTraceMetric().putCounters("counter", 2);
    TraceMetric subtrace = createValidTraceMetric().setName("subtrace1").putCounters("subtraceCounter", 2).build();
    trace.addSubtraces(subtrace);
    assertThat(new FirebasePerfTraceValidator(trace.build()).isValidPerfMetric()).isTrue();
}
Also used : TraceMetric(com.google.firebase.perf.v1.TraceMetric) Test(org.junit.Test)

Example 19 with TraceMetric

use of com.google.firebase.perf.v1.TraceMetric in project firebase-android-sdk by firebase.

the class FirebasePerfTraceValidatorTest method testInvalidSubtrace.

@Test
public void testInvalidSubtrace() {
    TraceMetric.Builder trace = createValidTraceMetric();
    TraceMetric subtrace = createValidTraceMetric().clearName().build();
    trace.addSubtraces(subtrace);
    assertThat(new FirebasePerfTraceValidator(trace.build()).isValidPerfMetric()).isFalse();
}
Also used : TraceMetric(com.google.firebase.perf.v1.TraceMetric) Test(org.junit.Test)

Example 20 with TraceMetric

use of com.google.firebase.perf.v1.TraceMetric in project firebase-android-sdk by firebase.

the class TraceMetricBuilderTest method testAddingAttributeWithNullValue.

@Test
public void testAddingAttributeWithNullValue() {
    Trace trace = new Trace(TRACE_1, transportManager, clock, appStateMonitor);
    currentTime = 1;
    trace.start();
    currentTime = 2;
    trace.putAttribute(TRACE_ATTRIBUTE_KEY, null);
    currentTime = 3;
    trace.stop();
    TraceMetric traceMetric = new TraceMetricBuilder(trace).build();
    Assert.assertEquals(TRACE_1, traceMetric.getName());
    Assert.assertEquals(0, traceMetric.getCustomAttributesCount());
}
Also used : TraceMetric(com.google.firebase.perf.v1.TraceMetric) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)44 TraceMetric (com.google.firebase.perf.v1.TraceMetric)43 PerfMetric (com.google.firebase.perf.v1.PerfMetric)11 ApplicationProcessState (com.google.firebase.perf.v1.ApplicationProcessState)7 Trace (com.google.firebase.perf.metrics.Trace)2 GaugeMetric (com.google.firebase.perf.v1.GaugeMetric)2 NetworkRequestMetric (com.google.firebase.perf.v1.NetworkRequestMetric)2 PerfSession (com.google.firebase.perf.v1.PerfSession)2 Fragment (androidx.fragment.app.Fragment)1 AppStateMonitor (com.google.firebase.perf.application.AppStateMonitor)1 TransportManager (com.google.firebase.perf.transport.TransportManager)1