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

Unified Diff: test/BaseJsTest.h

Issue 10420020: Made sure FilterEngine instances are always initialized (Closed)
Patch Set: Using a generic messaging mechanism Created May 23, 2013, 6:35 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
« no previous file with comments | « src/JsEngine.cpp ('k') | test/FilterEngine.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
@@ -74,50 +74,52 @@ class ThrowingWebRequest : public Adbloc
throw std::runtime_error("Unexpected GET: " + url);
}
};
class LazyFileSystem : public AdblockPlus::FileSystem
{
std::tr1::shared_ptr<std::istream> Read(const std::string& path) const
{
- while (true)
- AdblockPlus::Sleep(100000);
- return std::tr1::shared_ptr<std::istream>();
+ 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>();
}
void Write(const std::string& path,
std::tr1::shared_ptr<std::ostream> content)
{
- while (true)
- AdblockPlus::Sleep(100000);
}
void Move(const std::string& fromPath, const std::string& toPath)
{
- while (true)
- AdblockPlus::Sleep(100000);
}
void Remove(const std::string& path)
{
- while (true)
- AdblockPlus::Sleep(100000);
}
StatResult Stat(const std::string& path) const
{
- while (true)
- AdblockPlus::Sleep(100000);
- return StatResult();
+ StatResult result;
+ if (path == "patterns.ini")
+ {
+ result.exists = true;
+ result.isFile = true;
+ }
+ return result;
}
std::string Resolve(const std::string& path) const
{
- return std::string();
+ return path;
}
};
class LazyWebRequest : public AdblockPlus::WebRequest
{
AdblockPlus::ServerResponse GET(const std::string& url, const AdblockPlus::HeaderList& requestHeaders) const
{
while (true)
« no previous file with comments | « src/JsEngine.cpp ('k') | test/FilterEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld