Merge "Remove obsolete Settings unit tests"

This commit is contained in:
TreeHugger Robot
2020-02-06 02:40:02 +00:00
committed by Android (Google) Code Review

View File

@@ -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));
}
}