HostingObject::Ptr instance;
RCSRemoteResourceObject::Ptr discoveredResource;
- void onDestroy(){ }
+ std::condition_variable responseCon;
+
+ void onDestroy() { }
void onDiscoveryResource(RCSRemoteResourceObject::Ptr){ }
void onUpdatedCache(const RCSResourceAttributes &) { }
+ void onSetAttributes(const RCSResourceAttributes &, int) { }
void setup()
{
{
public:
std::mutex mutexForCondition;
- std::condition_variable responseCon;
protected:
EXPECT_EQ(result.toString(), settingValue.toString());
}
+
+TEST_F(HostingObjectTest, SetDataToMirroredResource)
+{
+ int waitForResponse = 1000;
+ RCSResourceAttributes::Value result = { };
+
+ mocks.ExpectCallFunc(onSetAttributes).Do(
+ [this, & result](const RCSResourceAttributes &att, int)
+ {
+ result = att.at(TEST_ATT_KEY);
+ notifyCondition();
+ });
+ RCSResourceAttributes setAttrs;
+ RCSResourceAttributes::Value settingValue = 20;
+ setAttrs[TEST_ATT_KEY] = settingValue;
+ discoveredResource->setRemoteAttributes(setAttrs, onSetAttributes);
+ waitForCondition(waitForResponse);
+
+ EXPECT_EQ(result.toString(), settingValue.toString());
+}
+
+TEST_F(HostingObjectTest, ExpectCallOnDestroyWhenStopHostingObject)
+{
+ int waitForResponse = 1000;
+
+ mocks.ExpectCallFunc(onDestroy).Do(
+ [& responseCon]()
+ {
+ responseCon.notify_all();
+ });
+
+ testObject.destroy();
+ instance.reset();
+ waitForCondition(waitForResponse);
+}
hosting_test = hosting_test_env.Program('hosting_test', hosting_test_src)
Alias("hosting_test", hosting_test)
env.AppendTarget('hosting_test')
-hosting_test_env.InstallTarget(hosting_test, 'hosting_test')
if env.get('TEST') == '1':
target_os = env.get('TARGET_OS')