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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 |
(...skipping 22 matching lines...) Expand all Loading... |
33 }; | 33 }; |
34 | 34 |
35 class ThrowingFileSystem : public AdblockPlus::FileSystem | 35 class ThrowingFileSystem : public AdblockPlus::FileSystem |
36 { | 36 { |
37 public: | 37 public: |
38 std::shared_ptr<std::istream> Read(const std::string& path) const | 38 std::shared_ptr<std::istream> Read(const std::string& path) const |
39 { | 39 { |
40 throw std::runtime_error("Not implemented"); | 40 throw std::runtime_error("Not implemented"); |
41 } | 41 } |
42 | 42 |
43 void Write(const std::string& path, std::shared_ptr<std::istream> content) | 43 void Write(const std::string& path, const std::shared_ptr<std::istream>& conte
nt) |
44 { | 44 { |
45 throw std::runtime_error("Not implemented"); | 45 throw std::runtime_error("Not implemented"); |
46 } | 46 } |
47 | 47 |
48 void Move(const std::string& fromPath, const std::string& toPath) | 48 void Move(const std::string& fromPath, const std::string& toPath) |
49 { | 49 { |
50 throw std::runtime_error("Not implemented"); | 50 throw std::runtime_error("Not implemented"); |
51 } | 51 } |
52 | 52 |
53 void Remove(const std::string& path) | 53 void Remove(const std::string& path) |
(...skipping 28 matching lines...) Expand all Loading... |
82 std::shared_ptr<std::istream> Read(const std::string& path) const | 82 std::shared_ptr<std::istream> Read(const std::string& path) const |
83 { | 83 { |
84 std::string dummyData(""); | 84 std::string dummyData(""); |
85 if (path == "patterns.ini") | 85 if (path == "patterns.ini") |
86 dummyData = "# Adblock Plus preferences\n[Subscription]\nurl=~fl~"; | 86 dummyData = "# Adblock Plus preferences\n[Subscription]\nurl=~fl~"; |
87 else if (path == "prefs.json") | 87 else if (path == "prefs.json") |
88 dummyData = "{}"; | 88 dummyData = "{}"; |
89 return std::shared_ptr<std::istream>(new std::istringstream(dummyData)); | 89 return std::shared_ptr<std::istream>(new std::istringstream(dummyData)); |
90 } | 90 } |
91 | 91 |
92 void Write(const std::string& path, std::shared_ptr<std::istream> content) | 92 void Write(const std::string& path, const std::shared_ptr<std::istream>& conte
nt) |
93 { | 93 { |
94 } | 94 } |
95 | 95 |
96 void Move(const std::string& fromPath, const std::string& toPath) | 96 void Move(const std::string& fromPath, const std::string& toPath) |
97 { | 97 { |
98 } | 98 } |
99 | 99 |
100 void Remove(const std::string& path) | 100 void Remove(const std::string& path) |
101 { | 101 { |
102 } | 102 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 virtual void SetUp() | 148 virtual void SetUp() |
149 { | 149 { |
150 jsEngine = CreateJsEngine(); | 150 jsEngine = CreateJsEngine(); |
151 jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr(new ThrowingLogSystem)); | 151 jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr(new ThrowingLogSystem)); |
152 jsEngine->SetFileSystem(AdblockPlus::FileSystemPtr(new ThrowingFileSystem)); | 152 jsEngine->SetFileSystem(AdblockPlus::FileSystemPtr(new ThrowingFileSystem)); |
153 jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr(new ThrowingWebRequest)); | 153 jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr(new ThrowingWebRequest)); |
154 } | 154 } |
155 }; | 155 }; |
156 | 156 |
157 #endif | 157 #endif |
OLD | NEW |