| Index: libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/FilterEngineGenericTest.java |
| diff --git a/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/FilterEngineGenericTest.java b/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/FilterEngineGenericTest.java |
| index 92a098f916017356fff71803647749eab2eefed4..e18d62760ba33e0f180f3851edf8e9dcbcdf43f1 100644 |
| --- a/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/FilterEngineGenericTest.java |
| +++ b/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/FilterEngineGenericTest.java |
| @@ -17,6 +17,7 @@ |
| package org.adblockplus.libadblockplus.tests; |
| +import org.adblockplus.libadblockplus.FileSystem; |
| import org.adblockplus.libadblockplus.FilterEngine; |
| import org.adblockplus.libadblockplus.LazyWebRequest; |
| @@ -24,6 +25,72 @@ public abstract class FilterEngineGenericTest extends BaseJsTest |
| { |
| protected FilterEngine filterEngine; |
| + private static final class PatternsIniStubFileSystem extends FileSystem |
| + { |
| + private static final String PATTERNS_INI = "patterns.ini"; |
| + |
| + private boolean patternsIniExists = true; |
| + |
| + public boolean isPatternsIniExists() |
| + { |
| + return patternsIniExists; |
| + } |
| + |
| + public void setPatternsIniExists(boolean patternsIniExists) |
| + { |
| + this.patternsIniExists = patternsIniExists; |
| + } |
| + |
| + @Override |
| + public String read(String path) |
| + { |
| + if (path.equals(PATTERNS_INI)) |
| + { |
| + return "# Adblock Plus preferences\n[Subscription]\nurl=~fl~"; |
| + } |
| + else if (path.equals("prefs.json")) |
| + { |
| + return "{}"; |
| + } |
| + else |
| + { |
| + return ""; |
| + } |
| + } |
| + |
| + @Override |
| + public void write(String path, String data) |
| + { |
| + |
| + } |
| + |
| + @Override |
| + public void move(String fromPath, String toPath) |
| + { |
| + |
| + } |
| + |
| + @Override |
| + public void remove(String path) |
| + { |
| + |
| + } |
| + |
| + @Override |
| + public FileSystem.StatResult stat(String path) |
| + { |
| + return path.equals(PATTERNS_INI) |
| + ? new FileSystem.StatResult(patternsIniExists, false, true, 0) |
| + : new FileSystem.StatResult(false, false, false, 0); |
| + } |
| + |
| + @Override |
| + public String resolve(String path) |
| + { |
| + return path; |
| + } |
| + } |
| + |
| @Override |
| protected void setUp() throws Exception |
| { |
| @@ -31,6 +98,7 @@ public abstract class FilterEngineGenericTest extends BaseJsTest |
| jsEngine.setWebRequest(new LazyWebRequest()); |
| jsEngine.setDefaultLogSystem(); |
| + jsEngine.setFileSystem(new PatternsIniStubFileSystem()); |
|
sergei
2017/05/22 12:09:06
Just for reference, I would expect that the propos
anton
2017/05/22 13:04:37
Acknowledged.
|
| filterEngine = new FilterEngine(jsEngine); |
| } |