diff options
author | Roman Birg <roman@cyngn.com> | 2015-07-28 00:37:33 -0700 |
---|---|---|
committer | Adnan Begovic <adnan@cyngn.com> | 2015-07-31 14:09:33 -0700 |
commit | e84d6568ab8198f65489a672a1995eacd2dd94a7 (patch) | |
tree | d5a36ad3fdaaa2a7a4989a8933759dd166e30211 /tests/src/org | |
parent | bd5230afe0995625936901a189811bc8f5cceb80 (diff) | |
download | vendor_cmsdk-e84d6568ab8198f65489a672a1995eacd2dd94a7.zip vendor_cmsdk-e84d6568ab8198f65489a672a1995eacd2dd94a7.tar.gz vendor_cmsdk-e84d6568ab8198f65489a672a1995eacd2dd94a7.tar.bz2 |
Profiles: add LockModeSettings
Splits out the lockmode into its own LockSettings, primarly so it has its
own processOverride() - so it will respect the LockMode.DEFAULT setting.
Ref: CYNGNOS-620
Change-Id: I6183492facebed37133e84d45a6bb2f91f76d5ea
Signed-off-by: Roman Birg <roman@cyngn.com>
Signed-off-by: Adnan Begovic <adnan@cyngn.com>
Diffstat (limited to 'tests/src/org')
-rw-r--r-- | tests/src/org/cyanogenmod/tests/profiles/ProfileTest.java | 7 | ||||
-rw-r--r-- | tests/src/org/cyanogenmod/tests/profiles/unit/ProfileTest.java | 26 |
2 files changed, 28 insertions, 5 deletions
diff --git a/tests/src/org/cyanogenmod/tests/profiles/ProfileTest.java b/tests/src/org/cyanogenmod/tests/profiles/ProfileTest.java index 29e7f2f..0d8d038 100644 --- a/tests/src/org/cyanogenmod/tests/profiles/ProfileTest.java +++ b/tests/src/org/cyanogenmod/tests/profiles/ProfileTest.java @@ -26,6 +26,7 @@ import cyanogenmod.app.ProfileManager; import cyanogenmod.profiles.AirplaneModeSettings; import cyanogenmod.profiles.BrightnessSettings; import cyanogenmod.profiles.ConnectionSettings; +import cyanogenmod.profiles.LockSettings; import cyanogenmod.profiles.RingModeSettings; import cyanogenmod.profiles.StreamSettings; import org.cyanogenmod.tests.TestActivity; @@ -64,7 +65,7 @@ public class ProfileTest extends TestActivity { profile.setProfileType(Type.TOGGLE); profile.setExpandedDesktopMode(Profile.ExpandedDesktopMode.ENABLE); profile.setDozeMode(Profile.DozeMode.DEFAULT); - profile.setScreenLockMode(Profile.LockMode.DISABLE); + profile.setScreenLockMode(new LockSettings(Profile.LockMode.DISABLE)); mProfileUuidList.add(profile.getUuid()); mProfileManager.addProfile(profile); } @@ -76,7 +77,7 @@ public class ProfileTest extends TestActivity { profile.setProfileType(Type.TOGGLE); profile.setExpandedDesktopMode(Profile.ExpandedDesktopMode.ENABLE); profile.setDozeMode(Profile.DozeMode.DEFAULT); - profile.setScreenLockMode(Profile.LockMode.DISABLE); + profile.setScreenLockMode(new LockSettings(Profile.LockMode.DISABLE)); mProfileUuidList.add(profile.getUuid()); mProfileManager.addProfile(profile); mProfileManager.setActiveProfile(profile.getUuid()); @@ -94,7 +95,7 @@ public class ProfileTest extends TestActivity { profile.setProfileType(Type.TOGGLE); profile.setExpandedDesktopMode(Profile.ExpandedDesktopMode.ENABLE); profile.setDozeMode(Profile.DozeMode.DEFAULT); - profile.setScreenLockMode(Profile.LockMode.DISABLE); + profile.setScreenLockMode(new LockSettings(Profile.LockMode.DISABLE)); mProfileUuidList.add(profile.getUuid()); mProfileManager.addProfile(profile); mProfileManager.setActiveProfile(profile.getUuid()); diff --git a/tests/src/org/cyanogenmod/tests/profiles/unit/ProfileTest.java b/tests/src/org/cyanogenmod/tests/profiles/unit/ProfileTest.java index 4639c4a..f48b805 100644 --- a/tests/src/org/cyanogenmod/tests/profiles/unit/ProfileTest.java +++ b/tests/src/org/cyanogenmod/tests/profiles/unit/ProfileTest.java @@ -27,6 +27,7 @@ import cyanogenmod.app.Profile; import cyanogenmod.profiles.AirplaneModeSettings; import cyanogenmod.profiles.BrightnessSettings; import cyanogenmod.profiles.ConnectionSettings; +import cyanogenmod.profiles.LockSettings; import cyanogenmod.profiles.RingModeSettings; import cyanogenmod.profiles.StreamSettings; @@ -177,10 +178,32 @@ public class ProfileTest extends AndroidTestCase { } @MediumTest + public void testProfileLockSettingsUnravelFromParcel() { + Profile profile = new Profile("Lock Profile"); + LockSettings expectedLockSettings = new LockSettings(Profile.LockMode.INSECURE); + profile.setScreenLockMode(expectedLockSettings); + + // Write to parcel + Parcel parcel = Parcel.obtain(); + profile.writeToParcel(parcel, 0); + + // Rewind + parcel.setDataPosition(0); + + // Verify data when unraveling + Profile fromParcel = Profile.CREATOR.createFromParcel(parcel); + + LockSettings actualLockSettings = fromParcel.getScreenLockMode(); + + assertNotNull(fromParcel); + assertEquals(expectedLockSettings.getValue(), actualLockSettings.getValue()); + assertEquals(expectedLockSettings.isDirty(), actualLockSettings.isDirty()); + } + + @MediumTest public void testProfileUnravelFromParcel() { Profile profile = new Profile("Single Profile"); profile.setProfileType(Profile.Type.TOGGLE); - profile.setScreenLockMode(Profile.LockMode.DISABLE); profile.setDozeMode(Profile.DozeMode.ENABLE); profile.setStatusBarIndicator(true); @@ -197,7 +220,6 @@ public class ProfileTest extends AndroidTestCase { assertNotNull(fromParcel); assertEquals(profile.getName(), fromParcel.getName()); assertEquals(profile.getProfileType(), fromParcel.getProfileType()); - assertEquals(profile.getScreenLockMode(), fromParcel.getScreenLockMode()); assertEquals(profile.getDozeMode(), fromParcel.getDozeMode()); assertEquals(profile.getStatusBarIndicator(), fromParcel.getStatusBarIndicator()); } |