Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/FilterEngineTest.java

Issue 29435570: Issue 5205 - Add Subscription.isDisabled() (Closed)
Patch Set: Created May 10, 2017, 8:15 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/FilterEngineTest.java
diff --git a/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/FilterEngineTest.java b/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/FilterEngineTest.java
index d78d9c0d68dcabca428b35d774942ad1f296ebe2..289e292728de506e959d50c7b801b89e2c16b45a 100644
--- a/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/FilterEngineTest.java
+++ b/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/FilterEngineTest.java
@@ -425,4 +425,63 @@ public class FilterEngineTest extends FilterEngineGenericTest
}
fail("AA subscription not found in listed subscriptions when enabled");
}
+
+ @Test
+ public void testSubscriptionsAreNotDisabled()
+ {
+ if (!filterEngine.isAcceptableAdsEnabled())
+ {
+ filterEngine.setAcceptableAdsEnabled(true);
+ }
+ assertTrue(filterEngine.isAcceptableAdsEnabled());
+
+ List<Subscription> listedSubscriptions = filterEngine.getListedSubscriptions();
+ for (Subscription eachSubscription : listedSubscriptions)
+ {
+ assertFalse(eachSubscription.isDisabled());
+ }
+ }
+
+ @Test
+ public void testSubscriptionsSetDisabled()
+ {
+ List<Subscription> listedSubscriptions = filterEngine.getListedSubscriptions();
+ Subscription subscription = listedSubscriptions.get(0);
+ boolean originalDisabled = subscription.isDisabled();
+
+ subscription.setDisabled(!originalDisabled);
+ assertEquals(!originalDisabled, subscription.isDisabled());
+
+ subscription.setDisabled(originalDisabled);
+ assertEquals(originalDisabled, subscription.isDisabled());
+ }
+
+ @Test
+ public void testDisableEnableAcceptableAdsSubscription()
+ {
+ if (filterEngine.isAcceptableAdsEnabled())
+ {
+ filterEngine.setAcceptableAdsEnabled(false);
+ }
+ assertFalse(filterEngine.isAcceptableAdsEnabled());
+
+ List<Subscription> listedSubscriptions = filterEngine.getListedSubscriptions();
+ for (Subscription eachSubscription : listedSubscriptions)
+ {
+ if (eachSubscription.isAcceptableAds())
+ {
+ assertTrue(eachSubscription.isDisabled());
+ }
+ }
+
+ filterEngine.setAcceptableAdsEnabled(true);
+ listedSubscriptions = filterEngine.getListedSubscriptions();
+ for (Subscription eachSubscription : listedSubscriptions)
+ {
+ if (eachSubscription.isAcceptableAds())
+ {
+ assertFalse(eachSubscription.isDisabled());
+ }
+ }
+ }
}

Powered by Google App Engine
This is Rietveld