Search in sources :

Example 6 with HttpRequestFactory

use of com.google.firebase.crashlytics.internal.network.HttpRequestFactory in project firebase-android-sdk by firebase.

the class DefaultSettingsSpiCallTest method testWebCallNoInstanceId.

public void testWebCallNoInstanceId() throws Exception {
    final SettingsRequest requestData = buildSettingsRequest(null);
    final String url = "http://localhost:3000/spi/v1/platforms/android/apps/com.crashlytics.test/settings";
    final InspectableHttpGetRequest request = new InspectableHttpGetRequest();
    final DefaultSettingsSpiCall call = new DefaultSettingsSpiCall(url, new HttpRequestFactory() {

        @Override
        public HttpGetRequest buildHttpGetRequest(String url, Map<String, String> queryParams) {
            request.setUrl(url);
            request.setQueryParams(queryParams);
            return request;
        }
    });
    assertNotNull(call.invoke(requestData, true));
    assertEquals(url, request.getUrl());
    final Map<?, ?> queryParams = request.getQueryParams();
    assertEquals(BUILD_VERSION, queryParams.get(DefaultSettingsSpiCall.BUILD_VERSION_PARAM));
    assertEquals(DISPLAY_VERSION, queryParams.get(DefaultSettingsSpiCall.DISPLAY_VERSION_PARAM));
    assertFalse(queryParams.containsKey(DefaultSettingsSpiCall.INSTANCE_PARAM));
    assertEquals(Integer.toString(SOURCE), queryParams.get(DefaultSettingsSpiCall.SOURCE_PARAM));
    final Map<String, String> headers = request.getHeaders();
    assertEquals(GOOGLE_APP_ID, headers.get(DefaultSettingsSpiCall.HEADER_GOOGLE_APP_ID));
    assertEquals(DefaultSettingsSpiCall.ANDROID_CLIENT_TYPE, headers.get(DefaultSettingsSpiCall.HEADER_CLIENT_TYPE));
    assertEquals(DEVICE_MODEL, headers.get(DefaultSettingsSpiCall.HEADER_DEVICE_MODEL));
    assertEquals(OS_BUILD_VERSION, headers.get(DefaultSettingsSpiCall.HEADER_OS_BUILD_VERSION));
    assertEquals(OS_DISPLAY_VERSION, headers.get(DefaultSettingsSpiCall.HEADER_OS_DISPLAY_VERSION));
    assertEquals(INSTALLATION_ID, headers.get(DefaultSettingsSpiCall.HEADER_INSTALLATION_ID));
    assertEquals(DefaultSettingsSpiCall.ACCEPT_JSON_VALUE, headers.get(DefaultSettingsSpiCall.HEADER_ACCEPT));
}
Also used : HttpRequestFactory(com.google.firebase.crashlytics.internal.network.HttpRequestFactory) SettingsRequest(com.google.firebase.crashlytics.internal.settings.model.SettingsRequest) InspectableHttpGetRequest(com.google.firebase.crashlytics.internal.network.InspectableHttpGetRequest) HttpGetRequest(com.google.firebase.crashlytics.internal.network.HttpGetRequest) InspectableHttpGetRequest(com.google.firebase.crashlytics.internal.network.InspectableHttpGetRequest)

Aggregations

HttpRequestFactory (com.google.firebase.crashlytics.internal.network.HttpRequestFactory)6 HttpGetRequest (com.google.firebase.crashlytics.internal.network.HttpGetRequest)4 InspectableHttpGetRequest (com.google.firebase.crashlytics.internal.network.InspectableHttpGetRequest)4 FileStore (com.google.firebase.crashlytics.internal.persistence.FileStore)2 SettingsRequest (com.google.firebase.crashlytics.internal.settings.model.SettingsRequest)2 Context (android.content.Context)1 PackageManager (android.content.pm.PackageManager)1 Nullable (androidx.annotation.Nullable)1 CrashlyticsNativeComponentDeferredProxy (com.google.firebase.crashlytics.internal.CrashlyticsNativeComponentDeferredProxy)1 DevelopmentPlatformProvider (com.google.firebase.crashlytics.internal.DevelopmentPlatformProvider)1 Logger (com.google.firebase.crashlytics.internal.Logger)1 AnalyticsConnectorReceiver (com.google.firebase.crashlytics.internal.analytics.AnalyticsConnectorReceiver)1 AnalyticsReceiver (com.google.firebase.crashlytics.internal.analytics.AnalyticsReceiver)1 AppData (com.google.firebase.crashlytics.internal.common.AppData)1 CrashlyticsCore (com.google.firebase.crashlytics.internal.common.CrashlyticsCore)1 DataCollectionArbiter (com.google.firebase.crashlytics.internal.common.DataCollectionArbiter)1 IdManager (com.google.firebase.crashlytics.internal.common.IdManager)1 FileStoreImpl (com.google.firebase.crashlytics.internal.persistence.FileStoreImpl)1 SettingsController (com.google.firebase.crashlytics.internal.settings.SettingsController)1 ResourceUnityVersionProvider (com.google.firebase.crashlytics.internal.unity.ResourceUnityVersionProvider)1