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

Side by Side Diff: test/FilterEngine.cpp

Issue 5768603836088320: Issue 1564-Fix FilterEngine::Matches for allowing request which is whitelisted in the ascendant node
Patch Set: Created Nov. 13, 2014, 12:58 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
« src/FilterEngine.cpp ('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
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-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 ASSERT_TRUE(match2); 290 ASSERT_TRUE(match2);
291 ASSERT_EQ(AdblockPlus::Filter::TYPE_EXCEPTION, match2->GetType()); 291 ASSERT_EQ(AdblockPlus::Filter::TYPE_EXCEPTION, match2->GetType());
292 292
293 std::vector<std::string> documentUrls3; 293 std::vector<std::string> documentUrls3;
294 documentUrls3.push_back("http://example.org/"); 294 documentUrls3.push_back("http://example.org/");
295 documentUrls3.push_back("http://ads.com/frame/"); 295 documentUrls3.push_back("http://ads.com/frame/");
296 AdblockPlus::FilterPtr match3 = 296 AdblockPlus::FilterPtr match3 =
297 filterEngine->Matches("http://ads.com/adbanner.gif", AdblockPlus::FilterEngi ne::CONTENT_TYPE_IMAGE, 297 filterEngine->Matches("http://ads.com/adbanner.gif", AdblockPlus::FilterEngi ne::CONTENT_TYPE_IMAGE,
298 documentUrls3); 298 documentUrls3);
299 ASSERT_TRUE(match3); 299 ASSERT_TRUE(match3);
300 ASSERT_EQ(AdblockPlus::Filter::TYPE_BLOCKING, match3->GetType()); 300 ASSERT_EQ(AdblockPlus::Filter::TYPE_EXCEPTION, match3->GetType());
301 } 301 }
302 302
303 TEST_F(FilterEngineTest, MatchesNestedFrameOnWhitelistedDomain) 303 TEST_F(FilterEngineTest, MatchesNestedFrameOnWhitelistedDomain)
304 { 304 {
305 filterEngine->GetFilter("adbanner.gif")->AddToList(); 305 filterEngine->GetFilter("adbanner.gif")->AddToList();
306 filterEngine->GetFilter("@@||example.org^$document,domain=ads.com")->AddToList (); 306 filterEngine->GetFilter("@@||example.org^$document,domain=ads.com")->AddToList ();
307 307
308 std::vector<std::string> documentUrls1; 308 std::vector<std::string> documentUrls1;
309 documentUrls1.push_back("http://ads.com/frame/"); 309 documentUrls1.push_back("http://ads.com/frame/");
310 documentUrls1.push_back("http://example.com/"); 310 documentUrls1.push_back("http://example.com/");
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 filterEngine->SetUpdateAvailableCallback(mockUpdateAvailableCallback); 379 filterEngine->SetUpdateAvailableCallback(mockUpdateAvailableCallback);
380 filterEngine->ForceUpdateCheck(&NoOpUpdaterCallback); 380 filterEngine->ForceUpdateCheck(&NoOpUpdaterCallback);
381 AdblockPlus::Sleep(100); 381 AdblockPlus::Sleep(100);
382 ASSERT_EQ(1, timesCalled); 382 ASSERT_EQ(1, timesCalled);
383 383
384 filterEngine->RemoveUpdateAvailableCallback(); 384 filterEngine->RemoveUpdateAvailableCallback();
385 filterEngine->ForceUpdateCheck(&NoOpUpdaterCallback); 385 filterEngine->ForceUpdateCheck(&NoOpUpdaterCallback);
386 AdblockPlus::Sleep(100); 386 AdblockPlus::Sleep(100);
387 ASSERT_EQ(1, timesCalled); 387 ASSERT_EQ(1, timesCalled);
388 } 388 }
OLDNEW
« src/FilterEngine.cpp ('K') | « src/FilterEngine.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld