test/unittest: Add l2cap le utc 55/275055/2 accepted/tizen/unified/20220615.135357 submit/tizen/20220531.044319 submit/tizen/20220601.225953 submit/tizen/20220614.010252
authorWootak Jung <wootak.jung@samsung.com>
Mon, 16 May 2022 05:15:45 +0000 (14:15 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Mon, 16 May 2022 06:06:53 +0000 (15:06 +0900)
[   44s] Success [ 581 /  581]
[   44s] Error   [   0 /  581]

Change-Id: I59aca60b6e5f7653ae70580c2d87b6ee88f11872

tests/unittest/mock/bluetooth-mock.c
tests/unittest/tct-bluetooth-core_mobile.h
tests/unittest/utc_bluetooth_le_l2cap_negative.c [new file with mode: 0644]
tests/unittest/utc_bluetooth_le_l2cap_positive.c [new file with mode: 0644]

index ae51fae..546d050 100644 (file)
@@ -115,6 +115,11 @@ API int bluetooth_check_adapter(void)
        return BLUETOOTH_ADAPTER_ENABLED;
 }
 
+API int bluetooth_check_adapter_le(void)
+{
+       return BLUETOOTH_ADAPTER_ENABLED;
+}
+
 API int bluetooth_get_local_address(bluetooth_device_address_t *local_address)
 {
        memcpy(local_address->addr, g_remote_addr, BLUETOOTH_ADDRESS_LENGTH);
@@ -729,6 +734,16 @@ API int bluetooth_rfcomm_listen_and_accept(int id, int max_pending_connection)
        return BLUETOOTH_ERROR_NONE;
 }
 
+API int bluetooth_l2cap_le_listen(int id, int max_pending_connection)
+{
+       return BLUETOOTH_ERROR_NONE;
+}
+
+API int bluetooth_l2cap_le_listen_and_accept(int id, int max_pending_connection)
+{
+       return BLUETOOTH_ERROR_NONE;
+}
+
 API int bluetooth_rfcomm_connect(
                const bluetooth_device_address_t *remote_bt_address,
                const char *remote_uuid)
index d2dc15f..c179f88 100644 (file)
@@ -67,6 +67,10 @@ extern void utc_bluetooth_socket_negative_startup(void);
 extern void utc_bluetooth_socket_negative_cleanup(void);
 extern void utc_bluetooth_bt_socket_positive_startup(void);
 extern void utc_bluetooth_bt_socket_positive_cleanup(void);
+extern void utc_bluetooth_bt_socket_l2cap_channel_negative_startup(void);
+extern void utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup(void);
+extern void utc_bluetooth_bt_socket_l2cap_channel_positive_startup(void);
+extern void utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup(void);
 extern void utc_bluetooth_avrcp_control_positive_startup(void);
 extern void utc_bluetooth_avrcp_control_positive_cleanup(void);
 extern void utc_bluetooth_avrcp_control_negative_startup(void);
@@ -486,6 +490,31 @@ extern int utc_bluetooth_bt_socket_unset_data_received_cb_p(void);
 extern int utc_bluetooth_bt_socket_unset_connection_state_changed_cb_p(void);
 extern int utc_bluetooth_bt_socket_set_connection_requested_cb_p(void);
 extern int utc_bluetooth_bt_socket_unset_connection_requested_cb_p(void);
+extern int utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n(void);
+extern int utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n1(void);
+extern int utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_n(void);
+extern int utc_bluetooth_bt_socket_create_l2cap_channel_n(void);
+extern int utc_bluetooth_bt_socket_create_l2cap_channel_n1(void);
+extern int utc_bluetooth_bt_socket_destroy_l2cap_channel_n(void);
+extern int utc_bluetooth_bt_socket_listen_l2cap_channel_n(void);
+extern int utc_bluetooth_bt_socket_accept_l2cap_channel_n(void);
+extern int utc_bluetooth_bt_socket_reject_l2cap_channel_n(void);
+extern int utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_n(void);
+extern int utc_bluetooth_bt_socket_get_l2cap_psm_n(void);
+extern int utc_bluetooth_bt_socket_connect_l2cap_channel_n(void);
+extern int utc_bluetooth_bt_socket_disconnect_l2cap_channel_n(void);
+extern int utc_bluetooth_bt_socket_send_data_l2cap_channel_n(void);
+extern int utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_n(void);
+extern int utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_n(void);
+extern int utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_p(void);
+extern int utc_bluetooth_bt_socket_create_l2cap_channel_p(void);
+extern int utc_bluetooth_bt_socket_listen_l2cap_channel_p(void);
+extern int utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_p(void);
+extern int utc_bluetooth_bt_socket_get_l2cap_psm_p(void);
+extern int utc_bluetooth_bt_socket_destroy_l2cap_channel_p(void);
+extern int utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_p(void);
+extern int utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_p(void);
+extern int utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_p(void);
 extern int utc_bluetooth_bt_avrcp_control_initialize_p(void);
 extern int utc_bluetooth_bt_avrcp_control_deinitialize_p(void);
 extern int utc_bluetooth_bt_avrcp_control_connect_n(void);
@@ -1051,6 +1080,31 @@ testcase tc_array[] = {
        {"utc_bluetooth_bt_socket_unset_connection_state_changed_cb_p",utc_bluetooth_bt_socket_unset_connection_state_changed_cb_p,utc_bluetooth_bt_socket_positive_startup,utc_bluetooth_bt_socket_positive_cleanup},
        {"utc_bluetooth_bt_socket_set_connection_requested_cb_p",utc_bluetooth_bt_socket_set_connection_requested_cb_p,utc_bluetooth_bt_socket_positive_startup,utc_bluetooth_bt_socket_positive_cleanup},
        {"utc_bluetooth_bt_socket_unset_connection_requested_cb_p",utc_bluetooth_bt_socket_unset_connection_requested_cb_p,utc_bluetooth_bt_socket_positive_startup,utc_bluetooth_bt_socket_positive_cleanup},
+       {"utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n",utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup},
+       {"utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n1",utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n1,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup},
+       {"utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_n",utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup},
+       {"utc_bluetooth_bt_socket_create_l2cap_channel_n",utc_bluetooth_bt_socket_create_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup},
+       {"utc_bluetooth_bt_socket_create_l2cap_channel_n1",utc_bluetooth_bt_socket_create_l2cap_channel_n1,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup},
+       {"utc_bluetooth_bt_socket_destroy_l2cap_channel_n",utc_bluetooth_bt_socket_destroy_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup},
+       {"utc_bluetooth_bt_socket_listen_l2cap_channel_n",utc_bluetooth_bt_socket_listen_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup},
+       {"utc_bluetooth_bt_socket_accept_l2cap_channel_n",utc_bluetooth_bt_socket_accept_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup},
+       {"utc_bluetooth_bt_socket_reject_l2cap_channel_n",utc_bluetooth_bt_socket_reject_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup},
+       {"utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_n",utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup},
+       {"utc_bluetooth_bt_socket_get_l2cap_psm_n",utc_bluetooth_bt_socket_get_l2cap_psm_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup},
+       {"utc_bluetooth_bt_socket_connect_l2cap_channel_n",utc_bluetooth_bt_socket_connect_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup},
+       {"utc_bluetooth_bt_socket_disconnect_l2cap_channel_n",utc_bluetooth_bt_socket_disconnect_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup},
+       {"utc_bluetooth_bt_socket_send_data_l2cap_channel_n",utc_bluetooth_bt_socket_send_data_l2cap_channel_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup},
+       {"utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_n",utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup},
+       {"utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_n",utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_n,utc_bluetooth_bt_socket_l2cap_channel_negative_startup,utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup},
+       {"utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_p",utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup},
+       {"utc_bluetooth_bt_socket_create_l2cap_channel_p",utc_bluetooth_bt_socket_create_l2cap_channel_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup},
+       {"utc_bluetooth_bt_socket_listen_l2cap_channel_p",utc_bluetooth_bt_socket_listen_l2cap_channel_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup},
+       {"utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_p",utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup},
+       {"utc_bluetooth_bt_socket_get_l2cap_psm_p",utc_bluetooth_bt_socket_get_l2cap_psm_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup},
+       {"utc_bluetooth_bt_socket_destroy_l2cap_channel_p",utc_bluetooth_bt_socket_destroy_l2cap_channel_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup},
+       {"utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_p",utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup},
+       {"utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_p",utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup},
+       {"utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_p",utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_p,utc_bluetooth_bt_socket_l2cap_channel_positive_startup,utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup},
        {"utc_bluetooth_bt_avrcp_control_initialize_p",utc_bluetooth_bt_avrcp_control_initialize_p,utc_bluetooth_avrcp_control_positive_startup,utc_bluetooth_avrcp_control_positive_cleanup},
        {"utc_bluetooth_bt_avrcp_control_deinitialize_p",utc_bluetooth_bt_avrcp_control_deinitialize_p,utc_bluetooth_avrcp_control_positive_startup,utc_bluetooth_avrcp_control_positive_cleanup},
        {"utc_bluetooth_bt_avrcp_control_connect_n",utc_bluetooth_bt_avrcp_control_connect_n,utc_bluetooth_avrcp_control_negative_startup,utc_bluetooth_avrcp_control_negative_cleanup},
diff --git a/tests/unittest/utc_bluetooth_le_l2cap_negative.c b/tests/unittest/utc_bluetooth_le_l2cap_negative.c
new file mode 100644 (file)
index 0000000..384ac8d
--- /dev/null
@@ -0,0 +1,520 @@
+//
+// Copyright (c) 2022 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "assert_local.h"
+#include <bluetooth.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <glib.h>
+#include <string.h>
+#include <system_info.h>
+
+static int startup_flag = BT_ERROR_NONE;
+static int ret = BT_ERROR_NONE;
+static const char *data = "dts_test";
+static char *address = "D8:90:E8:EE:2B:3A";
+static bool bt_supported = false;
+static bool le_supported = false;
+static bool le_coc_supported = false;
+
+/**
+ * @function           utc_bluetooth_bt_socket_l2cap_channel_negative_startup
+ * @description        Get system information to check for the support of Bluetooth. If BT is supported on the device,
+ *                             then intialize the bluetooth on the device successfully.
+ * @parameter       NA
+ * @return          NA
+ */
+void utc_bluetooth_bt_socket_l2cap_channel_negative_startup(void)
+{
+       bt_supported = false;
+       system_info_get_platform_bool("http://tizen.org/feature/network.bluetooth", &bt_supported);
+
+       le_supported = false;
+       system_info_get_platform_bool("http://tizen.org/feature/network.bluetooth.le", &le_supported);
+
+       le_coc_supported = false;
+       system_info_get_platform_bool("http://tizen.org/feature/network.bluetooth.le.coc", &le_coc_supported);
+
+       startup_flag = BT_ERROR_NONE;
+
+       if(bt_supported && le_supported && le_coc_supported) {
+        ret = bt_initialize();
+        if(BT_ERROR_NONE != ret) {
+            fprintf(stderr, "Startup error at %s:%d\n", __FILE__, __LINE__);
+            fprintf(stderr, "bt_initialize failed (code: %d)\n", ret);
+            startup_flag = ret;
+            return;
+        }
+    }
+}
+
+/**
+ * @function           utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup
+ * @description        Get system information to check for the support of Bluetooth. If BT is supported on the device,
+ *                             then deintialize the bluetooth on the device successfully.
+ * @parameter       NA
+ * @return          NA
+ */
+void utc_bluetooth_bt_socket_l2cap_channel_negative_cleanup(void)
+{
+       if(bt_supported && le_supported && le_coc_supported)
+               bt_deinitialize();
+}
+
+/**
+ * @testcase           utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n
+ * @since_tizen        7.0
+ * @description        Get system information to check for the support of Bluetooth. If BT is not supported on the device, set the connection
+ *                             state changed callback and check for error. If bluetooth is initialized, set connection state changed callback with NULL params.
+ * @senario            Check if BT is supported and then set bt_socket_l2cap_channel_set_connection_state_changed_cb with NULL parameters.
+ *                             Check for error BT_ERROR_INVALID_PARAMETER.
+ */
+int utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n(void)
+{
+       if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_set_l2cap_channel_connection_state_changed_cb(NULL, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_deinitialize();
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_socket_set_l2cap_channel_connection_state_changed_cb(NULL, NULL);
+       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_bluetooth_bt_socket_l2cap_channel_set_connection_state_changed_cb_n1
+ * @since_tizen        7.0
+ * @description        Get system information to check for the support of Bluetooth. If BT is not supported on the device, set the connection
+ *                             state changed callback and check for error. If bluetooth is initialized, set connection state changed callback with NULL params.
+ * @senario            Check if BT is supported and then set bt_socket_l2cap_channel_set_connection_state_changed_cb with NULL parameters.
+ *                             Check for error BT_ERROR_INVALID_PARAMETER.
+ */
+int utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_n1(void)
+{
+    if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_set_l2cap_channel_connection_state_changed_cb(NULL, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_socket_set_l2cap_channel_connection_state_changed_cb(NULL, NULL);
+       assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_bluetooth_bt_socket_l2cap_channel_unset_connection_state_changed_cb_n
+ * @since_tizen        7.0
+ * @description        Get system information to check for the support of Bluetooth. If BT is not supported on the device,
+ *                             unset the connection state changed callback and check for error. If bluetooth is initialized, deinitialize
+ *                             bluetooth and unset connection state changed callback.
+ * @senario            Check if BT is supported and then deinitialize bt and unset connection state changed callback on the device
+ *                             and check for BT_ERROR_NOT_INITIALIZED.
+ */
+int utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_n(void)
+{
+       if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_unset_l2cap_channel_connection_state_changed_cb();
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_deinitialize();
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_socket_unset_l2cap_channel_connection_state_changed_cb();
+       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_bluetooth_bt_socket_create_l2cap_channel_n
+ * @since_tizen        7.0
+ * @description        Get system information to check for the support of Bluetooth. If BT is not supported on the device, create l2cap channel
+ *                             and check for error. If bluetooth is initialized, deinitialize bt and create l2cap channel with NULL parameters.
+ * @senario            Check if BT is supported and then deinitialize bluetooth and create l2cap channel on the device and check for BT_ERROR_NOT_INITIALIZED.
+ */
+int utc_bluetooth_bt_socket_create_l2cap_channel_n(void)
+{
+       if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_create_l2cap_channel(0, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_deinitialize();
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_socket_create_l2cap_channel(0, NULL);
+       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_bluetooth_bt_socket_create_l2cap_channel_n1
+ * @since_tizen        7.0
+ * @description        Get system information to check for the support of Bluetooth. If BT is not supported on the device, create l2cap channel
+ *                             and check for error. If bluetooth is initialized, create l2cap channel with NULL parameters.
+ * @senario            Check if BT is supported then create l2cap channel on the device and check for BT_ERROR_INVALID_PARAMETER.
+ */
+int utc_bluetooth_bt_socket_create_l2cap_channel_n1(void)
+{
+       if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_create_l2cap_channel(0, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_socket_create_l2cap_channel(0, NULL);
+       assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_bluetooth_bt_socket_destroy_l2cap_channel_n
+ * @since_tizen        7.0
+ * @description        Get system information to check for the support of Bluetooth. If BT is not supported on the device,
+ *                             destroy the l2cap channel and check for error. If bluetooth is initialized, then destroy l2cap channel
+ *                             with invalid parameter.
+ * @senario            Check if BT is supported and then call bt_socket_destroy_l2cap_channel on the device with invalid parameter.
+ *                             Check for BT_ERROR_INVALID_PARAMETER.
+ */
+int utc_bluetooth_bt_socket_destroy_l2cap_channel_n(void)
+{
+       if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_destroy_l2cap_channel(-1);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_deinitialize();
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_socket_destroy_l2cap_channel(-1);
+       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+
+       return 0;
+}
+
+/**
+ * @testcase            utc_bluetooth_bt_socket_listen_l2cap_channel_n
+ * @since_tizen 7.0
+ * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device,
+ *                              call bt_socket_listen_l2cap_channel and check for error. If bluetooth is initialized, then
+ *                               listen for l2cap connection with invalid paramters.
+ * @senario             Check if BT is supported and then call bt_socket_listen_l2cap_channel on the device with invalid parameters
+ *                              and check for BT_ERROR_INVALID_PARAMETER.
+ */
+int utc_bluetooth_bt_socket_listen_l2cap_channel_n(void)
+{
+       if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_listen_l2cap_channel(1, 1);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_deinitialize();
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_socket_listen_l2cap_channel(1, 1);
+       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+
+       return 0;
+}
+
+/**
+ * @testcase            utc_bluetooth_bt_socket_accept_l2cap_channel_n
+ * @since_tizen 7.0
+ * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device,
+ *                              call bt_socket_accept_l2cap_channel and check for error. If bluetooth is initialized, then
+ *                               accept l2cap connection with invalid paramters.
+ * @senario             Check if BT is supported and then call bt_socket_accept_l2cap_channel on the device with invalid parameters
+ *                              and check for BT_ERROR_INVALID_PARAMETER.
+ */
+int utc_bluetooth_bt_socket_accept_l2cap_channel_n(void)
+{
+       if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_accept_l2cap_channel(1);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_deinitialize();
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_socket_accept_l2cap_channel(1);
+       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+
+       return 0;
+}
+
+/**
+ * @testcase            utc_bluetooth_bt_socket_reject_l2cap_channel_n
+ * @since_tizen 7.0
+ * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device,
+ *                              call bt_socket_reject_l2cap_channel and check for error. If bluetooth is initialized, then
+ *                               reject l2cap connection with invalid paramters.
+ * @senario             Check if BT is supported and then call bt_socket_reject_l2cap_channel on the device with invalid parameters
+ *                              and check for BT_ERROR_INVALID_PARAMETER.
+ */
+int utc_bluetooth_bt_socket_reject_l2cap_channel_n(void)
+{
+       if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_reject_l2cap_channel(1);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_deinitialize();
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_socket_reject_l2cap_channel(1);
+       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_n
+ * @since_tizen        7.0
+ * @description        Get system information to check for the support of Bluetooth. If BT is not supported on the device,
+ *                             call bt_socket_listen_and_accept_l2cap_channel and check for error. If bluetooth is initialized, then
+ *                              listen and accept for l2cap connection with invalid paramters.
+ * @senario            Check if BT is supported and then call bt_socket_listen_and_accept_l2cap_channel on the device with invalid parameters
+ *                             and check for BT_ERROR_INVALID_PARAMETER.
+ */
+int utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_n(void)
+{
+       if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_listen_and_accept_l2cap_channel(1, 1);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_deinitialize();
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_socket_listen_and_accept_l2cap_channel(1, 1);
+       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+
+       return 0;
+}
+
+/**
+ * @testcase            utc_bluetooth_bt_socket_get_l2cap_psm_n
+ * @since_tizen 7.0
+ * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device,
+ *                              call bt_socket_get_l2cap_psm and check for error. If bluetooth is initialized, then
+ *                               get psm for l2cap connection with invalid paramters.
+ * @senario             Check if BT is supported and then call bt_socket_get_l2cap_psm on the device with invalid parameters
+ *                              and check for BT_ERROR_INVALID_PARAMETER.
+ */
+int utc_bluetooth_bt_socket_get_l2cap_psm_n(void)
+{
+       int psm = -1;
+       if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_get_l2cap_psm(1, &psm);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_deinitialize();
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_socket_get_l2cap_psm(1, &psm);
+       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_bluetooth_bt_socket_connect_l2cap_channel_n
+ * @since_tizen        7.0
+ * @description        Get system information to check for the support of Bluetooth. If BT is not supported on the device,
+ *                             call bt_socket_connect_l2cap_channel and check for error. If bluetooth is initialized, then
+ *                             call l2cap connect api with invalid paramters.
+ * @senario            Check if BT is supported and then call bt_socket_connect_l2cap_channel on the device with invalid parameters
+ *                             and check for BT_ERROR_INVALID_PARAMETER.
+ */
+int utc_bluetooth_bt_socket_connect_l2cap_channel_n(void)
+{
+       int psm = -1;
+
+       if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_connect_l2cap_channel(address, psm);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_deinitialize();
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_socket_connect_l2cap_channel(address, psm);
+       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_bluetooth_bt_socket_disconnect_l2cap_channel_n
+ * @since_tizen        7.0
+ * @description        Get system information to check for the support of Bluetooth. If BT is not supported on the device,
+ *                             call bt_socket_disconnect_l2cap_channel and check for error. If bluetooth is initialized, then call
+ *                             l2cap disconnect api with invalid paramter.
+ * @senario            Check if BT is supported and then call bt_socket_disconnect_l2cap_channel on the device with invalid parameters
+ *                             and check for BT_ERROR_INVALID_PARAMETER.
+ */
+int utc_bluetooth_bt_socket_disconnect_l2cap_channel_n(void)
+{
+       if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_disconnect_l2cap_channel(-1);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_deinitialize();
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_socket_disconnect_l2cap_channel(-1);
+
+       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_bluetooth_bt_socket_send_data_l2cap_channel_n
+ * @since_tizen        7.0
+ * @description        Get system information to check for the support of Bluetooth. If BT is not supported on the device,
+ *                             call bt_socket_send_data_l2cap_channel and check for error. If bluetooth is initialized, then call send data over l2cap channel
+ *                             with invalid paramter.
+ * @senario            Check if BT is supported and then call bt_socket_send_data_l2cap_channel on the device with invalid parameters
+ *                             and check for BT_ERROR_INVALID_PARAMETER.
+ */
+int utc_bluetooth_bt_socket_send_data_l2cap_channel_n(void)
+{
+       if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_send_data_l2cap_channel(1, data, strlen(data));
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_deinitialize();
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_socket_send_data_l2cap_channel(1, data, strlen(data));
+       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_n
+ * @since_tizen        7.0
+ * @description        Get system information to check for the support of Bluetooth. If BT is not supported on the device,
+ *                             set bt_socket_set_l2cap_channel_connection_requested_cb and check for error. If bluetooth is initialized, then
+ *                             set connected requested callback with invalid paramter.
+ * @senario            Check if BT is supported and then call bt_socket_set_l2cap_channel_connection_requested_cb on the device with invalid parameters
+ *                             and check for BT_ERROR_INVALID_PARAMETER.
+ */
+int utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_n(void)
+{
+       if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_set_l2cap_channel_connection_requested_cb(NULL, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_socket_set_l2cap_channel_connection_requested_cb(NULL, NULL);
+       assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
+
+       return 0;
+}
+
+static void bt_socket_connection_requested_cb_func (int socket_fd, const char *remote_address, void *user_data) {
+}
+
+/**
+ * @testcase           utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_n
+ * @since_tizen        7.0
+ * @description        Get system information to check for the support of Bluetooth. If BT is not supported on the device,
+ *                             call  bt_socket_unset_l2cap_channel_connection_requested_cb and check for error. If bluetooth is initialized, then deinitlaize bluetooth and
+ *                             unset connected requested callbackr.
+ * @senario            Check if BT is supported then deinitialize bluetooth and call bt_socket_unset_l2cap_channel_connection_requested_cb on the device
+ *                             and check for BT_ERROR_NOT_INITIALIZED.
+ */
+int utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_n(void)
+{
+       if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_unset_l2cap_channel_connection_requested_cb();
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_socket_set_l2cap_channel_connection_requested_cb(bt_socket_connection_requested_cb_func, NULL);
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_deinitialize();
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_socket_unset_l2cap_channel_connection_requested_cb();
+       assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
+
+       bt_deinitialize();
+       bt_socket_unset_l2cap_channel_connection_requested_cb();
+
+       return 0;
+}
diff --git a/tests/unittest/utc_bluetooth_le_l2cap_positive.c b/tests/unittest/utc_bluetooth_le_l2cap_positive.c
new file mode 100644 (file)
index 0000000..91f4fca
--- /dev/null
@@ -0,0 +1,350 @@
+//
+// Copyright (c) 2022 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "assert_local.h"
+#include <bluetooth.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <glib.h>
+#include <string.h>
+#include <system_info.h>
+
+static int startup_flag = BT_ERROR_NONE;
+static int socket_fd = 0;
+static int ret = BT_ERROR_NONE;
+static int l2cap_test_psm = 37;
+static bool bt_supported = false;
+static bool le_supported = false;
+static bool le_coc_supported = false;
+
+static void socket_l2cap_channel_connection_state_changed_cb_for_socket_p(int result,
+               bt_socket_connection_state_e connection_state,
+               bt_socket_l2cap_le_connection_s *connection, void *user_data)
+{
+}
+
+/**
+ * @function           utc_bluetooth_bt_socket_l2cap_channel_positive_startup
+ * @description        Get system information to check for the support of Bluetooth. If BT is supported on the device,
+ *                             then intialize the bluetooth on the device successfully and retrieve the adapter state.
+ * @parameter       NA
+ * @return          NA
+ */
+void utc_bluetooth_bt_socket_l2cap_channel_positive_startup(void)
+{
+       bt_supported = false;
+       system_info_get_platform_bool("http://tizen.org/feature/network.bluetooth", &bt_supported);
+
+       le_supported = false;
+       system_info_get_platform_bool("http://tizen.org/feature/network.bluetooth.le", &le_supported);
+
+       le_coc_supported = false;
+       system_info_get_platform_bool("http://tizen.org/feature/network.bluetooth.le.coc", &le_coc_supported);
+
+       startup_flag = BT_ERROR_NONE;
+
+       if(bt_supported && le_supported && le_coc_supported) {
+               ret = bt_initialize();
+               if(BT_ERROR_NONE != ret) {
+                       fprintf(stderr, "Startup error at %s:%d\n", __FILE__, __LINE__);
+                       fprintf(stderr, "bt_initialize failed (code: %d)\n", ret);
+                       startup_flag = ret;
+                       return;
+                       }
+
+               bt_adapter_state_e adapter_state = BT_ADAPTER_DISABLED;
+
+               ret = bt_adapter_get_state(&adapter_state);
+               if (adapter_state != BT_ADAPTER_ENABLED) {
+                       fprintf(stdout, "BT is not enabled!!");
+                       startup_flag = BT_ERROR_NOT_ENABLED;
+               }
+       }
+}
+
+/**
+ * @function           utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup
+ * @description        Get system information to check for the support of Bluetooth. If BT is supported on the device,
+ *                             then deintialize the bluetooth on the device successfully.
+ * @parameter       NA
+ * @return          NA
+ */
+void utc_bluetooth_bt_socket_l2cap_channel_positive_cleanup(void)
+{
+       if(bt_supported && le_supported && le_coc_supported)
+               bt_deinitialize();
+}
+
+/**
+ * @testcase           utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_p
+ * @since_tizen        7.0
+ * @description        Get system information to check for the support of Bluetooth. If BT is not supported on the device, set the connection
+ *                             state changed callback and check for error. If bluetooth is initialized, set and unset connection state changed callback successfully.
+ * @senario            Check if BT is supported and then set bt_socket_set_l2cap_channel_connection_state_changed_cb on the device and check for expected result.
+ */
+int utc_bluetooth_bt_socket_set_l2cap_channel_connection_state_changed_cb_p(void)
+{
+       if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_set_l2cap_channel_connection_state_changed_cb(socket_l2cap_channel_connection_state_changed_cb_for_socket_p, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_socket_set_l2cap_channel_connection_state_changed_cb(socket_l2cap_channel_connection_state_changed_cb_for_socket_p, NULL);
+       assert_eq(ret, BT_ERROR_NONE);
+
+       bt_socket_unset_l2cap_channel_connection_state_changed_cb();
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_bluetooth_bt_socket_create_l2cap_channel_p
+ * @since_tizen        7.0
+ * @description        Get system information to check for the support of Bluetooth. If BT is not supported on the device, create l2cap channel
+ *                             and check for error. If bluetooth is initialized, then create l2cap channel successfully.
+ * @senario            Check if BT is supported and then call bt_socket_create_l2cap_channel on the device and check for BT_ERROR_NONE.
+ */
+int utc_bluetooth_bt_socket_create_l2cap_channel_p(void)
+{
+       if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_create_l2cap_channel(l2cap_test_psm, &socket_fd);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_socket_create_l2cap_channel(l2cap_test_psm, &socket_fd);
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_socket_destroy_l2cap_channel(socket_fd);
+       assert_eq(ret, BT_ERROR_NONE);
+
+       return 0;
+}
+
+/**
+ * @testcase            utc_bluetooth_bt_socket_listen_l2cap_channel_p
+ * @since_tizen 7.0
+ * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device,
+ *                              call bt_socket_listen_l2cap_channel and check for error. If bluetooth is initialized, then create l2cap channel
+ *                              and listen for l2cap connection successfully.
+ * @senario             Check if BT is supported and then call bt_socket_create_l2cap_channel and bt_socket_listen_l2cap_channel on the device
+ *                              and check for BT_ERROR_NONE.
+ */
+int utc_bluetooth_bt_socket_listen_l2cap_channel_p(void)
+{
+       if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_listen_l2cap_channel(socket_fd, 1);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_socket_create_l2cap_channel(l2cap_test_psm, &socket_fd);
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_socket_listen_l2cap_channel(socket_fd, 1);
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_socket_destroy_l2cap_channel(socket_fd);
+       assert_eq(ret, BT_ERROR_NONE);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_p
+ * @since_tizen        7.0
+ * @description        Get system information to check for the support of Bluetooth. If BT is not supported on the device,
+ *                             call bt_socket_listen_and_accept_l2cap_channel and check for error. If bluetooth is initialized, then create l2cap channel
+ *                             and listen and accept for l2cap connection successfully.
+ * @senario            Check if BT is supported and then call bt_socket_create_l2cap_channel and bt_socket_listen_and_accept_l2cap_channel on the device
+ *                             and check for BT_ERROR_NONE.
+ */
+int utc_bluetooth_bt_socket_listen_and_accept_l2cap_channel_p(void)
+{
+       if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_listen_and_accept_l2cap_channel(socket_fd, 1);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_socket_create_l2cap_channel(l2cap_test_psm, &socket_fd);
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_socket_listen_and_accept_l2cap_channel(socket_fd, 1);
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_socket_destroy_l2cap_channel(socket_fd);
+       assert_eq(ret, BT_ERROR_NONE);
+
+       return 0;
+}
+
+/**
+ * @testcase            utc_bluetooth_bt_socket_get_l2cap_psm_p
+ * @since_tizen 7.0
+ * @description Get system information to check for the support of Bluetooth. If BT is not supported on the device,
+ *                              call bt_socket_get_l2cap_psm and check for error. If bluetooth is initialized, then create l2cap channel
+ *                              and get psm for l2cap channel successfully.
+ * @senario             Check if BT is supported and then call bt_socket_create_l2cap_channel, bt_socket_listen_and_accept_l2cap_channel
+ *                              and bt_socket_get_l2cap_psm on the device and check for BT_ERROR_NONE.
+ */
+int utc_bluetooth_bt_socket_get_l2cap_psm_p(void)
+{
+       int psm = -1;
+       if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_get_l2cap_psm(socket_fd, &psm);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_socket_create_l2cap_channel(l2cap_test_psm, &socket_fd);
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_socket_listen_and_accept_l2cap_channel(socket_fd, 1);
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_socket_get_l2cap_psm(socket_fd, &psm);
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_socket_destroy_l2cap_channel(socket_fd);
+       assert_eq(ret, BT_ERROR_NONE);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_bluetooth_bt_socket_destroy_l2cap_channel_p
+ * @since_tizen        7.0
+ * @description        Get system information to check for the support of Bluetooth. If BT is not supported on the device,
+ *                             destroy the l2cap channel and check for error. If bluetooth is initialized, then create l2cap channel
+ *                             and destroy l2cap channel successfully.
+ * @senario            Check if BT is supported and then call bt_socket_create_l2cap_channel and bt_socket_destroy_l2cap_channel on the device
+ *                             and check for BT_ERROR_NONE.
+ */
+int utc_bluetooth_bt_socket_destroy_l2cap_channel_p(void)
+{
+       if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_destroy_l2cap_channel(socket_fd);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_socket_create_l2cap_channel(l2cap_test_psm, &socket_fd);
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_socket_destroy_l2cap_channel(socket_fd);
+       assert_eq(ret, BT_ERROR_NONE);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_p
+ * @since_tizen        7.0
+ * @description        Get system information to check for the support of Bluetooth. If BT is not supported on the device,
+ *                             unset the connection state changed callback and check for error. If bluetooth is initialized, then set
+ *                             connection state changed callback and unset connection state changed successfully.
+ * @senario            Check if BT is supported and then set and unset connection state changed callback on the device
+ *                             and check for BT_ERROR_NONE.
+ */
+int utc_bluetooth_bt_socket_unset_l2cap_channel_connection_state_changed_cb_p(void)
+{
+       if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_unset_l2cap_channel_connection_state_changed_cb();
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_socket_set_l2cap_channel_connection_state_changed_cb(socket_l2cap_channel_connection_state_changed_cb_for_socket_p, NULL);
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_socket_unset_l2cap_channel_connection_state_changed_cb();
+       assert_eq(ret, BT_ERROR_NONE);
+
+       return 0;
+}
+
+static void bt_socket_connection_requested_cb_func(int socket_fd, const char *remote_address, void *user_data) {
+}
+
+/**
+ * @testcase           utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_p
+ * @since_tizen        7.0
+ * @description        Get system information to check for the support of Bluetooth. If BT is not supported on the device,
+ *                             set the connection requested callback and check for error. If bluetooth is initialized, then set
+ *                             connection requested callback and unset connection requested callback successfully.
+ * @senario            Check if BT is supported and then set and unset connection requested callback on the device
+ *                             and check for BT_ERROR_NONE.
+ */
+int utc_bluetooth_bt_socket_set_l2cap_channel_connection_requested_cb_p(void)
+{
+       if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_set_l2cap_channel_connection_requested_cb(bt_socket_connection_requested_cb_func, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_socket_set_l2cap_channel_connection_requested_cb(bt_socket_connection_requested_cb_func, NULL);
+       assert_eq(ret, BT_ERROR_NONE);
+
+       bt_socket_unset_l2cap_channel_connection_requested_cb();
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_p
+ * @since_tizen        7.0
+ * @description        Get system information to check for the support of Bluetooth. If BT is not supported on the device,
+ *                             unset the connection requested callback and check for error. If bluetooth is initialized, then set
+ *                             connection requested callback and unset connection requested callback successfully and check for error.
+ * @senario            Check if BT is supported and then set and unset connection requested callback on the device
+ *                             and check for BT_ERROR_NONE.
+ */
+int utc_bluetooth_bt_socket_unset_l2cap_channel_connection_requested_cb_p(void)
+{
+       if(!bt_supported || !le_supported || !le_coc_supported) {
+               ret = bt_socket_unset_l2cap_channel_connection_requested_cb();
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       assert_eq(startup_flag, BT_ERROR_NONE);
+
+       ret = bt_socket_set_l2cap_channel_connection_requested_cb(bt_socket_connection_requested_cb_func, NULL);
+       assert_eq(ret, BT_ERROR_NONE);
+
+       ret = bt_socket_unset_l2cap_channel_connection_requested_cb();
+       assert_eq(ret, BT_ERROR_NONE);
+
+       return 0;
+}