OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2013 Eyeo GmbH | 3 * Copyright (C) 2006-2013 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 ASSERT_FALSE(match10); | 195 ASSERT_FALSE(match10); |
196 | 196 |
197 AdblockPlus::FilterPtr match11 = filterEngine->Matches("http://example.org/org
banner.gif", "IMAGE", "http://example.com/"); | 197 AdblockPlus::FilterPtr match11 = filterEngine->Matches("http://example.org/org
banner.gif", "IMAGE", "http://example.com/"); |
198 ASSERT_FALSE(match11); | 198 ASSERT_FALSE(match11); |
199 | 199 |
200 AdblockPlus::FilterPtr match12 = filterEngine->Matches("http://example.org/org
banner.gif", "IMAGE", "http://example.org/"); | 200 AdblockPlus::FilterPtr match12 = filterEngine->Matches("http://example.org/org
banner.gif", "IMAGE", "http://example.org/"); |
201 ASSERT_TRUE(match12); | 201 ASSERT_TRUE(match12); |
202 ASSERT_EQ(AdblockPlus::Filter::TYPE_BLOCKING, match12->GetType()); | 202 ASSERT_EQ(AdblockPlus::Filter::TYPE_BLOCKING, match12->GetType()); |
203 } | 203 } |
204 | 204 |
| 205 TEST_F(FilterEngineTest, MatchesWithFrameStructure) |
| 206 { |
| 207 filterEngine->GetFilter("adbanner.gif")->AddToList(); |
| 208 filterEngine->GetFilter("@@adbanner.gif$domain=example.org")->AddToList(); |
| 209 |
| 210 std::vector<std::string> documentUrls1; |
| 211 documentUrls1.push_back("http://ads.com/frame/"); |
| 212 documentUrls1.push_back("http://example.com/"); |
| 213 AdblockPlus::FilterPtr match1 = |
| 214 filterEngine->Matches("http://ads.com/adbanner.gif", "IMAGE", |
| 215 documentUrls1); |
| 216 ASSERT_TRUE(match1); |
| 217 ASSERT_EQ(AdblockPlus::Filter::TYPE_BLOCKING, match1->GetType()); |
| 218 |
| 219 std::vector<std::string> documentUrls2; |
| 220 documentUrls2.push_back("http://ads.com/frame/"); |
| 221 documentUrls2.push_back("http://example.org/"); |
| 222 AdblockPlus::FilterPtr match2 = |
| 223 filterEngine->Matches("http://ads.com/adbanner.gif", "IMAGE", |
| 224 documentUrls2); |
| 225 ASSERT_TRUE(match2); |
| 226 ASSERT_EQ(AdblockPlus::Filter::TYPE_EXCEPTION, match2->GetType()); |
| 227 } |
| 228 |
205 TEST_F(FilterEngineTest, FirstRunFlag) | 229 TEST_F(FilterEngineTest, FirstRunFlag) |
206 { | 230 { |
207 ASSERT_FALSE(filterEngine->IsFirstRun()); | 231 ASSERT_FALSE(filterEngine->IsFirstRun()); |
208 } | 232 } |
209 | 233 |
210 TEST_F(FilterEngineTestNoData, FirstRunFlag) | 234 TEST_F(FilterEngineTestNoData, FirstRunFlag) |
211 { | 235 { |
212 ASSERT_FALSE(filterEngine->IsFirstRun()); | 236 ASSERT_FALSE(filterEngine->IsFirstRun()); |
213 } | 237 } |
OLD | NEW |