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

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

Issue 29405564: Issue 5121 - Use Acceptable Ads API in libadblockplus (Closed)
Patch Set: minor cleanup suggestions by Serge Created May 4, 2017, 6:17 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 | « dependencies ('k') | libadblockplus-android/jni/JniFilterEngine.cpp » ('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 23952b6201679804d9b05910abbd033db0817edf..a7136778e703e7a29f172eebd154eb725b5a3fb7 100644
--- a/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/FilterEngineTest.java
+++ b/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/FilterEngineTest.java
@@ -17,7 +17,6 @@
package org.adblockplus.libadblockplus.tests;
-import android.util.Log;
import org.adblockplus.libadblockplus.Filter;
import org.adblockplus.libadblockplus.FilterEngine;
import org.adblockplus.libadblockplus.MockFilterChangeCallback;
@@ -25,6 +24,8 @@ import org.adblockplus.libadblockplus.Subscription;
import org.junit.Test;
+import java.util.List;
+
public class FilterEngineTest extends FilterEngineGenericTest
{
@Test
@@ -385,4 +386,43 @@ public class FilterEngineTest extends FilterEngineGenericTest
assertTrue(filterEngine.isElemhideWhitelisted("http://example.com", documentUrls1));
assertFalse(filterEngine.isElemhideWhitelisted("http://example.co.uk", documentUrls1));
}
+
+ @Test
+ public void testGetAcceptableAdsSubscriptionUrl()
+ {
+ String url = filterEngine.getAcceptableAdsSubscriptionURL();
+ assertNotNull(url);
+ }
+
+ @Test
+ public void testSetGetAcceptableAds()
+ {
+ boolean isAA = filterEngine.isAcceptableAdsEnabled();
+ isAA = !isAA;
+ filterEngine.setAcceptableAdsEnabled(isAA);
+ assertEquals(isAA, filterEngine.isAcceptableAdsEnabled());
+ isAA = !isAA;
+ filterEngine.setAcceptableAdsEnabled(isAA);
+ assertEquals(isAA, filterEngine.isAcceptableAdsEnabled());
+ }
+
+ @Test
+ public void testIsAcceptableAdsIfEnabled()
+ {
+ if (!filterEngine.isAcceptableAdsEnabled())
+ {
+ filterEngine.setAcceptableAdsEnabled(true);
+ }
+ assertTrue(filterEngine.isAcceptableAdsEnabled());
+
+ List<Subscription> listedSubscriptions = filterEngine.getListedSubscriptions();
+ for (Subscription eachSubscription : listedSubscriptions)
+ {
+ if (eachSubscription.isAcceptableAds())
+ {
+ return;
+ }
+ }
+ fail("AA subscription not found in listed subscriptions when enabled");
+ }
}
« no previous file with comments | « dependencies ('k') | libadblockplus-android/jni/JniFilterEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld