PackageVerificationStateTestpublic class PackageVerificationStateTest extends android.test.AndroidTestCase
Fields Summary |
---|
private static final int | REQUIRED_UID | private static final int | SUFFICIENT_UID_1 | private static final int | SUFFICIENT_UID_2 |
Methods Summary |
---|
public void | testPackageVerificationState_OnlyRequiredVerifier_AllowedInstall()
PackageVerificationState state = new PackageVerificationState(REQUIRED_UID, null);
assertFalse("Verification should not be marked as complete yet",
state.isVerificationComplete());
state.setVerifierResponse(REQUIRED_UID, PackageManager.VERIFICATION_ALLOW);
assertTrue("Verification should be considered complete now",
state.isVerificationComplete());
assertTrue("Installation should be marked as allowed",
state.isInstallAllowed());
| public void | testPackageVerificationState_OnlyRequiredVerifier_DeniedInstall()
PackageVerificationState state = new PackageVerificationState(REQUIRED_UID, null);
assertFalse("Verification should not be marked as complete yet",
state.isVerificationComplete());
state.setVerifierResponse(REQUIRED_UID, PackageManager.VERIFICATION_REJECT);
assertTrue("Verification should be considered complete now",
state.isVerificationComplete());
assertFalse("Installation should be marked as allowed",
state.isInstallAllowed());
| public void | testPackageVerificationState_RequiredAndOneSufficient_RequiredDeniedInstall()
PackageVerificationState state = new PackageVerificationState(REQUIRED_UID, null);
assertFalse("Verification should not be marked as complete yet",
state.isVerificationComplete());
state.addSufficientVerifier(SUFFICIENT_UID_1);
assertFalse("Verification should not be marked as complete yet",
state.isVerificationComplete());
state.setVerifierResponse(SUFFICIENT_UID_1, PackageManager.VERIFICATION_ALLOW);
assertFalse("Verification should not be marked as complete yet",
state.isVerificationComplete());
state.setVerifierResponse(REQUIRED_UID, PackageManager.VERIFICATION_REJECT);
assertTrue("Verification should be considered complete now",
state.isVerificationComplete());
assertFalse("Installation should be marked as allowed",
state.isInstallAllowed());
| public void | testPackageVerificationState_RequiredAndOneSufficient_SufficientDeniedInstall()
PackageVerificationState state = new PackageVerificationState(REQUIRED_UID, null);
assertFalse("Verification should not be marked as complete yet",
state.isVerificationComplete());
state.addSufficientVerifier(SUFFICIENT_UID_1);
assertFalse("Verification should not be marked as complete yet",
state.isVerificationComplete());
state.setVerifierResponse(SUFFICIENT_UID_1, PackageManager.VERIFICATION_REJECT);
assertFalse("Verification should not be marked as complete yet",
state.isVerificationComplete());
state.setVerifierResponse(REQUIRED_UID, PackageManager.VERIFICATION_ALLOW);
assertTrue("Verification should be considered complete now",
state.isVerificationComplete());
assertFalse("Installation should be marked as allowed",
state.isInstallAllowed());
| public void | testPackageVerificationState_RequiredAndTwoSufficient_OneSufficientIsEnough()
PackageVerificationState state = new PackageVerificationState(REQUIRED_UID, null);
assertFalse("Verification should not be marked as complete yet",
state.isVerificationComplete());
state.addSufficientVerifier(SUFFICIENT_UID_1);
state.addSufficientVerifier(SUFFICIENT_UID_2);
assertFalse("Verification should not be marked as complete yet",
state.isVerificationComplete());
state.setVerifierResponse(SUFFICIENT_UID_1, PackageManager.VERIFICATION_ALLOW);
assertFalse("Verification should not be marked as complete yet",
state.isVerificationComplete());
state.setVerifierResponse(REQUIRED_UID, PackageManager.VERIFICATION_ALLOW);
assertTrue("Verification should be considered complete now",
state.isVerificationComplete());
assertTrue("Installation should be marked as allowed",
state.isInstallAllowed());
| public void | testPackageVerificationState_RequiredAndTwoSufficient_RequiredOverrides()
PackageVerificationState state = new PackageVerificationState(REQUIRED_UID, null);
assertFalse("Verification should not be marked as complete yet",
state.isVerificationComplete());
state.addSufficientVerifier(SUFFICIENT_UID_1);
state.addSufficientVerifier(SUFFICIENT_UID_2);
assertFalse("Verification should not be marked as complete yet",
state.isVerificationComplete());
state.setVerifierResponse(REQUIRED_UID,
PackageManager.VERIFICATION_ALLOW_WITHOUT_SUFFICIENT);
assertTrue("Verification should be marked as complete immediately",
state.isVerificationComplete());
assertTrue("Installation should be marked as allowed",
state.isInstallAllowed());
state.setVerifierResponse(SUFFICIENT_UID_1, PackageManager.VERIFICATION_REJECT);
assertTrue("Verification should still be marked as completed",
state.isVerificationComplete());
assertTrue("Installation should be marked as allowed still",
state.isInstallAllowed());
state.setVerifierResponse(SUFFICIENT_UID_2, PackageManager.VERIFICATION_ALLOW);
assertTrue("Verification should still be complete",
state.isVerificationComplete());
assertTrue("Installation should be marked as allowed still",
state.isInstallAllowed());
| public void | testPackageVerificationState_RequiredAndTwoSufficient_SecondSufficientIsEnough()
PackageVerificationState state = new PackageVerificationState(REQUIRED_UID, null);
assertFalse("Verification should not be marked as complete yet",
state.isVerificationComplete());
state.addSufficientVerifier(SUFFICIENT_UID_1);
state.addSufficientVerifier(SUFFICIENT_UID_2);
assertFalse("Verification should not be marked as complete yet",
state.isVerificationComplete());
state.setVerifierResponse(REQUIRED_UID, PackageManager.VERIFICATION_ALLOW);
assertFalse("Verification should not be marked as complete yet",
state.isVerificationComplete());
state.setVerifierResponse(SUFFICIENT_UID_1, PackageManager.VERIFICATION_REJECT);
assertFalse("Verification should not be marked as complete yet",
state.isVerificationComplete());
state.setVerifierResponse(SUFFICIENT_UID_2, PackageManager.VERIFICATION_ALLOW);
assertTrue("Verification should be considered complete now",
state.isVerificationComplete());
assertTrue("Installation should be marked as allowed",
state.isInstallAllowed());
|
|