class ScopedTask
{
public:
- ScopedTask(DiscoveryTaskPtr task) :
+ ScopedTask(DiscoveryTaskPtr&& task) :
m_task{ std::move(task) }
{
}
}
).Return(OC_STACK_OK);
- ScopedTask task = RCSDiscoveryManager::getInstance()->discoverResourceByType(
- RCSAddress::multicast(), RESOURCE_URI, RESOURCE_TYPE, onResourceDiscovered);
+ ScopedTask task {RCSDiscoveryManager::getInstance()->discoverResourceByType(
+ RCSAddress::multicast(), RESOURCE_URI, RESOURCE_TYPE, onResourceDiscovered)};
}
TEST(DiscoveryManagerTest, DiscoverWithMultipleTypesInvokesFindResourceMultipleTimes)
}
).Return(OC_STACK_OK);
- ScopedTask task = RCSDiscoveryManager::getInstance()->discoverResourceByTypes(
- RCSAddress::multicast(), resourceTypes, onResourceDiscovered);
+ ScopedTask task {RCSDiscoveryManager::getInstance()->discoverResourceByTypes(
+ RCSAddress::multicast(), resourceTypes, onResourceDiscovered)};
EXPECT_EQ(counter, resourceTypes.size());
}
TEST(DiscoveryManagerTest, TaskCanBeCanceled)
{
- ScopedTask aTask = RCSDiscoveryManager::getInstance()->discoverResource(RCSAddress::multicast(),
- onResourceDiscovered);
- ScopedTask aTaskToBeCanceled = RCSDiscoveryManager::getInstance()->discoverResource(
- RCSAddress::multicast(), onResourceDiscovered);
+ ScopedTask aTask {RCSDiscoveryManager::getInstance()->discoverResource(RCSAddress::multicast(),
+ onResourceDiscovered)};
+ ScopedTask aTaskToBeCanceled {RCSDiscoveryManager::getInstance()->discoverResource(
+ RCSAddress::multicast(), onResourceDiscovered)};
aTaskToBeCanceled->cancel();
}
).Return(OC_STACK_OK);
- ScopedTask aTask = RCSDiscoveryManager::getInstance()->discoverResource(RCSAddress::multicast(),
- onResourceDiscovered);
+ ScopedTask aTask {RCSDiscoveryManager::getInstance()->discoverResource(RCSAddress::multicast(),
+ onResourceDiscovered)};
std::vector< std::string > interfaces{ "interface" };
std::vector< std::string > resourceTypes{ "resource.type" };