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

Side by Side Diff: test/FilterEngine.cpp

Issue 29367003: Issue #4711 - Rewrite legacy thread facilities
Patch Set: Created Dec. 7, 2016, 4:44 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
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 \"version\": \"1.0.2\",\ 515 \"version\": \"1.0.2\",\
516 \"url\": \"https://downloads.adblockplus.org/test-1.0.2.tar.gz?update\"\ 516 \"url\": \"https://downloads.adblockplus.org/test-1.0.2.tar.gz?update\"\
517 }\ 517 }\
518 }"; 518 }";
519 519
520 int timesCalled = 0; 520 int timesCalled = 0;
521 MockUpdateAvailableCallback mockUpdateAvailableCallback(timesCalled); 521 MockUpdateAvailableCallback mockUpdateAvailableCallback(timesCalled);
522 522
523 filterEngine->SetUpdateAvailableCallback(mockUpdateAvailableCallback); 523 filterEngine->SetUpdateAvailableCallback(mockUpdateAvailableCallback);
524 filterEngine->ForceUpdateCheck(&NoOpUpdaterCallback); 524 filterEngine->ForceUpdateCheck(&NoOpUpdaterCallback);
525 AdblockPlus::Sleep(100); 525 std::this_thread::sleep_for(std::chrono::milliseconds(100));
526 ASSERT_EQ(1, timesCalled); 526 ASSERT_EQ(1, timesCalled);
527 527
528 filterEngine->RemoveUpdateAvailableCallback(); 528 filterEngine->RemoveUpdateAvailableCallback();
529 filterEngine->ForceUpdateCheck(&NoOpUpdaterCallback); 529 filterEngine->ForceUpdateCheck(&NoOpUpdaterCallback);
530 AdblockPlus::Sleep(100); 530 std::this_thread::sleep_for(std::chrono::milliseconds(100));
531 ASSERT_EQ(1, timesCalled); 531 ASSERT_EQ(1, timesCalled);
532 } 532 }
533 533
534 TEST_F(FilterEngineTest, DocumentWhitelisting) 534 TEST_F(FilterEngineTest, DocumentWhitelisting)
535 { 535 {
536 filterEngine->GetFilter("@@||example.org^$document")->AddToList(); 536 filterEngine->GetFilter("@@||example.org^$document")->AddToList();
537 filterEngine->GetFilter("@@||example.com^$document,domain=example.de")->AddToL ist(); 537 filterEngine->GetFilter("@@||example.com^$document,domain=example.de")->AddToL ist();
538 538
539 ASSERT_TRUE(filterEngine->IsDocumentWhitelisted( 539 ASSERT_TRUE(filterEngine->IsDocumentWhitelisted(
540 "http://example.org", 540 "http://example.org",
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 619
620 TEST_F(FilterEngineWithFreshFolder, DisableSubscriptionsAutoSelectOnFirstRun) 620 TEST_F(FilterEngineWithFreshFolder, DisableSubscriptionsAutoSelectOnFirstRun)
621 { 621 {
622 auto jsEngine = createJsEngine(); 622 auto jsEngine = createJsEngine();
623 FilterEngine::Prefs preSettings; 623 FilterEngine::Prefs preSettings;
624 preSettings["first_run_subscription_auto_select"] = jsEngine->NewValue(false); 624 preSettings["first_run_subscription_auto_select"] = jsEngine->NewValue(false);
625 auto filterEngine = FilterEnginePtr(new AdblockPlus::FilterEngine(jsEngine, pr eSettings)); 625 auto filterEngine = FilterEnginePtr(new AdblockPlus::FilterEngine(jsEngine, pr eSettings));
626 const auto subscriptions = filterEngine->GetListedSubscriptions(); 626 const auto subscriptions = filterEngine->GetListedSubscriptions();
627 EXPECT_EQ(0u, subscriptions.size()); 627 EXPECT_EQ(0u, subscriptions.size());
628 } 628 }
OLDNEW
« src/Thread.h ('K') | « test/FileSystemJsObject.cpp ('k') | test/GlobalJsObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld