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: removed casting Created May 22, 2017, 11:33 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
« no previous file with comments | « no previous file | libadblockplus-android-webview/src/org/adblockplus/libadblockplus/android/webview/AdblockWebView.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
+ }
+ }
+ }
}
« no previous file with comments | « no previous file | libadblockplus-android-webview/src/org/adblockplus/libadblockplus/android/webview/AdblockWebView.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld