diff options
author | rich cannings <richc@google.com> | 2012-09-13 13:43:07 -0700 |
---|---|---|
committer | rich cannings <richc@google.com> | 2012-09-14 14:25:52 -0700 |
commit | 13d428e8306d1bb1a3017045bc5d2f76edec32df (patch) | |
tree | 8e576f447aec8cf0361c3c1e3e23ad3f3f5c7b36 /core/tests/coretests | |
parent | a87826c345dbd692a86a340691cf7471a2505809 (diff) | |
download | frameworks_base-13d428e8306d1bb1a3017045bc5d2f76edec32df.zip frameworks_base-13d428e8306d1bb1a3017045bc5d2f76edec32df.tar.gz frameworks_base-13d428e8306d1bb1a3017045bc5d2f76edec32df.tar.bz2 |
Send more information to verifiers
Send package name, version code and the uid of the application requesting the
install to package verifiers.
Bug: 7164155
Change-Id: I2464dc5d4551f60b4f38f7982495a8920c83e1cd
Diffstat (limited to 'core/tests/coretests')
-rw-r--r-- | core/tests/coretests/src/android/content/pm/VerificationParamsTest.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/core/tests/coretests/src/android/content/pm/VerificationParamsTest.java b/core/tests/coretests/src/android/content/pm/VerificationParamsTest.java index b814e2d..105bcba 100644 --- a/core/tests/coretests/src/android/content/pm/VerificationParamsTest.java +++ b/core/tests/coretests/src/android/content/pm/VerificationParamsTest.java @@ -34,6 +34,7 @@ public class VerificationParamsTest extends AndroidTestCase { private final static String ORIGINATING_URI_STRING = "http://originating.uri/path"; private final static String REFERRER_STRING = "http://referrer.uri/path"; private final static byte[] DIGEST_BYTES = "fake digest".getBytes(); + private final static int INSTALLER_UID = 42; private final static Uri VERIFICATION_URI = Uri.parse(VERIFICATION_URI_STRING); private final static Uri ORIGINATING_URI = Uri.parse(ORIGINATING_URI_STRING); @@ -115,6 +116,18 @@ public class VerificationParamsTest extends AndroidTestCase { assertFalse(params1.equals(params2)); } + public void testEquals_InstallerUid_Failure() throws Exception { + VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI, + REFERRER, MANIFEST_DIGEST); + + VerificationParams params2 = new VerificationParams( + Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING), + Uri.parse(REFERRER_STRING), new ManifestDigest(DIGEST_BYTES)); + params2.setInstallerUid(INSTALLER_UID); + + assertFalse(params1.equals(params2)); + } + public void testHashCode_Success() throws Exception { VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI, REFERRER, MANIFEST_DIGEST); @@ -168,4 +181,16 @@ public class VerificationParamsTest extends AndroidTestCase { assertFalse(params1.hashCode() == params2.hashCode()); } + + public void testHashCode_InstallerUid_Failure() throws Exception { + VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI, + REFERRER, MANIFEST_DIGEST); + + VerificationParams params2 = new VerificationParams( + Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING), + Uri.parse(REFERRER_STRING), new ManifestDigest("a different digest".getBytes())); + params2.setInstallerUid(INSTALLER_UID); + + assertFalse(params1.hashCode() == params2.hashCode()); + } } |