diff options
| author | Matthew Williams <mjwilliams@google.com> | 2013-10-11 14:33:18 -0700 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2013-10-11 14:33:18 -0700 |
| commit | 94b518101c2b2587cb60664dde8931b11f154ec0 (patch) | |
| tree | bcb9426c5d2798982c6a9374670666de15b3bef2 /services/tests | |
| parent | 09872a35cb09fc8dbe97d443d083d6c5b0948b90 (diff) | |
| parent | e0a2bdaf61a7a72e92d614f81f86e7fd441b38e4 (diff) | |
| download | frameworks_base-94b518101c2b2587cb60664dde8931b11f154ec0.zip frameworks_base-94b518101c2b2587cb60664dde8931b11f154ec0.tar.gz frameworks_base-94b518101c2b2587cb60664dde8931b11f154ec0.tar.bz2 | |
am e0a2bdaf: am 32551ae5: Merge "Fix infinite boot-loop bug in SM." into klp-dev
* commit 'e0a2bdaf61a7a72e92d614f81f86e7fd441b38e4':
Fix infinite boot-loop bug in SM.
Diffstat (limited to 'services/tests')
| -rw-r--r-- | services/tests/servicestests/src/com/android/server/content/SyncStorageEngineTest.java | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/services/tests/servicestests/src/com/android/server/content/SyncStorageEngineTest.java b/services/tests/servicestests/src/com/android/server/content/SyncStorageEngineTest.java index e44652f..f870e4c 100644 --- a/services/tests/servicestests/src/com/android/server/content/SyncStorageEngineTest.java +++ b/services/tests/servicestests/src/com/android/server/content/SyncStorageEngineTest.java @@ -670,6 +670,61 @@ public class SyncStorageEngineTest extends AndroidTestCase { assertEquals(0, engine.getIsSyncable(account, 0, "other3")); assertEquals(1, engine.getIsSyncable(account, 0, "other4")); } + + /** + * Verify that the API cannot cause a run-time reboot by passing in the empty string as an + * authority. The problem here is that + * {@link SyncStorageEngine#getOrCreateAuthorityLocked(account, provider)} would register + * an empty authority which causes a RTE in {@link SyncManager#scheduleReadyPeriodicSyncs()}. + * This is not strictly a SSE test, but it does depend on the SSE data structures. + */ + @SmallTest + public void testExpectedIllegalArguments() throws Exception { + try { + ContentResolver.setSyncAutomatically(account1, "", true); + fail("empty provider string should throw IllegalArgumentException"); + } catch (IllegalArgumentException expected) {} + + try { + ContentResolver.addPeriodicSync(account1, "", Bundle.EMPTY, 84000L); + fail("empty provider string should throw IllegalArgumentException"); + } catch (IllegalArgumentException expected) {} + + try { + ContentResolver.removePeriodicSync(account1, "", Bundle.EMPTY); + fail("empty provider string should throw IllegalArgumentException"); + } catch (IllegalArgumentException expected) {} + + try { + ContentResolver.cancelSync(account1, ""); + fail("empty provider string should throw IllegalArgumentException"); + } catch (IllegalArgumentException expected) {} + + try { + ContentResolver.setIsSyncable(account1, "", 0); + fail("empty provider string should throw IllegalArgumentException"); + } catch (IllegalArgumentException expected) {} + + try { + ContentResolver.cancelSync(account1, ""); + fail("empty provider string should throw IllegalArgumentException"); + } catch (IllegalArgumentException expected) {} + + try { + ContentResolver.requestSync(account1, "", Bundle.EMPTY); + fail("empty provider string should throw IllegalArgumentException"); + } catch (IllegalArgumentException expected) {} + + try { + ContentResolver.getSyncStatus(account1, ""); + fail("empty provider string should throw IllegalArgumentException"); + } catch (IllegalArgumentException expected) {} + + // Make sure we aren't blocking null account/provider for those functions that use it + // to specify ALL accounts/providers. + ContentResolver.requestSync(null, null, Bundle.EMPTY); + ContentResolver.cancelSync(null, null); + } } class TestContext extends ContextWrapper { |
