diff options
author | Cheoleun Moon <chleun.moon@samsung.com> | 2020-06-16 11:41:19 +0900 |
---|---|---|
committer | Cheoleun Moon <chleun.moon@samsung.com> | 2020-06-16 13:05:11 +0900 |
commit | 65d9080532d342a7986a32e08f8877fc987d0211 (patch) | |
tree | 982d44f3ab5584b4046c1404211e0d75e869080a /src | |
parent | e3644d9164fd2a5ec0b27660d3cd036bad9d043f (diff) | |
download | wifi-aware-65d9080532d342a7986a32e08f8877fc987d0211.tar.gz wifi-aware-65d9080532d342a7986a32e08f8877fc987d0211.tar.bz2 wifi-aware-65d9080532d342a7986a32e08f8877fc987d0211.zip |
Add the first unittest codes
- Add a mock for system_info_get_platform_bool
- Add a mock for wifi_aware_gdbus_init
- Add mocks for g_bus_get_sync, g_dbus_connection_call and g_dbus_connection_call_finish
Change-Id: I00d46dfde0fc112bcec140a5a2349857589c48b8
Diffstat (limited to 'src')
-rw-r--r-- | src/wifi-aware-data-path.c | 4 | ||||
-rw-r--r-- | src/wifi-aware-gdbus.c | 7 | ||||
-rw-r--r-- | src/wifi-aware-peer.c | 2 | ||||
-rw-r--r-- | src/wifi-aware-private.c | 8 |
4 files changed, 4 insertions, 17 deletions
diff --git a/src/wifi-aware-data-path.c b/src/wifi-aware-data-path.c index fe565e6..949f9aa 100644 --- a/src/wifi-aware-data-path.c +++ b/src/wifi-aware-data-path.c @@ -69,7 +69,6 @@ static bool __is_valid_wifi_aware_security_type(wifi_aware_security_type_e secur && security_type <= WIFI_AWARE_SECURITY_TYPE_PMK; } -//LCOV_EXCL_START static uint32_t __data_path_get_ndp_id(wifi_aware_data_path_h data_path) { wifi_aware_data_path_s *ndp = (wifi_aware_data_path_s *)data_path; @@ -471,9 +470,8 @@ int _wifi_aware_data_path_unset_terminated_cb(wifi_aware_data_path_h data_path) wifi_aware_gdbus_deregister_signal(DATA_PATH_TERMINATED_SIGNAL); ndp->terminated_signal_id = 0; - + __WIFI_AWARE_FUNC_ENTER__; return ret; } -//LCOV_EXCL_STOP diff --git a/src/wifi-aware-gdbus.c b/src/wifi-aware-gdbus.c index 1afed63..96777e9 100644 --- a/src/wifi-aware-gdbus.c +++ b/src/wifi-aware-gdbus.c @@ -109,14 +109,14 @@ int wifi_aware_gdbus_init() if (gdbus_data.connection != NULL) { WIFI_AWARE_LOGI("There's already gdbus connection"); //LCOV_EXCL_LINE __WIFI_AWARE_FUNC_EXIT__; //LCOV_EXCL_LINE - return 0; + return WIFI_AWARE_ERROR_NONE; } gdbus_data.connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error); if (gdbus_data.connection == NULL) { WIFI_AWARE_LOGI("Failed to get connection, Error[%s]\n", error->message); //LCOV_EXCL_LINE g_error_free(error); //LCOV_EXCL_LINE - return -1; + return WIFI_AWARE_ERROR_OPERATION_FAILED; } gdbus_data.cancellable = g_cancellable_new(); @@ -675,7 +675,6 @@ int wifi_aware_gdbus_update_subscribe(wifi_aware_session_h session, return ret; } -//LCOV_EXCL_START int wifi_aware_gdbus_followup(wifi_aware_session_h session, int client_id, uint16_t pub_sub_id, unsigned int peer_id, const unsigned char *message, size_t len, @@ -819,4 +818,4 @@ int wifi_aware_gdbus_ndp_close(wifi_aware_data_path_h data_path, __WIFI_AWARE_FUNC_EXIT__; return ret; } -//LCOV_EXCL_STOP + diff --git a/src/wifi-aware-peer.c b/src/wifi-aware-peer.c index a2c5ad6..ec318f5 100644 --- a/src/wifi-aware-peer.c +++ b/src/wifi-aware-peer.c @@ -28,7 +28,6 @@ typedef struct { unsigned char mac[WIFI_AWARE_MAC_ADDRESS_LEN]; } wifi_aware_peer_s; -//LCOV_EXCL_START int _wifi_aware_peer_create(wifi_aware_peer_h *peer, unsigned int peer_id) { wifi_aware_peer_s *peer_handle = (wifi_aware_peer_s *)g_try_malloc0(sizeof(wifi_aware_peer_s)); @@ -109,4 +108,3 @@ void _wifi_aware_peer_set_mac(wifi_aware_peer_h peer, unsigned char *mac) wifi_aware_peer_s *handle = (wifi_aware_peer_s *)peer; memcpy(handle->mac, mac, WIFI_AWARE_MAC_ADDRESS_LEN); } -//LCOV_EXCL_STOP diff --git a/src/wifi-aware-private.c b/src/wifi-aware-private.c index 0ee8cfc..452b9ee 100644 --- a/src/wifi-aware-private.c +++ b/src/wifi-aware-private.c @@ -359,7 +359,6 @@ static void __wifi_aware_publish_invoke_callback(wifi_aware_session_h session, } } -//LCOV_EXCL_START static void __wifi_aware_discovered_cb(wifi_aware_session_h session, wifi_aware_peer_h peer, const unsigned char *specific_info, size_t specific_info_len, int distance) { @@ -392,7 +391,6 @@ static void __wifi_aware_session_terminated_cb(wifi_aware_session_h session, int if (handle->terminated_cb) handle->terminated_cb(session, reason, handle->terminated_cb_data); } -//LCOV_EXCL_STOP static wifi_aware_error_e __get_dbus_result(GObject *src, GAsyncResult *res, uint16_t *id) { @@ -689,7 +687,6 @@ static void __parsing_session_terminated_event(GVariant *parameters, uint16_t *p g_variant_get(parameters, "(qi)", pub_sub_id, reason); } -//LCOV_EXCL_START static void __session_terminated_cb(GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface, const gchar *signal, @@ -711,7 +708,6 @@ static void __session_terminated_cb(GDBusConnection *connection, __session_set_pub_sub_id(session, 0); __wifi_aware_session_terminated_cb(session, (wifi_aware_termination_reason_e)reason); } -//LCOV_EXCL_STOP void _wifi_aware_session_set_terminated_cb(wifi_aware_session_h session, wifi_aware_session_terminated_cb callback, void *user_data) @@ -1093,7 +1089,6 @@ static bool __unpack_byte_array(unsigned char *array, GVariant *var, uint16_t le return true; } -//LCOV_EXCL_START static bool __parsing_service_discovered_event(GVariant *parameters, uint16_t *sub_id, unsigned int *peer_id, unsigned char *peer_mac, unsigned char *specific_info, size_t *specific_info_len, int *distance) @@ -1243,7 +1238,6 @@ static void __message_received_cb(GDBusConnection *connection, _wifi_aware_peer_set_mac(peer, peer_mac); __wifi_aware_received_cb(session, peer, message, message_len); } -//LCOV_EXCL_STOP int _wifi_aware_set_service_discovered_cb(wifi_aware_session_h session, wifi_aware_service_discovered_cb callback, void *user_data) @@ -1327,7 +1321,6 @@ void __destroy_message_data(wifi_aware_message_s *message) g_free(message); } -//LCOV_EXCL_START static void __wifi_aware_followup_invoke_callback(wifi_aware_message_s *message, wifi_aware_error_e error) { if (message && message->callback) { @@ -1392,4 +1385,3 @@ int _wifi_aware_send_message(wifi_aware_session_h session, __send_message_reply, message_data); } -//LCOV_EXCL_STOP |