aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRoman Birg <roman@cyngn.com>2015-12-18 09:37:00 -0800
committerRoman Birg <roman@cyngn.com>2015-12-21 10:30:15 -0800
commitcb4a990216b9e0960a6c927651eba8649f8d9619 (patch)
treeeed8e6f238926fa316ea8b60699168620af55262 /tests
parentc81519d31be8a2adac3d51f2656bcb1708919e57 (diff)
downloadvendor_cmsdk-cb4a990216b9e0960a6c927651eba8649f8d9619.zip
vendor_cmsdk-cb4a990216b9e0960a6c927651eba8649f8d9619.tar.gz
vendor_cmsdk-cb4a990216b9e0960a6c927651eba8649f8d9619.tar.bz2
Profiles: add isEnabled(); send state changes
Ref: CYNGNOS-1461 Change-Id: Idee9417a2f0b181c8d15cd763859c0a0e581dce6 Signed-off-by: Roman Birg <roman@cyngn.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/src/org/cyanogenmod/tests/profiles/unit/ProfileManagerTest.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/src/org/cyanogenmod/tests/profiles/unit/ProfileManagerTest.java b/tests/src/org/cyanogenmod/tests/profiles/unit/ProfileManagerTest.java
index 1f3f05a..37338b0 100644
--- a/tests/src/org/cyanogenmod/tests/profiles/unit/ProfileManagerTest.java
+++ b/tests/src/org/cyanogenmod/tests/profiles/unit/ProfileManagerTest.java
@@ -20,6 +20,7 @@ import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
import cyanogenmod.app.ProfileManager;
import cyanogenmod.app.IProfileManager;
+import cyanogenmod.providers.CMSettings;
/**
* Created by adnan on 7/15/15.
@@ -43,4 +44,30 @@ public class ProfileManagerTest extends AndroidTestCase {
IProfileManager iProfileManager = mProfileManager.getService();
assertNotNull(iProfileManager);
}
+
+ @SmallTest
+ public void testManagerProfileIsEnabled() {
+ // first enable profiles
+ final String enabledValue = "1";
+ assertTrue(CMSettings.System.putString(getContext().getContentResolver(),
+ CMSettings.System.SYSTEM_PROFILES_ENABLED, enabledValue));
+
+ // check that we successfully enabled them via system setting
+ assertEquals(enabledValue, CMSettings.System.getString(getContext().getContentResolver(),
+ CMSettings.System.SYSTEM_PROFILES_ENABLED));
+
+ // check that profile manger returns true
+ assertTrue(mProfileManager.isProfilesEnabled());
+
+ // now disable the setting
+ final String disabledValue = "0";
+ assertTrue(CMSettings.System.putString(getContext().getContentResolver(),
+ CMSettings.System.SYSTEM_PROFILES_ENABLED, disabledValue));
+
+ // check that we successfully disable them via system setting
+ assertEquals(disabledValue, CMSettings.System.getString(getContext().getContentResolver(),
+ CMSettings.System.SYSTEM_PROFILES_ENABLED));
+
+ assertFalse(mProfileManager.isProfilesEnabled());
+ }
}