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

Unified Diff: test/FilterEngine.cpp

Issue 23127017: Consider the frame structure in Matches() (Closed)
Patch Set: Created Oct. 29, 2013, 3:13 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
« src/FilterEngine.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/FilterEngine.cpp
===================================================================
--- a/test/FilterEngine.cpp
+++ b/test/FilterEngine.cpp
@@ -202,6 +202,30 @@
ASSERT_EQ(AdblockPlus::Filter::TYPE_BLOCKING, match12->GetType());
}
+TEST_F(FilterEngineTest, MatchesWithFrameStructure)
+{
+ filterEngine->GetFilter("adbanner.gif")->AddToList();
+ filterEngine->GetFilter("@@adbanner.gif$domain=example.org")->AddToList();
Wladimir Palant 2013/10/30 07:39:56 @@||example.org^$document is the exception rule yo
+
+ std::vector<std::string> documentUrls1;
+ documentUrls1.push_back("http://ads.com/frame/");
+ documentUrls1.push_back("http://example.com/");
+ AdblockPlus::FilterPtr match1 =
+ filterEngine->Matches("http://ads.com/adbanner.gif", "IMAGE",
+ documentUrls1);
+ ASSERT_TRUE(match1);
+ ASSERT_EQ(AdblockPlus::Filter::TYPE_BLOCKING, match1->GetType());
+
+ std::vector<std::string> documentUrls2;
+ documentUrls2.push_back("http://ads.com/frame/");
+ documentUrls2.push_back("http://example.org/");
+ AdblockPlus::FilterPtr match2 =
+ filterEngine->Matches("http://ads.com/adbanner.gif", "IMAGE",
+ documentUrls2);
+ ASSERT_TRUE(match2);
+ ASSERT_EQ(AdblockPlus::Filter::TYPE_EXCEPTION, match2->GetType());
+}
+
TEST_F(FilterEngineTest, FirstRunFlag)
{
ASSERT_FALSE(filterEngine->IsFirstRun());
« src/FilterEngine.cpp ('K') | « src/FilterEngine.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld