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

Unified Diff: test/BaseJsTest.h

Issue 10802049: Functional prefs implementation (Closed)
Patch Set: Cleaned up init.js a bit Created June 5, 2013, 9:44 a.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
Index: test/BaseJsTest.h
===================================================================
--- a/test/BaseJsTest.h
+++ b/test/BaseJsTest.h
@@ -29,16 +29,17 @@ public:
const std::string& source)
{
throw std::runtime_error("Unexpected error: " + message);
}
};
class ThrowingFileSystem : public AdblockPlus::FileSystem
{
+public:
std::tr1::shared_ptr<std::istream> Read(const std::string& path) const
{
throw std::runtime_error("Not implemented");
}
void Write(const std::string& path,
std::tr1::shared_ptr<std::istream> content)
{
@@ -64,33 +65,34 @@ class ThrowingFileSystem : public Adbloc
{
throw std::runtime_error("Not implemented");
}
};
class ThrowingWebRequest : public AdblockPlus::WebRequest
{
+public:
AdblockPlus::ServerResponse GET(const std::string& url, const AdblockPlus::HeaderList& requestHeaders) const
{
throw std::runtime_error("Unexpected GET: " + url);
}
};
class LazyFileSystem : public AdblockPlus::FileSystem
{
+public:
std::tr1::shared_ptr<std::istream> Read(const std::string& path) const
{
+ std::string dummyData("");
if (path == "patterns.ini")
- {
- std::string dummyData("# Adblock Plus preferences\n[Subscription]\nurl=~fl~");
- return std::tr1::shared_ptr<std::istream>(new std::istringstream(dummyData));
- }
- else
- return std::tr1::shared_ptr<std::istream>();
+ dummyData = "# Adblock Plus preferences\n[Subscription]\nurl=~fl~";
+ else if (path == "prefs.json")
+ dummyData = "{}";
+ return std::tr1::shared_ptr<std::istream>(new std::istringstream(dummyData));
}
void Write(const std::string& path,
std::tr1::shared_ptr<std::istream> content)
{
}
void Move(const std::string& fromPath, const std::string& toPath)

Powered by Google App Engine
This is Rietveld