unittest: fix a crash issue 15/259915/2
authorSeonah Moon <seonah1.moon@samsung.com>
Wed, 16 Jun 2021 11:30:40 +0000 (20:30 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Thu, 17 Jun 2021 02:33:05 +0000 (11:33 +0900)
Change-Id: Ifa02a44987f082e3ca9577c11c87f244c91d6d6b

tests/unittest/mocks/vine-mock-data-path-plugin.cpp
tests/unittest/vine-unittest-capabilities.cpp

index db13024..f43b3a8 100644 (file)
@@ -88,6 +88,39 @@ static int __mock_data_path_plugin_close(vine_dp_plugin_h handle)
        return VINE_DATA_PATH_ERROR_NONE;
 }
 
+static int __mock_data_path_plugin_get_local_addr(vine_dp_plugin_h handle,
+               int *addr_family, char local_ip[], int *port)
+{
+       if (!handle || !addr_family || !local_ip || !port)
+               return VINE_DATA_PATH_ERROR_INVALID_PARAMETER;
+
+       return VINE_DATA_PATH_ERROR_NONE;
+}
+
+static int __mock_data_path_plugin_set_token(vine_dp_plugin_h handle, const char *token)
+{
+       if (!handle || !token)
+               return VINE_DATA_PATH_ERROR_INVALID_PARAMETER;
+
+       return VINE_DATA_PATH_ERROR_NONE;
+}
+
+static int __mock_data_path_plugin_get_token(vine_dp_plugin_h handle, char **token)
+{
+       if (!handle || !token)
+               return VINE_DATA_PATH_ERROR_INVALID_PARAMETER;
+
+       return VINE_DATA_PATH_ERROR_NONE;
+}
+
+static int __mock_data_path_plugin_set_host_name(vine_dp_plugin_h handle, const char *name)
+{
+       if (!handle || !name)
+               return VINE_DATA_PATH_ERROR_INVALID_PARAMETER;
+
+       return VINE_DATA_PATH_ERROR_NONE;
+}
+
 static void __mock_data_path_plugin_process_event(int fd, int events)
 {
        return;
@@ -147,4 +180,10 @@ void __mock_vine_data_path_plugin_init(vine_dp_plugin_fn *fn)
        fn->read = __mock_data_path_plugin_read;
        fn->write = __mock_data_path_plugin_write;
        fn->close = __mock_data_path_plugin_close;
+
+       fn->get_local_address_info = __mock_data_path_plugin_get_local_addr;
+
+       fn->set_token = __mock_data_path_plugin_set_token;
+       fn->get_token = __mock_data_path_plugin_get_token;
+       fn->set_host_name = __mock_data_path_plugin_set_host_name;
 }
index b62ba8f..1cc6d6b 100755 (executable)
@@ -24,11 +24,13 @@ class VineCapaTest : public ::testing::Test {
 protected:
        void SetUp() override
        {
+               vine_mock_set_memory_result(true);
                vine_initialize();
        }
 
        void TearDown() override
        {
+               vine_mock_set_memory_result(true);
                vine_deinitialize();
        }
 };