diff options
| author | 2015-12-02 15:35:28 +0000 | |
|---|---|---|
| committer | 2015-12-02 15:35:28 +0000 | |
| commit | 66623fb21892971fa4964d8824f5e6fc90a06cbf (patch) | |
| tree | ce43cb7060d907772c1be01e18c3a27446034e17 | |
| parent | 6c2ce9afc91725038f25760b70b9dd42b866762e (diff) | |
| parent | c4d372f6ffb0866af5d457be99011c3c23bdfa26 (diff) | |
Merge "Fix getKeySetByAlias PackageMgr test."
| -rw-r--r-- | core/tests/coretests/apks/keyset/api_test/AndroidManifest.xml | 7 | ||||
| -rw-r--r-- | core/tests/coretests/src/android/content/pm/PackageManagerTests.java | 12 |
2 files changed, 14 insertions, 5 deletions
diff --git a/core/tests/coretests/apks/keyset/api_test/AndroidManifest.xml b/core/tests/coretests/apks/keyset/api_test/AndroidManifest.xml index 4c7e968c2722..2897bd5d0b55 100644 --- a/core/tests/coretests/apks/keyset/api_test/AndroidManifest.xml +++ b/core/tests/coretests/apks/keyset/api_test/AndroidManifest.xml @@ -17,4 +17,11 @@ package="com.android.frameworks.coretests.keysets_api"> <application android:hasCode="false"> </application> + <key-sets> + <key-set android:name="A" > + <public-key android:name="keyA" + android:value="MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJoN1Nsgqf0V4C/bbN8wo8O2X/S5D76+5Mb9mlIsHkUTUTbHCNk+LxHIUYLm89YbP9zImrV0bUHLUAZUyoMUCiMCAwEAAQ=="/> + </key-set> + </key-sets> + </manifest> diff --git a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java index 37257f7e7292..b5f06178aa3c 100644 --- a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java +++ b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java @@ -3278,7 +3278,6 @@ public class PackageManagerTests extends AndroidTestCase { * testGetKeySetByAlias - same as getSigningKeySet, but for keysets defined * by this package. */ - @Suppress public void testGetKeySetByAlias() throws Exception { PackageManager pm = getPm(); String mPkgName = mContext.getPackageName(); @@ -3309,17 +3308,20 @@ public class PackageManagerTests extends AndroidTestCase { assertTrue(false); // should have thrown } catch(IllegalArgumentException e) { } + + // make sure we can get a KeySet from our pkg + ks = pm.getKeySetByAlias(mPkgName, "A"); + assertNotNull(ks); + + // and another final InstallParams ip = installFromRawResource("keysetApi.apk", R.raw.keyset_splat_api, 0, false, false, -1, PackageInfo.INSTALL_LOCATION_UNSPECIFIED); try { ks = pm.getKeySetByAlias(otherPkgName, "A"); - assertTrue(false); // should have thrown - } catch (SecurityException e) { + assertNotNull(ks); } finally { cleanUpInstall(ip); } - ks = pm.getKeySetByAlias(mPkgName, "A"); - assertNotNull(ks); } public void testIsSignedBy() throws Exception { |