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: fix for firstRun test Created July 12, 2016, 1:05 p.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:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
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; 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 25
26 public boolean isPatternsIniExists() 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"))
27 { 40 {
28 return patternsIniExists; 41 return "# Adblock Plus preferences\n[Subscription]\nurl=~fl~";
29 } 42 }
43 else if (path.equals("prefs.json"))
44 {
45 return "{}";
46 }
47 else
48 {
49 return "";
50 }
51 }
30 52
31 public void setPatternsIniExists(boolean patternsIniExists) 53 @Override
32 { 54 public void write(String path, String data)
33 this.patternsIniExists = patternsIniExists; 55 {
34 }
35 56
36 @Override 57 }
37 public String read(String path)
38 {
39 if (path.equals("patterns.ini"))
40 return "# Adblock Plus preferences\n[Subscription]\nurl=~fl~";
41 else if (path.equals("prefs.json"))
42 return "{}";
43 else
44 return "";
45 }
46 58
47 @Override 59 @Override
48 public void write(String path, String data) 60 public void move(String fromPath, String toPath)
49 { 61 {
50 62
51 } 63 }
52 64
53 @Override 65 @Override
54 public void move(String fromPath, String toPath) 66 public void remove(String path)
55 { 67 {
56 68
57 } 69 }
58 70
59 @Override 71 @Override
60 public void remove(String path) 72 public StatResult stat(String path)
61 { 73 {
74 return path.equals("patterns.ini")
75 ? new StatResult(patternsIniExists, false, true, 0)
76 : new StatResult(false, false, false, 0);
77 }
62 78
63 } 79 @Override
64 80 public String resolve(String path)
65 @Override 81 {
66 public StatResult stat(String path) 82 return path;
67 { 83 }
68 return path.equals("patterns.ini")
69 ? new StatResult(patternsIniExists, false, true, 0)
70 : new StatResult(false, false, false, 0);
71 }
72
73 @Override
74 public String resolve(String path)
75 {
76 return path;
77 }
78 } 84 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld