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

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

Issue 29347315: Issue 4231 - Fix unstable FilterEngineTest.testSetRemoveFilterChangeCallback (Closed)
Patch Set: Introduced file system abstraction to java and using LazyFileSystem for filter tests Created July 10, 2016, 10:47 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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 @Override
25 public String read(String path)
26 {
27 if (path.equals("patterns.ini"))
28 return "# Adblock Plus preferences\n[Subscription]\nurl=~fl~";
29 else if (path.equals("prefs.json"))
30 return "{}";
31 else
32 return "";
33 }
34
35 @Override
36 public void write(String path, String data)
37 {
38
39 }
40
41 @Override
42 public void move(String fromPath, String toPath)
43 {
44
45 }
46
47 @Override
48 public void remove(String path)
49 {
50
51 }
52
53 @Override
54 public StatResult stat(String path)
55 {
56 return path.equals("patterns.ini")
57 ? new StatResult(true, false, true, 0)
58 : new StatResult(false, false, false, 0);
59 }
60
61 @Override
62 public String resolve(String path)
63 {
64 return path;
65 }
66 }
OLDNEW

Powered by Google App Engine
This is Rietveld