PiracyChecker
PiracyChecker copied to clipboard
AndroidTest UnauthorizedAppTest: Fails due to PiracyCheckerError enum return value not PIRATE_APP_INSTALLED but BLOCK_PIRATE_APP.
- [ x] I have verified there are no duplicate active or recent bugs, questions, or requests.
- [ x] I have verified that I am using the latest version of PiracyChecker.
- [ x] I have given my issue a non-generic title.
- [ x] I have read over the documentation (before asking questions on how to do something).
Details
- PiracyChecker version:
1.2.3 - Device OS version:
emulator - Device Manufacturer:
N/A - Device Name:
Nexus 5
Reproduction Steps
As says UnauthorizedAppTest: /**
-
- Specific test cases for unauthorized apps. Requires to install an unauthorized app before running this tests. */
- install apk for unauthorized app (i.e. Lucky patch 7.4.2)
- Run test
- Test fails with message "PiracyChecker FAILED : PiracyCheckError is not At least one pirate app has been detected and the app must be reinstalled when all unauthorized apps are uninstalled.."
Possible Solution :
@Test
public void verifyUnauthorizedApps_DONTALLOW() throws Throwable {
final CountDownLatch signal = new CountDownLatch(1);
uiThreadTestRule.runOnUiThread(new Runnable() {
@Override
public void run() {
new PiracyChecker(InstrumentationRegistry.getTargetContext())
.enableUnauthorizedAppsCheck(true)
.blockIfUnauthorizedAppUninstalled("piracychecker_preferences", "app_unauthorized")
.callback(new PiracyCheckerCallback() {
@Override
public void allow() {
assertTrue("PiracyChecker FAILED: There is an unauthorized app installed.", false);
signal.countDown();
}
@Override
public void dontAllow(@NonNull PiracyCheckerError error, @Nullable PirateApp app) {
if (error == PiracyCheckerError.PIRATE_APP_INSTALLED
|| error == PiracyCheckerError.BLOCK_PIRATE_APP) {
...
so add || error == PiracyCheckerError.BLOCK_PIRATE_APP.
NB : same probably holds true for verifyUnauthorizedCustomApp_DONTALLOW test method, but that test doesn't fail.
what is password for sampleunauthorizedapp.zip ?