#include <system_info.h>
#include <d2d_conv_manager.h>
+#define ARRAY_SIZE(name) (sizeof(name) / sizeof(name[0]))
+
static bool g_feature;
static GMainLoop *g_mainloop = NULL;
+conv_service_e service_types[] = {
+// CONV_SERVICE_NONE, /**< Undefined service */
+ CONV_SERVICE_APP_TO_APP_COMMUNICATION, /**< App-to-app communication service */
+ CONV_SERVICE_REMOTE_APP_CONTROL, /**< Remote app-control service */
+// CONV_SERVICE_REMOTE_INTERACTION, /**< Remote Interaction service */
+};
+
static void test_service_connected_cb(conv_service_h service_handle, conv_error_e error, conv_payload_h result, void* user_data)
{
return ;
*/
int utc_d2d_conv_manager_conv_service_get_type_p(void)
{
+ int i;
int ret = CONV_ERROR_NONE;
conv_service_h handle;
- conv_service_e value = CONV_SERVICE_APP_TO_APP_COMMUNICATION;
- conv_service_e value_2;
+ conv_service_e value;
if (g_feature == false) {
- ret = conv_service_get_type(handle, &value_2);
+ ret = conv_service_get_type(handle, &value);
assert_eq(ret, CONV_ERROR_NOT_SUPPORTED);
return 0;
}
- ret = conv_service_create(&handle);
- assert_eq(ret, CONV_ERROR_NONE);
+ for (i = 0; i < ARRAY_SIZE(service_types); i++) {
+ ret = conv_service_create(&handle);
+ assert_eq(ret, CONV_ERROR_NONE);
- ret = conv_service_set_type(handle, value);
- assert_eq(ret, CONV_ERROR_NONE);
+ ret = conv_service_set_type(handle, service_types[i]);
+ assert_eq(ret, CONV_ERROR_NONE);
- ret = conv_service_get_type(handle, &value_2);
- assert_eq(ret, CONV_ERROR_NONE);
+ ret = conv_service_get_type(handle, &value);
+ assert_eq(ret, CONV_ERROR_NONE);
- ret = conv_service_destroy(handle);
- assert_eq(ret, CONV_ERROR_NONE);
+ ret = conv_service_destroy(handle);
+ assert_eq(ret, CONV_ERROR_NONE);
+ }
return 0;
}
*/
int utc_d2d_conv_manager_conv_service_get_type_n1(void)
{
+ int i;
int ret = CONV_ERROR_NONE;
conv_service_h handle;
- conv_service_e value = CONV_SERVICE_APP_TO_APP_COMMUNICATION;
- conv_service_e value_2;
+ conv_service_e value;
if (g_feature == false) {
- ret = conv_service_get_type(NULL, &value_2);
+ ret = conv_service_get_type(NULL, &value);
assert_eq(ret, CONV_ERROR_NOT_SUPPORTED);
return 0;
}
- ret = conv_service_create(&handle);
- assert_eq(ret, CONV_ERROR_NONE);
+ for (i = 0; i < ARRAY_SIZE(service_types); i++) {
+ ret = conv_service_create(&handle);
+ assert_eq(ret, CONV_ERROR_NONE);
- ret = conv_service_set_type(handle, value);
- assert_eq(ret, CONV_ERROR_NONE);
+ ret = conv_service_set_type(handle, service_types[i]);
+ assert_eq(ret, CONV_ERROR_NONE);
- ret = conv_service_get_type(NULL, &value_2);
- assert_eq(ret, CONV_ERROR_INVALID_PARAMETER);
+ ret = conv_service_get_type(NULL, &value);
+ assert_eq(ret, CONV_ERROR_INVALID_PARAMETER);
- ret = conv_service_destroy(handle);
- assert_eq(ret, CONV_ERROR_NONE);
+ ret = conv_service_destroy(handle);
+ assert_eq(ret, CONV_ERROR_NONE);
+ }
return 0;
}
*/
int utc_d2d_conv_manager_conv_service_get_type_n2(void)
{
+ int i;
int ret = CONV_ERROR_NONE;
conv_service_h handle;
- conv_service_e value = CONV_SERVICE_APP_TO_APP_COMMUNICATION;
if (g_feature == false) {
ret = conv_service_get_type(handle, NULL);
return 0;
}
- ret = conv_service_create(&handle);
- assert_eq(ret, CONV_ERROR_NONE);
+ for (i = 0; i < ARRAY_SIZE(service_types); i++) {
+ ret = conv_service_create(&handle);
+ assert_eq(ret, CONV_ERROR_NONE);
- ret = conv_service_set_type(handle, value);
- assert_eq(ret, CONV_ERROR_NONE);
+ ret = conv_service_set_type(handle, service_types[i]);
+ assert_eq(ret, CONV_ERROR_NONE);
- ret = conv_service_get_type(handle, NULL);
- assert_eq(ret, CONV_ERROR_INVALID_PARAMETER);
+ ret = conv_service_get_type(handle, NULL);
+ assert_eq(ret, CONV_ERROR_INVALID_PARAMETER);
- ret = conv_service_destroy(handle);
- assert_eq(ret, CONV_ERROR_NONE);
+ ret = conv_service_destroy(handle);
+ assert_eq(ret, CONV_ERROR_NONE);
+ }
return 0;
}
*/
int utc_d2d_conv_manager_conv_service_set_type_p(void)
{
+ int i;
int ret = CONV_ERROR_NONE;
conv_service_h handle;
- conv_service_e value = CONV_SERVICE_APP_TO_APP_COMMUNICATION;
if (g_feature == false) {
- ret = conv_service_set_type(handle, value);
- assert_eq(ret, CONV_ERROR_NOT_SUPPORTED);
+ for (i = 0; i < ARRAY_SIZE(service_types); i++) {
+ ret = conv_service_set_type(handle, service_types[i]);
+ assert_eq(ret, CONV_ERROR_NOT_SUPPORTED);
+ }
return 0;
}
- ret = conv_service_create(&handle);
- assert_eq(ret, CONV_ERROR_NONE);
+ for (i = 0; i < ARRAY_SIZE(service_types); i++) {
+ ret = conv_service_create(&handle);
+ assert_eq(ret, CONV_ERROR_NONE);
- ret = conv_service_set_type(handle, value);
- assert_eq(ret, CONV_ERROR_NONE);
+ ret = conv_service_set_type(handle, service_types[i]);
+ assert_eq(ret, CONV_ERROR_NONE);
- ret = conv_service_destroy(handle);
- assert_eq(ret, CONV_ERROR_NONE);
+ ret = conv_service_destroy(handle);
+ assert_eq(ret, CONV_ERROR_NONE);
+ }
return 0;
}
*/
int utc_d2d_conv_manager_conv_service_set_type_n1(void)
{
+ int i;
int ret = CONV_ERROR_NONE;
conv_service_h handle;
- conv_service_e value = CONV_SERVICE_APP_TO_APP_COMMUNICATION;
if (g_feature == false) {
- ret = conv_service_set_type(NULL, value);
- assert_eq(ret, CONV_ERROR_NOT_SUPPORTED);
+ for (i = 0; i < ARRAY_SIZE(service_types); i++) {
+ ret = conv_service_set_type(NULL, service_types[i]);
+ assert_eq(ret, CONV_ERROR_NOT_SUPPORTED);
+ }
return 0;
}
- ret = conv_service_create(&handle);
- assert_eq(ret, CONV_ERROR_NONE);
+ for (i = 0; i < ARRAY_SIZE(service_types); i++) {
+ ret = conv_service_create(&handle);
+ assert_eq(ret, CONV_ERROR_NONE);
- ret = conv_service_set_type(NULL, value);
- assert_eq(ret, CONV_ERROR_INVALID_PARAMETER);
+ ret = conv_service_set_type(NULL, service_types[i]);
+ assert_eq(ret, CONV_ERROR_INVALID_PARAMETER);
- ret = conv_service_destroy(handle);
- assert_eq(ret, CONV_ERROR_NONE);
+ ret = conv_service_destroy(handle);
+ assert_eq(ret, CONV_ERROR_NONE);
+ }
return 0;
}
*/
int utc_d2d_conv_manager_conv_service_set_listener_cb_p(void)
{
+ int i;
int ret = CONV_ERROR_NONE;
conv_service_h handle;
void *user_data = NULL;
- conv_service_e value = CONV_SERVICE_APP_TO_APP_COMMUNICATION;
if (g_feature == false) {
ret = conv_service_set_listener_cb(handle, test_service_listener_cb, user_data);
return 0;
}
- ret = conv_service_create(&handle);
- assert_eq(ret, CONV_ERROR_NONE);
+ for (i = 0; i < ARRAY_SIZE(service_types); i++) {
+ ret = conv_service_create(&handle);
+ assert_eq(ret, CONV_ERROR_NONE);
- ret = conv_service_set_type(handle, value);
- assert_eq(ret, CONV_ERROR_NONE);
+ ret = conv_service_set_type(handle, service_types[i]);
+ assert_eq(ret, CONV_ERROR_NONE);
- ret = conv_service_set_listener_cb(handle, test_service_listener_cb, user_data);
- assert_eq(ret, CONV_ERROR_NONE);
+ ret = conv_service_set_listener_cb(handle, test_service_listener_cb, user_data);
+ assert_eq(ret, CONV_ERROR_NONE);
- ret = conv_service_unset_listener_cb(handle);
- assert_eq(ret, CONV_ERROR_NONE);
+ ret = conv_service_unset_listener_cb(handle);
+ assert_eq(ret, CONV_ERROR_NONE);
- ret = conv_service_destroy(handle);
- assert_eq(ret, CONV_ERROR_NONE);
+ ret = conv_service_destroy(handle);
+ assert_eq(ret, CONV_ERROR_NONE);
+ }
return 0;
}
*/
int utc_d2d_conv_manager_conv_service_unset_listener_cb_p(void)
{
+ int i;
int ret = CONV_ERROR_NONE;
conv_service_h handle;
void *user_data = NULL;
- conv_service_e value = CONV_SERVICE_APP_TO_APP_COMMUNICATION;
if (g_feature == false) {
ret = conv_service_unset_listener_cb(handle);
return 0;
}
- ret = conv_service_create(&handle);
- assert_eq(ret, CONV_ERROR_NONE);
+ for (i = 0; i < ARRAY_SIZE(service_types); i++) {
+ ret = conv_service_create(&handle);
+ assert_eq(ret, CONV_ERROR_NONE);
- ret = conv_service_set_type(handle, value);
- assert_eq(ret, CONV_ERROR_NONE);
+ ret = conv_service_set_type(handle, service_types[i]);
+ assert_eq(ret, CONV_ERROR_NONE);
- ret = conv_service_set_listener_cb(handle, test_service_listener_cb, user_data);
- assert_eq(ret, CONV_ERROR_NONE);
+ ret = conv_service_set_listener_cb(handle, test_service_listener_cb, user_data);
+ assert_eq(ret, CONV_ERROR_NONE);
- ret = conv_service_unset_listener_cb(handle);
- assert_eq(ret, CONV_ERROR_NONE);
+ ret = conv_service_unset_listener_cb(handle);
+ assert_eq(ret, CONV_ERROR_NONE);
- ret = conv_service_destroy(handle);
- assert_eq(ret, CONV_ERROR_NONE);
+ ret = conv_service_destroy(handle);
+ assert_eq(ret, CONV_ERROR_NONE);
+ }
return 0;
}