Search in sources :

Example 6 with FetchedAppSettings

use of com.facebook.internal.FetchedAppSettings in project facebook-android-sdk by facebook.

the class AutomaticAnalyticsTest method testAutomaticLoggingEnabledServerConfiguration.

@Test
public void testAutomaticLoggingEnabledServerConfiguration() throws Exception {
    JSONObject settingsJSON = new JSONObject();
    settingsJSON.put("app_events_feature_bitmask", "0");
    FetchedAppSettings settings = Whitebox.invokeMethod(FetchedAppSettingsManager.class, "parseAppSettingsFromJSON", "123", settingsJSON);
    assertEquals(settings.getAutomaticLoggingEnabled(), false);
    settingsJSON.put("app_events_feature_bitmask", "7");
    settings = Whitebox.invokeMethod(FetchedAppSettingsManager.class, "parseAppSettingsFromJSON", "123", settingsJSON);
    assertEquals(settings.getAutomaticLoggingEnabled(), false);
    settingsJSON.put("app_events_feature_bitmask", "23");
    settings = Whitebox.invokeMethod(FetchedAppSettingsManager.class, "parseAppSettingsFromJSON", "123", settingsJSON);
    assertEquals(settings.getAutomaticLoggingEnabled(), false);
    settingsJSON.put("app_events_feature_bitmask", "8");
    settings = Whitebox.invokeMethod(FetchedAppSettingsManager.class, "parseAppSettingsFromJSON", "123", settingsJSON);
    assertEquals(settings.getAutomaticLoggingEnabled(), true);
    settingsJSON.put("app_events_feature_bitmask", "9");
    settings = Whitebox.invokeMethod(FetchedAppSettingsManager.class, "parseAppSettingsFromJSON", "123", settingsJSON);
    assertEquals(settings.getAutomaticLoggingEnabled(), true);
    JSONObject noBitmaskFieldSettings = new JSONObject();
    settings = Whitebox.invokeMethod(FetchedAppSettingsManager.class, "parseAppSettingsFromJSON", "123", noBitmaskFieldSettings);
    assertEquals(settings.getAutomaticLoggingEnabled(), false);
}
Also used : FetchedAppSettings(com.facebook.internal.FetchedAppSettings) JSONObject(org.json.JSONObject) FetchedAppSettingsManager(com.facebook.internal.FetchedAppSettingsManager) Test(org.junit.Test)

Aggregations

FetchedAppSettings (com.facebook.internal.FetchedAppSettings)6 Bundle (android.os.Bundle)2 Context (android.content.Context)1 GraphRequest (com.facebook.GraphRequest)1 GraphResponse (com.facebook.GraphResponse)1 AppEventsLogger (com.facebook.appevents.AppEventsLogger)1 FacebookRequestErrorClassification (com.facebook.internal.FacebookRequestErrorClassification)1 FetchedAppSettingsManager (com.facebook.internal.FetchedAppSettingsManager)1 JSONObject (org.json.JSONObject)1 Test (org.junit.Test)1