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

Unified Diff: test/FilterEngineStubs.cpp

Issue 10016005: Add API calls and stubs for filter matching and subscription management (Closed)
Patch Set: Created April 3, 2013, 12:42 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
« include/AdblockPlus/FilterEngine.h ('K') | « src/FilterEngine.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/FilterEngineStubs.cpp
===================================================================
new file mode 100644
--- /dev/null
+++ b/test/FilterEngineStubs.cpp
@@ -0,0 +1,25 @@
+#include <AdblockPlus.h>
+#include <fstream>
+#include <gtest/gtest.h>
+#include <sstream>
+
+TEST(FilterEngineStubsTest, AddRemove)
+{
+ AdblockPlus::JsEngine jsEngine(0, 0);
+ AdblockPlus::FilterEngine filterEngine(jsEngine);
+ ASSERT_EQ(filterEngine.GetSubscriptions().size(), 0);
+ AdblockPlus::Subscription subscription("foo", "bar");
+ filterEngine.AddSubscription(subscription);
+ ASSERT_EQ(filterEngine.GetSubscriptions().size(), 1);
+ filterEngine.RemoveSubscription(subscription);
+ ASSERT_EQ(filterEngine.GetSubscriptions().size(), 0);
+}
+
+TEST(FilterEngineStubsTest, Matches)
+{
+ AdblockPlus::JsEngine jsEngine(0, 0);
+ AdblockPlus::FilterEngine filterEngine(jsEngine);
+ filterEngine.AddSubscription(AdblockPlus::Subscription("foo", "bar"));
+ ASSERT_FALSE(filterEngine.Matches("http://example.org/a", ""));
+ ASSERT_TRUE(filterEngine.Matches("http://example.org/ad", ""));
+}
« include/AdblockPlus/FilterEngine.h ('K') | « src/FilterEngine.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld