Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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, | 43 void Write(const std::string& path, std::shared_ptr<std::istream> content) |
44 std::shared_ptr<std::istream> content) | |
Felix Dahlke
2015/08/05 21:28:05
Nit: This was wrapped because it didn't fit in 80
sergei
2015/08/06 07:35:30
Done.
| |
45 { | 44 { |
46 throw std::runtime_error("Not implemented"); | 45 throw std::runtime_error("Not implemented"); |
47 } | 46 } |
48 | 47 |
49 void Move(const std::string& fromPath, const std::string& toPath) | 48 void Move(const std::string& fromPath, const std::string& toPath) |
50 { | 49 { |
51 throw std::runtime_error("Not implemented"); | 50 throw std::runtime_error("Not implemented"); |
52 } | 51 } |
53 | 52 |
54 void Remove(const std::string& path) | 53 void Remove(const std::string& path) |
(...skipping 28 matching lines...) Expand all Loading... | |
83 std::shared_ptr<std::istream> Read(const std::string& path) const | 82 std::shared_ptr<std::istream> Read(const std::string& path) const |
84 { | 83 { |
85 std::string dummyData(""); | 84 std::string dummyData(""); |
86 if (path == "patterns.ini") | 85 if (path == "patterns.ini") |
87 dummyData = "# Adblock Plus preferences\n[Subscription]\nurl=~fl~"; | 86 dummyData = "# Adblock Plus preferences\n[Subscription]\nurl=~fl~"; |
88 else if (path == "prefs.json") | 87 else if (path == "prefs.json") |
89 dummyData = "{}"; | 88 dummyData = "{}"; |
90 return std::shared_ptr<std::istream>(new std::istringstream(dummyData)); | 89 return std::shared_ptr<std::istream>(new std::istringstream(dummyData)); |
91 } | 90 } |
92 | 91 |
93 void Write(const std::string& path, | 92 void Write(const std::string& path, std::shared_ptr<std::istream> content) |
94 std::shared_ptr<std::istream> content) | |
Felix Dahlke
2015/08/05 21:28:05
Nit: This was wrapped because it didn't fit in 80
sergei
2015/08/06 07:35:30
Done.
| |
95 { | 93 { |
96 } | 94 } |
97 | 95 |
98 void Move(const std::string& fromPath, const std::string& toPath) | 96 void Move(const std::string& fromPath, const std::string& toPath) |
99 { | 97 { |
100 } | 98 } |
101 | 99 |
102 void Remove(const std::string& path) | 100 void Remove(const std::string& path) |
103 { | 101 { |
104 } | 102 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
148 virtual void SetUp() | 146 virtual void SetUp() |
149 { | 147 { |
150 jsEngine = AdblockPlus::JsEngine::New(); | 148 jsEngine = AdblockPlus::JsEngine::New(); |
151 jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr(new ThrowingLogSystem)); | 149 jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr(new ThrowingLogSystem)); |
152 jsEngine->SetFileSystem(AdblockPlus::FileSystemPtr(new ThrowingFileSystem)); | 150 jsEngine->SetFileSystem(AdblockPlus::FileSystemPtr(new ThrowingFileSystem)); |
153 jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr(new ThrowingWebRequest)); | 151 jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr(new ThrowingWebRequest)); |
154 } | 152 } |
155 }; | 153 }; |
156 | 154 |
157 #endif | 155 #endif |
LEFT | RIGHT |