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

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

Issue 29857561: Fix libadblockplus-android tests, Part 2
Patch Set: Created Aug. 16, 2018, 11:48 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
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++;
}
}

Powered by Google App Engine
This is Rietveld