Index: libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/LazyFileSystem.java |
diff --git a/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/LazyFileSystem.java b/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/LazyFileSystem.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6c08cde725e9ad8a1c7fbf472901de566df1261b |
--- /dev/null |
+++ b/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/LazyFileSystem.java |
@@ -0,0 +1,84 @@ |
+/* |
+ * This file is part of Adblock Plus <https://adblockplus.org/>, |
+ * Copyright (C) 2006-2016 Eyeo GmbH |
+ * |
+ * Adblock Plus is free software: you can redistribute it and/or modify |
+ * it under the terms of the GNU General Public License version 3 as |
+ * published by the Free Software Foundation. |
+ * |
+ * Adblock Plus is distributed in the hope that it will be useful, |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ * GNU General Public License for more details. |
+ * |
+ * You should have received a copy of the GNU General Public License |
+ * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
+ */ |
+ |
+package org.adblockplus.libadblockplus.tests; |
+ |
+import org.adblockplus.libadblockplus.FileSystem; |
+ |
+public class LazyFileSystem extends FileSystem |
+{ |
+ 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 StatResult stat(String path) |
+ { |
+ return path.equals("patterns.ini") |
+ ? new StatResult(patternsIniExists, false, true, 0) |
+ : new StatResult(false, false, false, 0); |
+ } |
+ |
+ @Override |
+ public String resolve(String path) |
+ { |
+ return path; |
+ } |
+} |