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

Unified Diff: test/FilterEngine.cpp

Issue 5740786045943808: Issue 189 - Implement API changes from #117, #153, #192 in libadblockplus (Closed)
Patch Set: Created April 14, 2014, 9:14 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
« lib/init.js ('K') | « lib/utils.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/FilterEngine.cpp
===================================================================
--- a/test/FilterEngine.cpp
+++ b/test/FilterEngine.cpp
@@ -19,20 +19,19 @@
namespace
{
typedef std::tr1::shared_ptr<AdblockPlus::FilterEngine> FilterEnginePtr;
class VeryLazyFileSystem : public LazyFileSystem
{
public:
- std::tr1::shared_ptr<std::istream> Read(const std::string& path) const
+ StatResult Stat(const std::string& path) const
{
- std::string dummyData("# Adblock Plus preferences");
- return std::tr1::shared_ptr<std::istream>(new std::istringstream(dummyData));
+ return StatResult();
}
};
template<class FileSystem, class LogSystem>
class FilterEngineTestGeneric : public BaseJsTest
{
protected:
FilterEnginePtr filterEngine;
@@ -116,34 +115,33 @@ TEST_F(FilterEngineTest, SubscriptionPro
subscription->SetProperty("boolFoo", true);
ASSERT_EQ("y", subscription->GetProperty("stringFoo")->AsString());
ASSERT_EQ(24, subscription->GetProperty("intFoo")->AsInt());
ASSERT_TRUE(subscription->GetProperty("boolFoo")->AsBool());
}
TEST_F(FilterEngineTest, AddRemoveSubscriptions)
{
- // There should be only the default subscription initially
- ASSERT_EQ(1u, filterEngine->GetListedSubscriptions().size());
+ ASSERT_EQ(0u, filterEngine->GetListedSubscriptions().size());
AdblockPlus::SubscriptionPtr subscription = filterEngine->GetSubscription("foo");
- ASSERT_EQ(1u, filterEngine->GetListedSubscriptions().size());
+ ASSERT_EQ(0u, filterEngine->GetListedSubscriptions().size());
ASSERT_FALSE(subscription->IsListed());
subscription->AddToList();
- ASSERT_EQ(2u, filterEngine->GetListedSubscriptions().size());
- ASSERT_EQ(*subscription, *filterEngine->GetListedSubscriptions()[1]);
+ ASSERT_EQ(1u, filterEngine->GetListedSubscriptions().size());
+ ASSERT_EQ(*subscription, *filterEngine->GetListedSubscriptions()[0]);
ASSERT_TRUE(subscription->IsListed());
subscription->AddToList();
- ASSERT_EQ(2u, filterEngine->GetListedSubscriptions().size());
- ASSERT_EQ(*subscription, *filterEngine->GetListedSubscriptions()[1]);
+ ASSERT_EQ(1u, filterEngine->GetListedSubscriptions().size());
+ ASSERT_EQ(*subscription, *filterEngine->GetListedSubscriptions()[0]);
ASSERT_TRUE(subscription->IsListed());
subscription->RemoveFromList();
- ASSERT_EQ(1u, filterEngine->GetListedSubscriptions().size());
+ ASSERT_EQ(0u, filterEngine->GetListedSubscriptions().size());
ASSERT_FALSE(subscription->IsListed());
subscription->RemoveFromList();
- ASSERT_EQ(1u, filterEngine->GetListedSubscriptions().size());
+ ASSERT_EQ(0u, filterEngine->GetListedSubscriptions().size());
ASSERT_FALSE(subscription->IsListed());
}
TEST_F(FilterEngineTest, SubscriptionUpdates)
{
AdblockPlus::SubscriptionPtr subscription = filterEngine->GetSubscription("foo");
ASSERT_FALSE(subscription->IsUpdating());
subscription->UpdateFilters();
@@ -306,10 +304,10 @@ TEST_F(FilterEngineTest, MatchesNestedFr
TEST_F(FilterEngineTest, FirstRunFlag)
{
ASSERT_FALSE(filterEngine->IsFirstRun());
}
TEST_F(FilterEngineTestNoData, FirstRunFlag)
{
- ASSERT_FALSE(filterEngine->IsFirstRun());
+ ASSERT_TRUE(filterEngine->IsFirstRun());
}
« lib/init.js ('K') | « lib/utils.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld