diff options
author | Sam Mortimer <sam@mortimer.me.uk> | 2019-09-19 16:33:47 -0700 |
---|---|---|
committer | Sam Mortimer <sam@mortimer.me.uk> | 2019-09-20 16:44:37 -0700 |
commit | 3d25e8b3f777d53da8ad92bd0dc97b1d24747b77 (patch) | |
tree | 8abcede1f403d9345869ae2c3892fed1bccdcccc /packages/LineageSettingsProvider/tests/src | |
parent | 7e03d078bc4577defc09f48f20f411ca82291e5e (diff) | |
download | lineage-sdk-3d25e8b3f777d53da8ad92bd0dc97b1d24747b77.tar.gz lineage-sdk-3d25e8b3f777d53da8ad92bd0dc97b1d24747b77.tar.bz2 lineage-sdk-3d25e8b3f777d53da8ad92bd0dc97b1d24747b77.zip |
lineage-sdk: Fix LineageSettingsProvider tests
* Fix bp and manifest to work with AndroidJUnitRunner.
* Remove broken tests (we no longer intercept in fw/b
settings provider and QS_USE_MAIN_TILES was removed).
* Tests pass when executed using:
adb shell am instrument org.lineageos.lineagesettings.tests/androidx.test.runner.AndroidJUnitRunner
(see README.md for more info)
Change-Id: I3fcf4885c61106f43e99847293220afee78e2f6a
Diffstat (limited to 'packages/LineageSettingsProvider/tests/src')
5 files changed, 7 insertions, 45 deletions
diff --git a/packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsGlobalTests.java b/packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsGlobalTests.java index 619580bb..ed559dae 100644 --- a/packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsGlobalTests.java +++ b/packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsGlobalTests.java @@ -20,6 +20,7 @@ import android.content.ContentResolver; import android.net.Uri; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; + import lineageos.providers.LineageSettings; public class LineageSettingsGlobalTests extends AndroidTestCase { diff --git a/packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsProviderDefaultsTest.java b/packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsProviderDefaultsTest.java index 89234865..c92ff692 100644 --- a/packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsProviderDefaultsTest.java +++ b/packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsProviderDefaultsTest.java @@ -23,15 +23,15 @@ import android.content.res.Resources; import android.os.UserHandle; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; - -import java.util.ArrayList; - import android.text.TextUtils; import android.util.TypedValue; + import lineageos.providers.LineageSettings; import org.lineageos.lineagesettings.LineageDatabaseHelper; import org.lineageos.lineagesettings.LineageSettingsProvider; +import java.util.ArrayList; + /** * Created by adnan on 1/25/16. */ @@ -88,9 +88,6 @@ public class LineageSettingsProviderDefaultsTest extends AndroidTestCase { LineageSettings.Secure.ADVANCED_MODE, "R.bool.def_advanced_mode")); SECURE_SETTINGS_DEFAULTS.add(new Setting( - LineageSettings.Secure.QS_USE_MAIN_TILES, - "R.bool.def_sysui_qs_main_tiles")); - SECURE_SETTINGS_DEFAULTS.add(new Setting( LineageSettings.Secure.STATS_COLLECTION, "R.bool.def_stats_collection")); SECURE_SETTINGS_DEFAULTS.add(new Setting( diff --git a/packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsProviderTest.java b/packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsProviderTest.java index 9205de14..3eb5d935 100644 --- a/packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsProviderTest.java +++ b/packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsProviderTest.java @@ -29,6 +29,7 @@ import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.MediumTest; import android.test.suitebuilder.annotation.SmallTest; import android.text.TextUtils; + import lineageos.providers.LineageSettings; import java.util.LinkedHashMap; @@ -76,45 +77,6 @@ import java.util.Map; testMigrateSettingsForUser(mGuest.id); } - /** - * make sure that queries to SettingsProvider are forwarded to LineageSettingsProvider as needed - * See {@link lineageos.providers.LineageSettings.System#shouldInterceptSystemProvider(String)} - * - * Currently this test only checks that - * {@link lineageos.providers.LineageSettings.System#SYSTEM_PROFILES_ENABLED} is expected to - * be forwarded, and is forwarded. - */ - @SmallTest - public void testSettingsProviderKeyForwarding() { - String forwardedKey = LineageSettings.System.SYSTEM_PROFILES_ENABLED; - - // make sure the key should be forwarded - assertTrue(LineageSettings.System.shouldInterceptSystemProvider(forwardedKey)); - - // put value 1 into Settings provider: - // let's try to disable the profiles via the Settings provider - Settings.System.putStringForUser(mContentResolver, - forwardedKey, "0", UserHandle.USER_CURRENT); - - // assert this is what we just put in there - assertEquals("0", Settings.System.getStringForUser(getContext().getContentResolver(), - forwardedKey, UserHandle.USER_CURRENT)); - - // put value 2 into LineageSettings provider - LineageSettings.System.putStringForUser(mContentResolver, - forwardedKey, "1", UserHandle.USER_CURRENT); - - assertEquals("1", LineageSettings.System.getStringForUser(getContext().getContentResolver(), - forwardedKey, UserHandle.USER_CURRENT)); - - // assert reading from both returns value 2 - final String lineageProviderValue = LineageSettings.System.getStringForUser( - getContext().getContentResolver(), forwardedKey, UserHandle.USER_CURRENT); - final String settingsProviderValue = Settings.System.getStringForUser( - getContext().getContentResolver(), forwardedKey, UserHandle.USER_CURRENT); - assertEquals(lineageProviderValue, settingsProviderValue); - } - private void testMigrateSettingsForUser(int userId) { // Setup values in Settings /*final String expectedPullDownValue = "testQuickPullDownValue"; diff --git a/packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsSecureTests.java b/packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsSecureTests.java index b27accad..4ac470f5 100644 --- a/packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsSecureTests.java +++ b/packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsSecureTests.java @@ -20,6 +20,7 @@ import android.content.ContentResolver; import android.net.Uri; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; + import lineageos.providers.LineageSettings; public class LineageSettingsSecureTests extends AndroidTestCase { diff --git a/packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsSystemTests.java b/packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsSystemTests.java index 101a60f4..6d940be1 100644 --- a/packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsSystemTests.java +++ b/packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsSystemTests.java @@ -20,6 +20,7 @@ import android.content.ContentResolver; import android.net.Uri; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; + import lineageos.providers.LineageSettings; public class LineageSettingsSystemTests extends AndroidTestCase { |