Search in sources :

Example 6 with NetworkRequestMetricBuilder

use of com.google.firebase.perf.metrics.NetworkRequestMetricBuilder in project firebase-android-sdk by firebase.

the class FirebasePerfNetworkValidatorTest method testValidContentType.

@Test
public void testValidContentType() {
    NetworkRequestMetricBuilder metricBuilder = createNetworkRequestMetricBuilderWithRequiredValuesPresent();
    metricBuilder.setResponseContentType("a\u0020");
    FirebasePerfNetworkValidator validator = new FirebasePerfNetworkValidator(metricBuilder.build(), ApplicationProvider.getApplicationContext());
    assertTrue(validator.isValidPerfMetric());
}
Also used : NetworkRequestMetricBuilder(com.google.firebase.perf.metrics.NetworkRequestMetricBuilder) Test(org.junit.Test)

Example 7 with NetworkRequestMetricBuilder

use of com.google.firebase.perf.metrics.NetworkRequestMetricBuilder in project firebase-android-sdk by firebase.

the class FirebasePerfNetworkValidatorTest method testIsValid.

@Test
public void testIsValid() {
    NetworkRequestMetricBuilder metricBuilder = createNetworkRequestMetricBuilderWithRequiredValuesPresent();
    FirebasePerfNetworkValidator validator = new FirebasePerfNetworkValidator(metricBuilder.build(), ApplicationProvider.getApplicationContext());
    assertTrue(validator.isValidPerfMetric());
}
Also used : NetworkRequestMetricBuilder(com.google.firebase.perf.metrics.NetworkRequestMetricBuilder) Test(org.junit.Test)

Example 8 with NetworkRequestMetricBuilder

use of com.google.firebase.perf.metrics.NetworkRequestMetricBuilder in project firebase-android-sdk by firebase.

the class FirebasePerfNetworkValidatorTest method testNegativeTimeToResponseInitiated.

@Test
public void testNegativeTimeToResponseInitiated() {
    NetworkRequestMetricBuilder metricBuilder = createNetworkRequestMetricBuilderWithRequiredValuesPresent();
    metricBuilder.setTimeToResponseInitiatedMicros(-1L);
    FirebasePerfNetworkValidator validator = new FirebasePerfNetworkValidator(metricBuilder.build(), ApplicationProvider.getApplicationContext());
    assertFalse(validator.isValidPerfMetric());
}
Also used : NetworkRequestMetricBuilder(com.google.firebase.perf.metrics.NetworkRequestMetricBuilder) Test(org.junit.Test)

Example 9 with NetworkRequestMetricBuilder

use of com.google.firebase.perf.metrics.NetworkRequestMetricBuilder in project firebase-android-sdk by firebase.

the class FirebasePerfNetworkValidatorTest method testNegativeTimeToResponseCompleted.

@Test
public void testNegativeTimeToResponseCompleted() {
    NetworkRequestMetricBuilder metricBuilder = createNetworkRequestMetricBuilderWithRequiredValuesPresent();
    metricBuilder.setTimeToResponseCompletedMicros(-1L);
    FirebasePerfNetworkValidator validator = new FirebasePerfNetworkValidator(metricBuilder.build(), ApplicationProvider.getApplicationContext());
    assertFalse(validator.isValidPerfMetric());
}
Also used : NetworkRequestMetricBuilder(com.google.firebase.perf.metrics.NetworkRequestMetricBuilder) Test(org.junit.Test)

Example 10 with NetworkRequestMetricBuilder

use of com.google.firebase.perf.metrics.NetworkRequestMetricBuilder in project firebase-android-sdk by firebase.

the class FirebasePerfNetworkValidatorTest method testNullResponsePayloadBytes.

@Test
public void testNullResponsePayloadBytes() {
    NetworkRequestMetricBuilder metricBuilder = createNetworkRequestMetricBuilderWithRequiredValuesPresent();
    NetworkRequestMetric metric = metricBuilder.build();
    assertFalse(metric.hasResponsePayloadBytes());
    FirebasePerfNetworkValidator validator = new FirebasePerfNetworkValidator(metric, ApplicationProvider.getApplicationContext());
    assertTrue(validator.isValidPerfMetric());
}
Also used : NetworkRequestMetric(com.google.firebase.perf.v1.NetworkRequestMetric) NetworkRequestMetricBuilder(com.google.firebase.perf.metrics.NetworkRequestMetricBuilder) Test(org.junit.Test)

Aggregations

NetworkRequestMetricBuilder (com.google.firebase.perf.metrics.NetworkRequestMetricBuilder)40 Test (org.junit.Test)27 NetworkRequestMetric (com.google.firebase.perf.v1.NetworkRequestMetric)13 IOException (java.io.IOException)12 HttpResponse (org.apache.http.HttpResponse)5 ApplicationProcessState (com.google.firebase.perf.v1.ApplicationProcessState)4 HttpURLConnection (java.net.HttpURLConnection)3 URLConnection (java.net.URLConnection)3 HttpsURLConnection (javax.net.ssl.HttpsURLConnection)3 HttpUrl (okhttp3.HttpUrl)3 Request (okhttp3.Request)3 Response (okhttp3.Response)3 TransportManager (com.google.firebase.perf.transport.TransportManager)2 RequestBody (okhttp3.RequestBody)2 ResponseBody (okhttp3.ResponseBody)2 Keep (androidx.annotation.Keep)1 GaugeManager (com.google.firebase.perf.session.gauges.GaugeManager)1 Timer (com.google.firebase.perf.util.Timer)1 ResponseHandler (org.apache.http.client.ResponseHandler)1