diff options
| author | Andrew Stadler <stadler@android.com> | 2010-02-05 11:10:39 -0800 |
|---|---|---|
| committer | Andrew Stadler <stadler@android.com> | 2010-02-05 11:10:39 -0800 |
| commit | 3d2b3b3b3554be2ac23d9a49fee00faa9693e857 (patch) | |
| tree | 3663c873ba36cfa9846071267fa84be45847a921 /tests | |
| parent | 4d2a701844a3dee6828a360abe633ba5393566e9 (diff) | |
| download | android_packages_apps_Email-3d2b3b3b3554be2ac23d9a49fee00faa9693e857.tar.gz android_packages_apps_Email-3d2b3b3b3554be2ac23d9a49fee00faa9693e857.tar.bz2 android_packages_apps_Email-3d2b3b3b3554be2ac23d9a49fee00faa9693e857.zip | |
Logic to move phone into security-admin mode
* Create notification to display when syncs fail due to security
* Create psuedo-activity (no UI) to manage device admin state transitions
* Clean up and flesh out SecurityPolicy APIs'
* Add placeholders in EasSyncService showing how to react when policies
are not met and sync cannot continue.
Note: There are some STOPSHIP todo's at the top of SecurityPolicy.java.
These should explain any code that you might think is "missing".
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/src/com/android/email/SecurityPolicyTests.java | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/tests/src/com/android/email/SecurityPolicyTests.java b/tests/src/com/android/email/SecurityPolicyTests.java index a7c6f2586..fc841ca68 100644 --- a/tests/src/com/android/email/SecurityPolicyTests.java +++ b/tests/src/com/android/email/SecurityPolicyTests.java @@ -107,13 +107,20 @@ public class SecurityPolicyTests extends ProviderTestCase2<EmailProvider> { assertTrue(EMPTY_POLICY_SET.equals(sp.computeAggregatePolicy())); // with a single account in security mode, should return same security as in account - PolicySet p3in = new PolicySet(10, PolicySet.PASSWORD_MODE_SIMPLE, 15, 16, false); + // first test with partially-populated policies Account a3 = ProviderTestUtils.setupAccount("sec-3", false, mMockContext); - p3in.writeAccount(a3, null); - a3.save(mMockContext); - PolicySet p3out = sp.computeAggregatePolicy(); - assertNotNull(p3out); - assertEquals(p3in, p3out); + PolicySet p3ain = new PolicySet(10, PolicySet.PASSWORD_MODE_SIMPLE, 0, 0, false); + p3ain.writeAccount(a3, null, true, mMockContext); + PolicySet p3aout = sp.computeAggregatePolicy(); + assertNotNull(p3aout); + assertEquals(p3ain, p3aout); + + // Repeat that test with fully-populated policies + PolicySet p3bin = new PolicySet(10, PolicySet.PASSWORD_MODE_SIMPLE, 15, 16, false); + p3bin.writeAccount(a3, null, true, mMockContext); + PolicySet p3bout = sp.computeAggregatePolicy(); + assertNotNull(p3bout); + assertEquals(p3bin, p3bout); // add another account which mixes it up (some fields will change, others will not) // pw length and pw mode - max logic - will change because larger #s here @@ -121,8 +128,7 @@ public class SecurityPolicyTests extends ProviderTestCase2<EmailProvider> { // wipe required - OR logic - will *not* change here because false PolicySet p4in = new PolicySet(20, PolicySet.PASSWORD_MODE_STRONG, 25, 26, false); Account a4 = ProviderTestUtils.setupAccount("sec-4", false, mMockContext); - p4in.writeAccount(a4, null); - a4.save(mMockContext); + p4in.writeAccount(a4, null, true, mMockContext); PolicySet p4out = sp.computeAggregatePolicy(); assertNotNull(p4out); assertEquals(20, p4out.mMinPasswordLength); @@ -137,8 +143,7 @@ public class SecurityPolicyTests extends ProviderTestCase2<EmailProvider> { // wipe required - OR logic - will change here because true PolicySet p5in = new PolicySet(4, PolicySet.PASSWORD_MODE_NONE, 5, 6, true); Account a5 = ProviderTestUtils.setupAccount("sec-5", false, mMockContext); - p5in.writeAccount(a5, null); - a5.save(mMockContext); + p5in.writeAccount(a5, null, true, mMockContext); PolicySet p5out = sp.computeAggregatePolicy(); assertNotNull(p5out); assertEquals(20, p5out.mMinPasswordLength); @@ -217,7 +222,7 @@ public class SecurityPolicyTests extends ProviderTestCase2<EmailProvider> { PolicySet p1 = new PolicySet(1, PolicySet.PASSWORD_MODE_STRONG, 3, 4, true); Account a = new Account(); final String SYNC_KEY = "test_sync_key"; - p1.writeAccount(a, SYNC_KEY); + p1.writeAccount(a, SYNC_KEY, false, null); PolicySet p2 = new PolicySet(a); assertEquals(p1, p2); } |
