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

Delta Between Two Patch Sets: test/FilterEngineStubs.cpp

Issue 9987009: Interface for the libadblockplus API (Closed)
Left Patch Set: Renamed match method, added tests for the stubs Created March 26, 2013, 3:39 p.m.
Right Patch Set: Reduce redundant redundancy Created March 27, 2013, 6:45 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« shell/src/Main.cpp ('K') | « src/FilterEngine.cpp ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #include <AdblockPlus.h> 1 #include <AdblockPlus.h>
2 #include <fstream> 2 #include <fstream>
3 #include <gtest/gtest.h> 3 #include <gtest/gtest.h>
4 #include <sstream> 4 #include <sstream>
5 5
6 TEST(FilterEngineStubsTest, AddRemove) 6 TEST(FilterEngineStubsTest, AddRemove)
7 { 7 {
8 AdblockPlus::JsEngine jsEngine(0, 0); 8 AdblockPlus::JsEngine jsEngine(0, 0);
9 AdblockPlus::FilterEngine filterEngine(jsEngine); 9 AdblockPlus::FilterEngine filterEngine(jsEngine);
10 ASSERT_EQ(filterEngine.GetSubscriptions().size(), 0); 10 ASSERT_EQ(filterEngine.GetSubscriptions().size(), 0);
11 AdblockPlus::Subscription subscription("foo", "bar"); 11 AdblockPlus::Subscription subscription("foo", "bar");
12 filterEngine.AddSubscription(subscription); 12 filterEngine.AddSubscription(subscription);
13 ASSERT_EQ(filterEngine.GetSubscriptions().size(), 1); 13 ASSERT_EQ(filterEngine.GetSubscriptions().size(), 1);
14 filterEngine.RemoveSubscription(subscription); 14 filterEngine.RemoveSubscription(subscription);
15 ASSERT_EQ(filterEngine.GetSubscriptions().size(), 0); 15 ASSERT_EQ(filterEngine.GetSubscriptions().size(), 0);
16 } 16 }
17 17
18 TEST(FilterEngineStubsTest, FilterMatches) 18 TEST(FilterEngineStubsTest, Matches)
19 { 19 {
20 AdblockPlus::JsEngine jsEngine(0, 0); 20 AdblockPlus::JsEngine jsEngine(0, 0);
21 AdblockPlus::FilterEngine filterEngine(jsEngine); 21 AdblockPlus::FilterEngine filterEngine(jsEngine);
22 filterEngine.AddSubscription(AdblockPlus::Subscription("foo", "bar")); 22 filterEngine.AddSubscription(AdblockPlus::Subscription("foo", "bar"));
23 ASSERT_FALSE(filterEngine.MatchesFilters("http://example.org/a", "")); 23 ASSERT_FALSE(filterEngine.Matches("http://example.org/a", ""));
24 ASSERT_TRUE(filterEngine.MatchesFilters("http://example.org/ad", "")); 24 ASSERT_TRUE(filterEngine.Matches("http://example.org/ad", ""));
25 } 25 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld