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

Unified Diff: test/FilterEngineStubs.cpp

Issue 9987009: Interface for the libadblockplus API (Closed)
Patch Set: Reduce redundant redundancy Created March 27, 2013, 6:45 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
« shell/src/Main.cpp ('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", ""));
+}
« shell/src/Main.cpp ('K') | « src/FilterEngine.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld