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

Delta Between Two Patch Sets: libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/LazyFileSystem.java

Issue 29347315: Issue 4231 - Fix unstable FilterEngineTest.testSetRemoveFilterChangeCallback (Closed)
Left Patch Set: Created July 7, 2016, 10:22 a.m.
Right Patch Set: made helper methods static, fixed 'remove' for fs callback Created Dec. 13, 2016, 9:32 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
LEFTRIGHT
(no file at all)
1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
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/>.
16 */
17
18 package org.adblockplus.libadblockplus.tests;
19
20 import org.adblockplus.libadblockplus.FileSystem;
21
22 public class LazyFileSystem extends FileSystem
23 {
24 private boolean patternsIniExists = true;
25
26 public boolean isPatternsIniExists()
27 {
28 return patternsIniExists;
29 }
30
31 public void setPatternsIniExists(boolean patternsIniExists)
32 {
33 this.patternsIniExists = patternsIniExists;
34 }
35
36 @Override
37 public String read(String path)
38 {
39 if (path.equals("patterns.ini"))
40 {
41 return "# Adblock Plus preferences\n[Subscription]\nurl=~fl~";
42 }
43 else if (path.equals("prefs.json"))
44 {
45 return "{}";
46 }
47 else
48 {
49 return "";
50 }
51 }
52
53 @Override
54 public void write(String path, String data)
55 {
56
57 }
58
59 @Override
60 public void move(String fromPath, String toPath)
61 {
62
63 }
64
65 @Override
66 public void remove(String path)
67 {
68
69 }
70
71 @Override
72 public StatResult stat(String path)
73 {
74 return path.equals("patterns.ini")
75 ? new StatResult(patternsIniExists, false, true, 0)
76 : new StatResult(false, false, false, 0);
77 }
78
79 @Override
80 public String resolve(String path)
81 {
82 return path;
83 }
84 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld