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

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

Issue 29347315: Issue 4231 - Fix unstable FilterEngineTest.testSetRemoveFilterChangeCallback (Closed)
Patch Set: patchset 2 + patchset 3 + applied Eyeo's codestyle Created Aug. 8, 2016, 8:09 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: 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;
+ }
+}

Powered by Google App Engine
This is Rietveld