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

Unified Diff: test/FilterEngine.cpp

Issue 11021064: Fixed: domain options aren`t treated correctly by the matcher (Closed)
Patch Set: Created July 5, 2013, 12:39 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
« no previous file with comments | « lib/api.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
@@ -150,16 +150,18 @@ TEST_F(FilterEngineTest, SubscriptionUpd
}
TEST_F(FilterEngineTest, Matches)
{
filterEngine->GetFilter("adbanner.gif")->AddToList();
filterEngine->GetFilter("@@notbanner.gif")->AddToList();
filterEngine->GetFilter("tpbanner.gif$third-party")->AddToList();
filterEngine->GetFilter("fpbanner.gif$~third-party")->AddToList();
+ filterEngine->GetFilter("combanner.gif$domain=example.com")->AddToList();
+ filterEngine->GetFilter("orgbanner.gif$domain=~example.com")->AddToList();
AdblockPlus::FilterPtr match1 = filterEngine->Matches("http://example.org/foobar.gif", "IMAGE", "");
ASSERT_FALSE(match1);
AdblockPlus::FilterPtr match2 = filterEngine->Matches("http://example.org/adbanner.gif", "IMAGE", "");
ASSERT_TRUE(match2);
ASSERT_EQ(AdblockPlus::Filter::TYPE_BLOCKING, match2->GetType());
@@ -175,20 +177,34 @@ TEST_F(FilterEngineTest, Matches)
ASSERT_FALSE(match5);
AdblockPlus::FilterPtr match6 = filterEngine->Matches("http://example.org/fpbanner.gif", "IMAGE", "http://example.org/");
ASSERT_TRUE(match6);
ASSERT_EQ(AdblockPlus::Filter::TYPE_BLOCKING, match6->GetType());
AdblockPlus::FilterPtr match7 = filterEngine->Matches("http://example.org/tpbanner.gif", "IMAGE", "http://example.com/");
ASSERT_TRUE(match7);
- ASSERT_EQ(AdblockPlus::Filter::TYPE_BLOCKING, match6->GetType());
+ ASSERT_EQ(AdblockPlus::Filter::TYPE_BLOCKING, match7->GetType());
AdblockPlus::FilterPtr match8 = filterEngine->Matches("http://example.org/fpbanner.gif", "IMAGE", "http://example.com/");
ASSERT_FALSE(match8);
+
+ AdblockPlus::FilterPtr match9 = filterEngine->Matches("http://example.org/combanner.gif", "IMAGE", "http://example.com/");
+ ASSERT_TRUE(match9);
+ ASSERT_EQ(AdblockPlus::Filter::TYPE_BLOCKING, match9->GetType());
+
+ AdblockPlus::FilterPtr match10 = filterEngine->Matches("http://example.org/combanner.gif", "IMAGE", "http://example.org/");
+ ASSERT_FALSE(match10);
+
+ AdblockPlus::FilterPtr match11 = filterEngine->Matches("http://example.org/orgbanner.gif", "IMAGE", "http://example.com/");
+ ASSERT_FALSE(match11);
+
+ AdblockPlus::FilterPtr match12 = filterEngine->Matches("http://example.org/orgbanner.gif", "IMAGE", "http://example.org/");
+ ASSERT_TRUE(match12);
+ ASSERT_EQ(AdblockPlus::Filter::TYPE_BLOCKING, match12->GetType());
}
TEST_F(FilterEngineTest, FirstRunFlag)
{
ASSERT_FALSE(filterEngine->IsFirstRun());
}
TEST_F(FilterEngineTestNoData, FirstRunFlag)
« no previous file with comments | « lib/api.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld