| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 Eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 package org.adblockplus.libadblockplus.tests; | 18 package org.adblockplus.libadblockplus.tests; |
| 19 | 19 |
| 20 import org.adblockplus.libadblockplus.FileSystem; | 20 import org.adblockplus.libadblockplus.FileSystem; |
| 21 | 21 |
| 22 public class LazyFileSystem extends FileSystem | 22 public class LazyFileSystem extends FileSystem |
| 23 { | 23 { |
| 24 private boolean patternsIniExists = true; | |
|
René Jeschke
2016/07/12 16:00:42
Is there a point in making this flag modifiable _a
anton
2016/07/13 06:41:13
It's unknown if we need to change it after creatio
| |
| 25 | |
| 26 public boolean isPatternsIniExists() | |
| 27 { | |
| 28 return patternsIniExists; | |
| 29 } | |
| 30 | |
| 31 public void setPatternsIniExists(boolean patternsIniExists) | |
| 32 { | |
| 33 this.patternsIniExists = patternsIniExists; | |
| 34 } | |
| 35 | |
| 24 @Override | 36 @Override |
| 25 public String read(String path) | 37 public String read(String path) |
| 26 { | 38 { |
| 27 if (path.equals("patterns.ini")) | 39 if (path.equals("patterns.ini")) |
| 28 return "# Adblock Plus preferences\n[Subscription]\nurl=~fl~"; | 40 return "# Adblock Plus preferences\n[Subscription]\nurl=~fl~"; |
| 29 else if (path.equals("prefs.json")) | 41 else if (path.equals("prefs.json")) |
| 30 return "{}"; | 42 return "{}"; |
| 31 else | 43 else |
| 32 return ""; | 44 return ""; |
| 33 } | 45 } |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 47 @Override | 59 @Override |
| 48 public void remove(String path) | 60 public void remove(String path) |
| 49 { | 61 { |
| 50 | 62 |
| 51 } | 63 } |
| 52 | 64 |
| 53 @Override | 65 @Override |
| 54 public StatResult stat(String path) | 66 public StatResult stat(String path) |
| 55 { | 67 { |
| 56 return path.equals("patterns.ini") | 68 return path.equals("patterns.ini") |
| 57 ? new StatResult(true, false, true, 0) | 69 ? new StatResult(patternsIniExists, false, true, 0) |
| 58 : new StatResult(false, false, false, 0); | 70 : new StatResult(false, false, false, 0); |
| 59 } | 71 } |
| 60 | 72 |
| 61 @Override | 73 @Override |
| 62 public String resolve(String path) | 74 public String resolve(String path) |
| 63 { | 75 { |
| 64 return path; | 76 return path; |
| 65 } | 77 } |
| 66 } | 78 } |
| OLD | NEW |