| Index: test/Prefs.cpp | 
| =================================================================== | 
| --- a/test/Prefs.cpp | 
| +++ b/test/Prefs.cpp | 
| @@ -24,34 +24,30 @@ | 
| namespace | 
| { | 
| typedef std::shared_ptr<AdblockPlus::FilterEngine> FilterEnginePtr; | 
| class TestFileSystem : public LazyFileSystem | 
| { | 
| public: | 
| - std::string prefsContents; | 
| + IOBuffer prefsContents; | 
| - std::shared_ptr<std::istream> Read(const std::string& path) const | 
| + IOBuffer Read(const std::string& path) const | 
| { | 
| if (path == "prefs.json" && !prefsContents.empty()) | 
| - return std::shared_ptr<std::istream>(new std::istringstream(prefsContents)); | 
| + return prefsContents; | 
| return LazyFileSystem::Read(path); | 
| } | 
| - void Write(const std::string& path, std::istream& content) | 
| + void Write(const std::string& path, const IOBuffer& content) | 
| { | 
| if (path == "prefs.json") | 
| - { | 
| - std::stringstream ss; | 
| - ss << content.rdbuf(); | 
| - prefsContents = ss.str(); | 
| - } | 
| + prefsContents = content; | 
| else | 
| LazyFileSystem::Write(path, content); | 
| } | 
| StatResult Stat(const std::string& path) const | 
| { | 
| if (path == "prefs.json") | 
| { | 
| @@ -139,25 +135,29 @@ | 
| ASSERT_EQ("filters.ini", filterEngine->GetPref("patternsfile").AsString()); | 
| ASSERT_EQ(48, filterEngine->GetPref("patternsbackupinterval").AsInt()); | 
| ASSERT_FALSE(filterEngine->GetPref("subscriptions_autoupdate").AsBool()); | 
| } | 
| } | 
| TEST_F(PrefsTest, UnknownPrefs) | 
| { | 
| - fileSystem->prefsContents = "{\"foobar\":2, \"patternsbackupinterval\": 12}"; | 
| + using IOBuffer = AdblockPlus::FileSystem::IOBuffer; | 
| + std::string content = "{\"foobar\":2, \"patternsbackupinterval\": 12}"; | 
| + fileSystem->prefsContents = IOBuffer(content.cbegin(), content.cend()); | 
| auto filterEngine = CreateFilterEngine(); | 
| ASSERT_TRUE(filterEngine->GetPref("foobar").IsUndefined()); | 
| ASSERT_EQ(12, filterEngine->GetPref("patternsbackupinterval").AsInt()); | 
| } | 
| TEST_F(PrefsTest, SyntaxFailure) | 
| { | 
| - fileSystem->prefsContents = "{\"patternsbackupinterval\": 6, \"foo\"}"; | 
| + using IOBuffer = AdblockPlus::FileSystem::IOBuffer; | 
| + std::string content = "{\"patternsbackupinterval\": 6, \"foo\"}"; | 
| + fileSystem->prefsContents = IOBuffer(content.cbegin(), content.cend()); | 
| auto filterEngine = CreateFilterEngine(); | 
| ASSERT_EQ(24, filterEngine->GetPref("patternsbackupinterval").AsInt()); | 
| } | 
| TEST_F(PrefsTest, PreconfiguredPrefsPreconfigured) | 
| { | 
| AdblockPlus::FilterEngine::Prefs preconfiguredPrefs; |