use of com.google.firebase.perf.v1.NetworkRequestMetric in project firebase-android-sdk by firebase.
the class NetworkRequestMetricBuilderTest method testSetHttpResponseCode.
@Test
public void testSetHttpResponseCode() {
int code = 200;
NetworkRequestMetric metric = networkMetricBuilder.setHttpResponseCode(code).build();
assertThat(metric.getHttpResponseCode()).isEqualTo(code);
}
use of com.google.firebase.perf.v1.NetworkRequestMetric in project firebase-android-sdk by firebase.
the class NetworkRequestMetricBuilderTest method testAllNullFields.
@Test
public void testAllNullFields() {
NetworkRequestMetric metric = networkMetricBuilder.build();
assertThat(metric.hasUrl()).isFalse();
assertThat(metric.hasHttpMethod()).isFalse();
assertThat(metric.hasRequestPayloadBytes()).isFalse();
assertThat(metric.hasResponsePayloadBytes()).isFalse();
assertThat(metric.hasNetworkClientErrorReason()).isFalse();
assertThat(metric.hasHttpResponseCode()).isFalse();
assertThat(metric.hasResponseContentType()).isFalse();
assertThat(metric.hasClientStartTimeUs()).isFalse();
assertThat(metric.hasTimeToRequestCompletedUs()).isFalse();
assertThat(metric.hasTimeToResponseInitiatedUs()).isFalse();
assertThat(metric.hasTimeToResponseCompletedUs()).isFalse();
}
use of com.google.firebase.perf.v1.NetworkRequestMetric in project firebase-android-sdk by firebase.
the class NetworkRequestMetricBuilderTest method testSetUrl.
@Test
public void testSetUrl() {
String url = "www.google.com";
NetworkRequestMetric metric = networkMetricBuilder.setUrl(url).build();
assertThat(metric.getUrl()).isEqualTo(url);
}
use of com.google.firebase.perf.v1.NetworkRequestMetric in project firebase-android-sdk by firebase.
the class NetworkRequestMetricBuilderTest method testSetHttpMethod.
@Test
public void testSetHttpMethod() {
String type = "GET";
NetworkRequestMetric metric = networkMetricBuilder.setHttpMethod(type).build();
assertThat(metric.getHttpMethod()).isEqualTo(HttpMethod.GET);
type = "PUT";
NetworkRequestMetric metric1 = networkMetricBuilder.setHttpMethod(type).build();
assertThat(metric1.getHttpMethod()).isEqualTo(HttpMethod.PUT);
type = "POST";
NetworkRequestMetric metric2 = networkMetricBuilder.setHttpMethod(type).build();
assertThat(metric2.getHttpMethod()).isEqualTo(HttpMethod.POST);
type = "DELETE";
NetworkRequestMetric metric3 = networkMetricBuilder.setHttpMethod(type).build();
assertThat(metric3.getHttpMethod()).isEqualTo(HttpMethod.DELETE);
type = "POST";
NetworkRequestMetric metric4 = networkMetricBuilder.setHttpMethod(type).build();
assertThat(metric4.getHttpMethod()).isEqualTo(HttpMethod.POST);
type = "HEAD";
NetworkRequestMetric metric5 = networkMetricBuilder.setHttpMethod(type).build();
assertThat(metric5.getHttpMethod()).isEqualTo(HttpMethod.HEAD);
type = "PATCH";
NetworkRequestMetric metric6 = networkMetricBuilder.setHttpMethod(type).build();
assertThat(metric6.getHttpMethod()).isEqualTo(HttpMethod.PATCH);
type = "OPTIONS";
NetworkRequestMetric metric7 = networkMetricBuilder.setHttpMethod(type).build();
assertThat(metric7.getHttpMethod()).isEqualTo(HttpMethod.OPTIONS);
type = "TRACE";
NetworkRequestMetric metric8 = networkMetricBuilder.setHttpMethod(type).build();
assertThat(metric8.getHttpMethod()).isEqualTo(HttpMethod.TRACE);
type = "CONNECT";
NetworkRequestMetric metric9 = networkMetricBuilder.setHttpMethod(type).build();
assertThat(metric9.getHttpMethod()).isEqualTo(HttpMethod.CONNECT);
type = "UNKNOWN";
NetworkRequestMetric metric10 = networkMetricBuilder.setHttpMethod(type).build();
assertThat(metric10.getHttpMethod()).isEqualTo(HttpMethod.HTTP_METHOD_UNKNOWN);
}
use of com.google.firebase.perf.v1.NetworkRequestMetric in project firebase-android-sdk by firebase.
the class NetworkRequestMetricBuilderTest method testSetRequestStartTimeMicros.
@Test
public void testSetRequestStartTimeMicros() {
long time = 2000;
NetworkRequestMetric metric = networkMetricBuilder.setRequestStartTimeMicros(time).build();
assertThat(metric.getClientStartTimeUs()).isEqualTo(time);
}
Aggregations