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

Unified Diff: test/BaseJsTest.h

Issue 29481704: Noissue - Use buffer for FileSystem IO (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Removed Utils::Slurp() we no longer need Created July 6, 2017, 9:32 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/Utils.cpp ('k') | test/DefaultFileSystem.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/BaseJsTest.h
===================================================================
--- a/test/BaseJsTest.h
+++ b/test/BaseJsTest.h
@@ -100,22 +100,22 @@
{
throw std::runtime_error("Unexpected error: " + message);
}
};
class ThrowingFileSystem : public AdblockPlus::FileSystem
{
public:
- std::shared_ptr<std::istream> Read(const std::string& path) const
+ FileSystem::IOBuffer Read(const std::string& path) const
{
throw std::runtime_error("Not implemented");
}
- void Write(const std::string& path, std::istream& content)
+ void Write(const std::string& path, const FileSystem::IOBuffer& content)
{
throw std::runtime_error("Not implemented");
}
void Move(const std::string& fromPath, const std::string& toPath)
{
throw std::runtime_error("Not implemented");
}
@@ -144,27 +144,27 @@
{
throw std::runtime_error("Unexpected GET: " + url);
}
};
class LazyFileSystem : public AdblockPlus::FileSystem
{
public:
- std::shared_ptr<std::istream> Read(const std::string& path) const
+ IOBuffer Read(const std::string& path) const
{
std::string dummyData("");
if (path == "patterns.ini")
dummyData = "# Adblock Plus preferences\n[Subscription]\nurl=~fl~";
else if (path == "prefs.json")
dummyData = "{}";
- return std::shared_ptr<std::istream>(new std::istringstream(dummyData));
+ return IOBuffer(dummyData.cbegin(), dummyData.cend());
}
- void Write(const std::string& path, std::istream& content)
+ void Write(const std::string& path, const IOBuffer& content)
{
}
void Move(const std::string& fromPath, const std::string& toPath)
{
}
void Remove(const std::string& path)
« no previous file with comments | « src/Utils.cpp ('k') | test/DefaultFileSystem.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld