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..965e8c3123e4985b0819b4fff448d269f236e973 100644 |
--- a/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/AndroidWebRequestTest.java |
+++ b/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/AndroidWebRequestTest.java |
@@ -17,12 +17,16 @@ |
package org.adblockplus.libadblockplus.tests; |
-import org.adblockplus.android.AndroidWebRequest; |
+import org.adblockplus.libadblockplus.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.util.List; |
+ |
public class AndroidWebRequestTest extends BaseJsTest |
{ |
@Override |
@@ -30,7 +34,7 @@ public class AndroidWebRequestTest extends BaseJsTest |
{ |
super.setUp(); |
- jsEngine.setWebRequest(new AndroidWebRequest()); |
+ jsEngine.setWebRequest(new AndroidWebRequest(true)); |
} |
@Test |
@@ -40,7 +44,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 +112,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); |
+ } |
} |