VerificationParamsTestpublic class VerificationParamsTest extends android.test.AndroidTestCase Tests the android.content.pm.VerificationParams class
To test run:
./development/testrunner/runtest.py frameworks-core -c android.content.pm.VerificationParamsTest |
Fields Summary |
---|
private static final String | VERIFICATION_URI_STRING | private static final String | ORIGINATING_URI_STRING | private static final String | REFERRER_STRING | private static final byte[] | DIGEST_BYTES | private static final int | INSTALLER_UID | private static final android.net.Uri | VERIFICATION_URI | private static final android.net.Uri | ORIGINATING_URI | private static final android.net.Uri | REFERRER | private static final int | ORIGINATING_UID | private static final android.content.pm.ManifestDigest | MANIFEST_DIGEST |
Methods Summary |
---|
public void | testEquals_InstallerUid_Failure()
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
VerificationParams params2 = new VerificationParams(
Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
Uri.parse(REFERRER_STRING), ORIGINATING_UID, new ManifestDigest(DIGEST_BYTES));
params2.setInstallerUid(INSTALLER_UID);
assertFalse(params1.equals(params2));
| public void | testEquals_ManifestDigest_Failure()
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
VerificationParams params2 = new VerificationParams(
Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
Uri.parse(REFERRER_STRING), ORIGINATING_UID,
new ManifestDigest("a different digest".getBytes()));
assertFalse(params1.equals(params2));
| public void | testEquals_OriginatingUri_Failure()
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
VerificationParams params2 = new VerificationParams(
Uri.parse(VERIFICATION_URI_STRING), Uri.parse("http://a.different.uri/"),
Uri.parse(REFERRER_STRING), ORIGINATING_UID, new ManifestDigest(DIGEST_BYTES));
assertFalse(params1.equals(params2));
| public void | testEquals_Originating_Uid_Failure()
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
VerificationParams params2 = new VerificationParams(
Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
Uri.parse(REFERRER_STRING), 12345, new ManifestDigest(DIGEST_BYTES));
assertFalse(params1.equals(params2));
| public void | testEquals_Referrer_Failure()
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
VerificationParams params2 = new VerificationParams(
Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
Uri.parse("http://a.different.uri/"), ORIGINATING_UID,
new ManifestDigest(DIGEST_BYTES));
assertFalse(params1.equals(params2));
| public void | testEquals_Success()
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
VerificationParams params2 = new VerificationParams(
Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
Uri.parse(REFERRER_STRING), ORIGINATING_UID, new ManifestDigest(DIGEST_BYTES));
assertEquals(params1, params2);
| public void | testEquals_VerificationUri_Failure()
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
VerificationParams params2 = new VerificationParams(
Uri.parse("http://a.different.uri/"), Uri.parse(ORIGINATING_URI_STRING),
Uri.parse(REFERRER_STRING), ORIGINATING_UID, new ManifestDigest(DIGEST_BYTES));
assertFalse(params1.equals(params2));
| public void | testHashCode_InstallerUid_Failure()
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
VerificationParams params2 = new VerificationParams(
Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
Uri.parse(REFERRER_STRING), ORIGINATING_UID,
new ManifestDigest("a different digest".getBytes()));
params2.setInstallerUid(INSTALLER_UID);
assertFalse(params1.hashCode() == params2.hashCode());
| public void | testHashCode_ManifestDigest_Failure()
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
VerificationParams params2 = new VerificationParams(
Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
Uri.parse(REFERRER_STRING), ORIGINATING_UID,
new ManifestDigest("a different digest".getBytes()));
assertFalse(params1.hashCode() == params2.hashCode());
| public void | testHashCode_OriginatingUri_Failure()
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
VerificationParams params2 = new VerificationParams(
Uri.parse(VERIFICATION_URI_STRING), Uri.parse("http://a.different.uri/"),
Uri.parse(REFERRER_STRING), ORIGINATING_UID, new ManifestDigest(DIGEST_BYTES));
assertFalse(params1.hashCode() == params2.hashCode());
| public void | testHashCode_Originating_Uid_Failure()
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
VerificationParams params2 = new VerificationParams(
Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
Uri.parse(REFERRER_STRING), 12345, new ManifestDigest(DIGEST_BYTES));
assertFalse(params1.hashCode() == params2.hashCode());
| public void | testHashCode_Referrer_Failure()
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
VerificationParams params2 = new VerificationParams(
Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING), null,
ORIGINATING_UID, new ManifestDigest(DIGEST_BYTES));
assertFalse(params1.hashCode() == params2.hashCode());
| public void | testHashCode_Success()
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
VerificationParams params2 = new VerificationParams(
Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
Uri.parse(REFERRER_STRING), ORIGINATING_UID, new ManifestDigest(DIGEST_BYTES));
assertEquals(params1.hashCode(), params2.hashCode());
| public void | testHashCode_VerificationUri_Failure()
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
VerificationParams params2 = new VerificationParams(null, Uri.parse(ORIGINATING_URI_STRING),
Uri.parse(REFERRER_STRING), ORIGINATING_UID, new ManifestDigest(DIGEST_BYTES));
assertFalse(params1.hashCode() == params2.hashCode());
| public void | testParcel()
VerificationParams expected = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
Parcel parcel = Parcel.obtain();
expected.writeToParcel(parcel, 0);
parcel.setDataPosition(0);
VerificationParams actual = VerificationParams.CREATOR.createFromParcel(parcel);
assertEquals(VERIFICATION_URI, actual.getVerificationURI());
assertEquals(ORIGINATING_URI, actual.getOriginatingURI());
assertEquals(REFERRER, actual.getReferrer());
assertEquals(ORIGINATING_UID, actual.getOriginatingUid());
assertEquals(MANIFEST_DIGEST, actual.getManifestDigest());
|
|