Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1d39e34e authored by Soonil Nagarkar's avatar Soonil Nagarkar
Browse files

Remove obsolete Settings unit tests

Bug: 140250974
Test: atest SettingsProviderTest
Change-Id: Id5f0e87d822be8b72693d6a24d32fbc714064b46
parent 1527beb3
Loading
Loading
Loading
Loading
+0 −122
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import android.os.UserHandle;
import android.provider.Settings;
import android.util.Log;

import org.junit.Ignore;
import org.junit.Test;

import java.util.concurrent.atomic.AtomicBoolean;
@@ -692,125 +691,4 @@ public class SettingsProviderTest extends BaseSettingsProviderTest {
            cursor.close();
        }
    }

    @Test
    @Ignore("b/140250974")
    public void testLocationModeChanges_viaFrontEndApi() throws Exception {
        setStringViaFrontEndApiSetting(
                SETTING_TYPE_SECURE,
                Settings.Secure.LOCATION_MODE,
                String.valueOf(Settings.Secure.LOCATION_MODE_OFF),
                UserHandle.USER_SYSTEM);
        assertEquals(
                "Wrong location providers",
                "",
                getStringViaFrontEndApiSetting(
                        SETTING_TYPE_SECURE,
                        Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
                        UserHandle.USER_SYSTEM));

        setStringViaFrontEndApiSetting(
                SETTING_TYPE_SECURE,
                Settings.Secure.LOCATION_MODE,
                String.valueOf(Settings.Secure.LOCATION_MODE_BATTERY_SAVING),
                UserHandle.USER_SYSTEM);
        assertEquals(
                "Wrong location providers",
                "network",
                getStringViaFrontEndApiSetting(
                        SETTING_TYPE_SECURE,
                        Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
                        UserHandle.USER_SYSTEM));

        setStringViaFrontEndApiSetting(
                SETTING_TYPE_SECURE,
                Settings.Secure.LOCATION_MODE,
                String.valueOf(Settings.Secure.LOCATION_MODE_HIGH_ACCURACY),
                UserHandle.USER_SYSTEM);
        assertEquals(
                "Wrong location providers",
                "gps,network",
                getStringViaFrontEndApiSetting(
                        SETTING_TYPE_SECURE,
                        Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
                        UserHandle.USER_SYSTEM));
    }

    @Test
    @Ignore("b/140250974")
    public void testLocationProvidersAllowed_disableProviders() throws Exception {
        setStringViaFrontEndApiSetting(
                SETTING_TYPE_SECURE,
                Settings.Secure.LOCATION_MODE,
                String.valueOf(Settings.Secure.LOCATION_MODE_HIGH_ACCURACY),
                UserHandle.USER_SYSTEM);

        // Disable providers that were enabled
        updateStringViaProviderApiSetting(
                SETTING_TYPE_SECURE,
                Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
                "-gps,-network");
        assertEquals(
                "Wrong location providers",
                "",
                queryStringViaProviderApi(
                        SETTING_TYPE_SECURE, Settings.Secure.LOCATION_PROVIDERS_ALLOWED));

        // Disable a provider that was not enabled
        updateStringViaProviderApiSetting(
                SETTING_TYPE_SECURE,
                Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
                "-test");
        assertEquals(
                "Wrong location providers",
                "",
                queryStringViaProviderApi(
                        SETTING_TYPE_SECURE, Settings.Secure.LOCATION_PROVIDERS_ALLOWED));
    }

    @Test
    @Ignore("b/140250974")
    public void testLocationProvidersAllowed_enableAndDisable() throws Exception {
        setStringViaFrontEndApiSetting(
                SETTING_TYPE_SECURE,
                Settings.Secure.LOCATION_MODE,
                String.valueOf(Settings.Secure.LOCATION_MODE_OFF),
                UserHandle.USER_SYSTEM);

        updateStringViaProviderApiSetting(
                SETTING_TYPE_SECURE,
                Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
                "+gps,+network,+test");
        updateStringViaProviderApiSetting(
                SETTING_TYPE_SECURE, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "-test");

        assertEquals(
                "Wrong location providers",
                "gps,network",
                queryStringViaProviderApi(
                        SETTING_TYPE_SECURE, Settings.Secure.LOCATION_PROVIDERS_ALLOWED));
    }

    @Test
    @Ignore("b/140250974")
    public void testLocationProvidersAllowedLocked_invalidInput() throws Exception {
        setStringViaFrontEndApiSetting(
                SETTING_TYPE_SECURE,
                Settings.Secure.LOCATION_MODE,
                String.valueOf(Settings.Secure.LOCATION_MODE_OFF),
                UserHandle.USER_SYSTEM);

        // update providers with a invalid string
        updateStringViaProviderApiSetting(
                SETTING_TYPE_SECURE,
                Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
                "+gps, invalid-string");

        // Verifies providers list does not change
        assertEquals(
                "Wrong location providers",
                "",
                queryStringViaProviderApi(
                        SETTING_TYPE_SECURE, Settings.Secure.LOCATION_PROVIDERS_ALLOWED));
    }
}