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

Unified Diff: test/FilterEngine.cpp

Issue 29422625: Issue 5189 - use r-value references when objects should be transferred (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: Created April 26, 2017, 2:14 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
« no previous file with comments | « src/JsEngine.cpp ('k') | test/JsEngine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/FilterEngine.cpp
diff --git a/test/FilterEngine.cpp b/test/FilterEngine.cpp
index 30dad91090f865a6b045e00c289b777073938bd7..3244d42f4218e56fb63f2668f4503cb633e79cb9 100644
--- a/test/FilterEngine.cpp
+++ b/test/FilterEngine.cpp
@@ -62,19 +62,6 @@ namespace
typedef FilterEngineTestGeneric<LazyFileSystem, AdblockPlus::DefaultLogSystem> FilterEngineTest;
typedef FilterEngineTestGeneric<VeryLazyFileSystem, LazyLogSystem> FilterEngineTestNoData;
- struct MockFilterChangeCallback
- {
- MockFilterChangeCallback(int& timesCalled) : timesCalled(timesCalled) {}
-
- void operator()(const std::string&, const AdblockPlus::JsValue&)
- {
- timesCalled++;
- }
-
- private:
- int& timesCalled;
- };
-
class UpdaterTest : public ::testing::Test
{
protected:
@@ -234,7 +221,7 @@ namespace
capturedConnectionTypes.Add(allowedConnectionType);
return isConnectionAllowed;
};
- jsEngine->SetEventCallback("filterChange", [this](const JsValueList& params/*action, item*/)
+ jsEngine->SetEventCallback("filterChange", [this](JsValueList&& params/*action, item*/)
{
ASSERT_EQ(2u, params.size());
if (params[0].AsString() == "subscription.downloadStatus")
@@ -602,9 +589,11 @@ TEST_F(FilterEngineTestNoData, FirstRunFlag)
TEST_F(FilterEngineTest, SetRemoveFilterChangeCallback)
{
int timesCalled = 0;
- MockFilterChangeCallback mockFilterChangeCallback(timesCalled);
std::this_thread::sleep_for(std::chrono::milliseconds(200));
- filterEngine->SetFilterChangeCallback(mockFilterChangeCallback);
+ filterEngine->SetFilterChangeCallback([&timesCalled](const std::string&, AdblockPlus::JsValue&&)
+ {
+ timesCalled++;
+ });
filterEngine->GetFilter("foo").AddToList();
EXPECT_EQ(1, timesCalled);
« no previous file with comments | « src/JsEngine.cpp ('k') | test/JsEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld