Index: adblock-android-tests/src/org/adblockplus/libadblockplus/MockFilterChangeCallback.java |
diff --git a/adblock-android-tests/src/org/adblockplus/libadblockplus/MockFilterChangeCallback.java b/adblock-android-tests/src/org/adblockplus/libadblockplus/MockFilterChangeCallback.java |
index 753504785e37e3027fb32f43690b839b30aaa722..e48ec24a8aa4f558242656a5617efb971b3f7f55 100644 |
--- a/adblock-android-tests/src/org/adblockplus/libadblockplus/MockFilterChangeCallback.java |
+++ b/adblock-android-tests/src/org/adblockplus/libadblockplus/MockFilterChangeCallback.java |
@@ -19,11 +19,21 @@ package org.adblockplus.libadblockplus; |
public class MockFilterChangeCallback extends FilterChangeCallback |
{ |
- private int timesCalled; |
+ private volatile int timesCalled; |
+ private String checkAction; |
+ private String checkKey; |
+ private String checkValue; |
- public MockFilterChangeCallback(int timesCalled) |
+ public MockFilterChangeCallback(String checkAction, String checkKey, String checkValue) |
{ |
- this.timesCalled = timesCalled; |
+ this.checkAction = checkAction; |
+ this.checkKey = checkKey; |
+ this.checkValue = checkValue; |
+ } |
+ |
+ public void clearCheckValues() |
+ { |
+ checkAction = null; |
} |
public int getTimesCalled() |
@@ -34,6 +44,11 @@ public class MockFilterChangeCallback extends FilterChangeCallback |
@Override |
public void filterChangeCallback(String action, JsValue jsValue) |
{ |
+ if (checkAction != null && (!action.equals(checkAction) || |
+ !jsValue.getProperty(checkKey).asString().equals(checkValue))) |
+ { |
+ return; |
+ } |
timesCalled++; |
} |
} |