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

Side by Side 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.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« include/AdblockPlus/FilterEngine.h ('K') | « src/FilterEngine.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #include <AdblockPlus.h>
2 #include <fstream>
3 #include <gtest/gtest.h>
4 #include <sstream>
5
6 TEST(FilterEngineStubsTest, AddRemove)
7 {
8 AdblockPlus::JsEngine jsEngine(0, 0);
9 AdblockPlus::FilterEngine filterEngine(jsEngine);
10 ASSERT_EQ(filterEngine.GetSubscriptions().size(), 0);
11 AdblockPlus::Subscription subscription("foo", "bar");
12 filterEngine.AddSubscription(subscription);
13 ASSERT_EQ(filterEngine.GetSubscriptions().size(), 1);
14 filterEngine.RemoveSubscription(subscription);
15 ASSERT_EQ(filterEngine.GetSubscriptions().size(), 0);
16 }
17
18 TEST(FilterEngineStubsTest, Matches)
19 {
20 AdblockPlus::JsEngine jsEngine(0, 0);
21 AdblockPlus::FilterEngine filterEngine(jsEngine);
22 filterEngine.AddSubscription(AdblockPlus::Subscription("foo", "bar"));
23 ASSERT_FALSE(filterEngine.Matches("http://example.org/a", ""));
24 ASSERT_TRUE(filterEngine.Matches("http://example.org/ad", ""));
25 }
OLDNEW
« 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