Index: test/FilterEngine.cpp |
=================================================================== |
--- a/test/FilterEngine.cpp |
+++ b/test/FilterEngine.cpp |
@@ -16,6 +16,7 @@ |
*/ |
#include "BaseJsTest.h" |
+#include "JsLatch.h" |
#include <thread> |
#include "../src/JsEngineTransition.h" |
@@ -136,9 +137,6 @@ |
int& timesCalled; |
}; |
- // Workaround for https://issues.adblockplus.org/ticket/1397. |
- void NoOpUpdaterCallback(const std::string&) {} |
- |
class FilterEngineWithFreshFolder : public ::testing::Test |
{ |
protected: |
@@ -556,13 +554,15 @@ |
MockUpdateAvailableCallback mockUpdateAvailableCallback(timesCalled); |
filterEngine->SetUpdateAvailableCallback(mockUpdateAvailableCallback); |
- filterEngine->ForceUpdateCheck(&NoOpUpdaterCallback); |
- std::this_thread::sleep_for(std::chrono::milliseconds(100)); |
+ Latch latchA(1); |
+ filterEngine->ForceUpdateCheck([&](const std::string&) {latchA.Arrive(); }); |
+ latchA.Wait(); |
ASSERT_EQ(1, timesCalled); |
filterEngine->RemoveUpdateAvailableCallback(); |
- filterEngine->ForceUpdateCheck(&NoOpUpdaterCallback); |
- std::this_thread::sleep_for(std::chrono::milliseconds(100)); |
+ Latch latchB(1); |
+ filterEngine->ForceUpdateCheck([&](const std::string&) {latchB.Arrive(); }); |
+ latchB.Wait(); |
ASSERT_EQ(1, timesCalled); |
} |