Index: libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/AndroidWebRequestTest.java |
diff --git a/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/AndroidWebRequestTest.java b/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/AndroidWebRequestTest.java |
index 428268dfff62741f46ce14470614dd74b81aef7c..55859f0e3b5807d0234d0ab47b457c376df28778 100644 |
--- a/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/AndroidWebRequestTest.java |
+++ b/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/AndroidWebRequestTest.java |
@@ -18,11 +18,16 @@ |
package org.adblockplus.libadblockplus.tests; |
import org.adblockplus.android.AndroidWebRequest; |
+import org.adblockplus.libadblockplus.FilterEngine; |
import org.adblockplus.libadblockplus.JsValue; |
import org.adblockplus.libadblockplus.ServerResponse; |
import org.junit.Test; |
+import java.net.MalformedURLException; |
+import java.net.URL; |
+import java.util.List; |
+ |
public class AndroidWebRequestTest extends BaseJsTest |
{ |
@Override |
@@ -30,7 +35,7 @@ public class AndroidWebRequestTest extends BaseJsTest |
{ |
super.setUp(); |
- jsEngine.setWebRequest(new AndroidWebRequest()); |
+ jsEngine.setWebRequest(new AndroidWebRequest(true)); |
} |
@Test |
@@ -40,7 +45,7 @@ public class AndroidWebRequestTest extends BaseJsTest |
// should get the actual filter list back. |
jsEngine.evaluate( |
"_webRequest.GET('https://easylist-downloads.adblockplus.org/easylist.txt', {}, " + |
- "function(result) {foo = result;} )"); |
+ "function(result) {foo = result;} )"); |
do |
{ |
try |
@@ -108,4 +113,23 @@ public class AndroidWebRequestTest extends BaseJsTest |
jsEngine.evaluate("request.getResponseHeader('Content-Type').substr(0,10)").asString()); |
assertTrue(jsEngine.evaluate("request.getResponseHeader('Location')").isNull()); |
} |
+ |
+ @Test |
+ public void testGetElemhideElements() throws MalformedURLException, InterruptedException { |
+ FilterEngine filterEngine = new FilterEngine(jsEngine); |
+ |
+ Thread.sleep(20 * 1000); // wait for the subscription to be downloaded |
+ |
+ final String url = "www.mobile01.com/somepage.html"; |
+ |
+ boolean isDocumentWhitelisted = filterEngine.isDocumentWhitelisted(url, null); |
+ assertFalse(isDocumentWhitelisted); |
+ |
+ boolean isElemhideWhitelisted = filterEngine.isElemhideWhitelisted(url, null); |
+ assertFalse(isElemhideWhitelisted); |
+ |
+ List<String> selectors = filterEngine.getElementHidingSelectors(url); |
+ assertNotNull(selectors); |
+ assertTrue(selectors.size() > 0); |
+ } |
} |