[UTC][usb-host][ACR-557][Add usb-host utc]
authortaeyoung <ty317.kim@samsung.com>
Mon, 19 Sep 2016 05:39:35 +0000 (14:39 +0900)
committertaeyoung <ty317.kim@samsung.com>
Mon, 19 Sep 2016 05:39:35 +0000 (14:39 +0900)
Added only negative tests.

Change-Id: I373cbcc5aa981d6942c86fa62ecf84983bcfd54b
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
Signed-off-by: Krystian Kisielak <k.kisielak@samsung.com>
Signed-off-by: taeyoung <ty317.kim@samsung.com>
packaging/utc/core-usb-host-tests.spec [new file with mode: 0755]
packaging/utc/core-usb-host-tests.xml [new file with mode: 0755]
src/common/assert.h
src/utc/usb-host/CMakeLists.txt [new file with mode: 0644]
src/utc/usb-host/public.list [new file with mode: 0644]
src/utc/usb-host/tct-usb-host-core.c [new file with mode: 0644]
src/utc/usb-host/tct-usb-host-core_mobile.h [new file with mode: 0644]
src/utc/usb-host/utc-usb-host.c [new file with mode: 0644]

diff --git a/packaging/utc/core-usb-host-tests.spec b/packaging/utc/core-usb-host-tests.spec
new file mode 100755 (executable)
index 0000000..0fc3e67
--- /dev/null
@@ -0,0 +1,64 @@
+%define MODULE_NAME usb-host
+%define MODULE_LIBNAME capi-system-usbhost
+Name:       core-%{MODULE_NAME}-tests
+Summary:    Core API unit TC (%{name})
+Version:    0.1
+Release:    0
+Group:      Development/Tools
+License:    Apache License, Version 2.0
+Source0:    %{name}-%{version}.tar.gz
+BuildRequires: pkgconfig(%{MODULE_LIBNAME})
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: cmake
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(capi-system-info)
+BuildRequires: pkgconfig(dlog)
+
+%description
+Core API unit TC (%{name})
+
+%prep
+%setup -q
+
+%build
+
+%define PREFIX "%{_libdir}/%{name}"
+
+export LDFLAGS+="-Wl,--rpath=%{PREFIX} -Wl,--as-needed"
+
+%if %{?DEVICE_BUILD_TYPE_MOBILE:1}0
+cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="mobile" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+%endif
+
+%if %{?DEVICE_BUILD_TYPE_WEARABLE:1}0
+cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="wearable" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+%endif
+
+%if %{?DEVICE_BUILD_TYPE_TV:1}0
+cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="tv" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+%endif
+
+%if %{?DEVICE_BUILD_TYPE_COMMON_IOT:1}0
+cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="common_iot" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+%endif
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+mkdir -p %{buildroot}/usr/share/license
+cp LICENSE %{buildroot}/usr/share/license/%{name}
+mkdir -p %{buildroot}/usr/share/packages/
+cp packaging/utc/%{name}.xml %{buildroot}/usr/share/packages/
+mkdir -p %{buildroot}/usr/apps/%{name}/bin
+%post
+
+%postun
+
+
+%files
+/usr/apps/%{name}/*
+/usr/share/packages/%{name}.xml
+/usr/share/license/%{name}
diff --git a/packaging/utc/core-usb-host-tests.xml b/packaging/utc/core-usb-host-tests.xml
new file mode 100755 (executable)
index 0000000..fd26d6d
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="core-usb-host-tests" version="0.1.0" api-version="3.0">
+    <label>CoreUsbHostTest</label>
+    <author email="test@tizen.org" href="www.tizen.org">test</author>
+    <description>Core API test Application</description>
+    <ui-application appid="core.usb-host-tests" exec="/usr/apps/core-usb-host-tests/bin/tct-usb-host-core" nodisplay="false" multiple="false" type="capp" taskmanage="true">
+    </ui-application>
+</manifest>
index 25621ff..56f7245 100755 (executable)
@@ -26,7 +26,7 @@
                 __FILE__, __LINE__, #exp); \
             return 1; \
         } \
-    } while (0);
+    } while (0)
 
 #define assert_eq(var, ref) \
     do { \
@@ -36,7 +36,7 @@
                 __FILE__, __LINE__, #var, (int)var, #ref, (int)ref); \
             return 1; \
         } \
-    } while (0);
+    } while (0)
 
 #define assert_neq(var, ref) \
     do { \
@@ -46,7 +46,7 @@
                 __FILE__, __LINE__,  #var, (int)var, #ref, (int)ref); \
             return 1; \
         } \
-    } while (0);
+    } while (0)
 
 #define assert_gt(var, ref) \
     do { \
@@ -56,7 +56,7 @@
             __FILE__, __LINE__,  #var, (int)var, #ref, (int)ref); \
             return 1; \
         } \
-    } while (0);
+    } while (0)
 
 #define assert_geq(var, ref) \
     do { \
@@ -66,7 +66,7 @@
                 __FILE__, __LINE__,  #var, (int)var, #ref, (int)ref); \
             return 1; \
         } \
-    } while (0);
+    } while (0)
 
 #define assert_lt(var, ref) \
     do { \
@@ -76,7 +76,7 @@
                 __FILE__, __LINE__,  #var, (int)var, #ref, (int)ref); \
             return 1; \
         } \
-    } while (0);
+    } while (0)
 
 #define assert_leq(var, ref) \
     do { \
@@ -86,7 +86,7 @@
             __FILE__, __LINE__,  #var, (int)var, #ref, (int)ref); \
             return 1; \
         } \
-    } while (0);
+    } while (0)
 
 
 #endif //  _ASSERT_H_
diff --git a/src/utc/usb-host/CMakeLists.txt b/src/utc/usb-host/CMakeLists.txt
new file mode 100644 (file)
index 0000000..8f55495
--- /dev/null
@@ -0,0 +1,43 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(PKG_NAME "usb-host")
+
+SET(EXEC_NAME "tct-${PKG_NAME}-core")
+SET(RPM_NAME "core-${PKG_NAME}-tests")
+
+SET(CAPI_LIB "capi-system-usbhost")
+SET(TC_SOURCES
+       utc-usb-host.c
+       tct-usb-host-core.c
+)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(
+       ${CAPI_LIB} REQUIRED
+       ${CAPI_LIB}
+       elementary
+       capi-appfw-application
+       glib-2.0
+       capi-system-info
+       dlog
+)
+
+INCLUDE_DIRECTORIES(
+       ${${CAPI_LIB}_INCLUDE_DIRS}
+)
+ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.c ${TC_SOURCES} ${COMMON_FILE})
+TARGET_LINK_LIBRARIES(${EXEC_NAME}
+       ${${CAPI_LIB}_LIBRARIES}
+)
+
+INSTALL(PROGRAMS ${EXEC_NAME}
+    DESTINATION ${BIN_DIR}/${RPM_NAME}/bin
+)
+
+IF( DEFINED ASAN )
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall -pie -g -fsanitize=address -fsanitize-recover=address -U_FORTIFY_SOURCE -fno-omit-frame-pointer")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -Wl,-fsanitize=address")
+ELSE()
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -fPIE -Wall")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -pie")
+ENDIF()
+
diff --git a/src/utc/usb-host/public.list b/src/utc/usb-host/public.list
new file mode 100644 (file)
index 0000000..2bc5ba1
--- /dev/null
@@ -0,0 +1,51 @@
+usb_host_create
+usb_host_destroy
+usb_host_get_device_list
+usb_host_free_device_list
+usb_host_ref_device
+usb_host_unref_device
+usb_host_device_open
+usb_host_device_close
+usb_host_device_open_with_vid_pid
+usb_host_device_get_bus_number
+usb_host_device_get_address
+usb_host_device_get_port_numbers
+usb_host_device_get_config
+usb_host_get_active_config
+usb_host_set_config
+usb_host_device_get_bcd_usb
+usb_host_device_get_class
+usb_host_device_get_sub_class
+usb_host_device_get_protocol
+usb_host_device_get_max_packet_size_0
+usb_host_device_get_id_vendor
+usb_host_device_get_id_product
+usb_host_device_get_bcd_device
+usb_host_device_get_num_configurations
+usb_host_is_device_opened
+usb_host_device_get_manufacturer_str
+usb_host_device_get_product_str
+usb_host_device_get_serial_number_str
+usb_host_config_get_num_interfaces
+usb_host_config_is_self_powered
+usb_host_config_support_remote_wakeup
+usb_host_config_get_max_power
+usb_host_device_get_config_str
+usb_host_config_get_interface
+usb_host_config_destroy
+usb_host_claim_interface
+usb_host_release_interface
+usb_host_interface_get_number
+usb_host_interface_get_num_endpoints
+usb_host_interface_get_endpoint
+usb_host_interface_set_altsetting
+usb_host_interface_get_str
+usb_host_endpoint_get_number
+usb_host_endpoint_get_direction
+usb_host_endpoint_get_transfer_type
+usb_host_endpoint_get_synch_type
+usb_host_endpoint_get_usage_type
+usb_host_endpoint_get_max_packet_size
+usb_host_endpoint_get_interval
+usb_host_control_transfer
+usb_host_transfer
diff --git a/src/utc/usb-host/tct-usb-host-core.c b/src/utc/usb-host/tct-usb-host-core.c
new file mode 100644 (file)
index 0000000..ae166b6
--- /dev/null
@@ -0,0 +1,130 @@
+//
+// Copyright (c) 2014 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 "tct_common.h"
+
+#ifdef MOBILE  //Starts MOBILE
+#include "tct-usb-host-core_mobile.h"
+#endif  //MOBILE       //End MOBILE
+
+#include <stdio.h>
+#include <string.h>
+#include <malloc.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <glib.h>
+#include <stdbool.h>
+#include "tct_common.h"
+#include <app.h>
+#include <dlog.h>
+
+#include <Elementary.h>
+
+typedef struct appdata {
+       Evas_Object *win;
+       Evas_Object *conform;
+       Evas_Object *label;
+} appdata_s;
+
+static bool app_create(void *data)
+{
+       return true;
+}
+
+static void app_control(app_control_h app_control, void *data)
+{
+       char* pszGetTCName = NULL;
+       int i=0, result=0, nRet=0;
+       nRet = app_control_get_extra_data(app_control, "testcase_name", &pszGetTCName);
+       if(nRet != APP_CONTROL_ERROR_NONE)
+       {
+               dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] app_control_get_extra_data returns error = %d", __FUNCTION__, __LINE__, nRet);
+               PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to fetch test case name: app_control_get_extra_data API call fails\\n", __FILE__, __LINE__);
+               PRINT_TC_RESULT("%d",1);
+               FREE_MEMORY_TC(pszGetTCName);
+               return;
+       }
+
+       dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Executing TC Name = %s", __FUNCTION__, __LINE__, pszGetTCName);
+       for ( i = 0; tc_array[i].name; i++ )
+       {
+               if ( 0 == strncmp(pszGetTCName, tc_array[i].name, strlen(pszGetTCName)) )
+               {
+                       DUMP_UTC_ERRLOG();
+                       if ( tc_array[i].startup )
+                       {
+                               dlog_print(DLOG_INFO, "NativeTCT", "%s : Start up", pszGetTCName);
+                               tc_array[i].startup();
+                       }
+
+                       dlog_print(DLOG_INFO, "NativeTCT", "%s : Body", pszGetTCName);
+                       result = tc_array[i].function();
+                       dlog_print(DLOG_INFO, "NativeTCT", "%s returns value = %d", pszGetTCName, result);
+
+                       if ( tc_array[i].cleanup )
+                       {
+                               dlog_print(DLOG_INFO, "NativeTCT", "%s : Clean up", pszGetTCName);
+                               tc_array[i].cleanup();
+                       }
+
+                       CLOSE_UTC_ERRLOG();
+                       PRINT_TC_RESULT("%d",result);
+                       FREE_MEMORY_TC(pszGetTCName);
+                       return;
+               }
+       }
+
+       dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] Unable to execute %s : Unknown Test Case Name", __FUNCTION__, __LINE__, pszGetTCName);
+       PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to execute %s : Unknown Test Case Name\\n", __FILE__, __LINE__, pszGetTCName);
+       PRINT_TC_RESULT("%d",1);
+       FREE_MEMORY_TC(pszGetTCName);
+       return;
+}
+
+static void app_terminate(void *data)
+{
+       dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is now Terminating", __FUNCTION__, __LINE__);
+}
+
+int main(int argc, char *argv[])
+{
+       int ret = 0;
+       appdata_s ad = {0,};
+
+       ui_app_lifecycle_callback_s event_callback = {0,};
+       event_callback.create = app_create;
+       event_callback.terminate = app_terminate;
+       event_callback.app_control = app_control;
+
+       //setting gcda file location for coverage
+       setenv("GCOV_PREFIX","/tmp",1);
+       dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Coverage *.gcda File location set to /tmp/home/abuild/rpmbuild/BUILD/ ", __FUNCTION__, __LINE__);
+
+       dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Main Function is Invoked", __FUNCTION__, __LINE__);
+       ret = ui_app_main(argc, argv, &event_callback, &ad);
+       if (ret != APP_ERROR_NONE)
+       {
+               dlog_print(DLOG_ERROR, "NativeTCT", "Application ui_app_main call gets failed. err = %d", ret);
+               PRINT_UTC_LOG("\\n[%s][Line : %d]Application ui_app_main call gets failed. err = %d\\n", __FILE__, __LINE__, ret);
+               PRINT_TC_RESULT("%d",1);
+               return ret;
+       }
+
+       dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is Terminated", __FUNCTION__, __LINE__);
+       return ret;
+}
diff --git a/src/utc/usb-host/tct-usb-host-core_mobile.h b/src/utc/usb-host/tct-usb-host-core_mobile.h
new file mode 100644 (file)
index 0000000..5e02579
--- /dev/null
@@ -0,0 +1,135 @@
+//
+// Copyright (c) 2014 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.
+//
+#ifndef __TCT_USB_HOST_NATIVE_H__
+#define __TCT_USB_HOST_NATIVE_H__
+
+#include "testcase.h"
+
+extern void utc_usb_host_context_startup(void);
+extern void utc_usb_host_context_cleanup(void);
+extern void utc_usb_host_device_startup(void);
+extern void utc_usb_host_device_cleanup(void);
+extern void utc_usb_host_config_startup(void);
+extern void utc_usb_host_config_cleanup(void);
+
+extern int utc_usb_host_create_n(void);
+extern int utc_usb_host_get_device_list_n(void);
+extern int utc_usb_host_free_device_list_n(void);
+extern int utc_usb_host_device_open_n(void);
+extern int utc_usb_host_device_close_n(void);
+extern int utc_usb_host_device_open_with_vid_pid_n(void);
+extern int utc_usb_host_ref_device_n(void);
+extern int utc_usb_host_unref_device_n(void);
+extern int utc_usb_host_device_get_bus_number_n(void);
+extern int utc_usb_host_device_get_address_n(void);
+extern int utc_usb_host_get_active_config_n(void);
+extern int utc_usb_host_device_get_bcd_usb_n(void);
+extern int utc_usb_host_device_get_class_n(void);
+extern int utc_usb_host_device_get_sub_class_n(void);
+extern int utc_usb_host_device_get_protocol_n(void);
+extern int utc_usb_host_device_get_max_packet_size_0_n(void);
+extern int utc_usb_host_device_get_id_vendor_n(void);
+extern int utc_usb_host_device_get_id_product_n(void);
+extern int utc_usb_host_device_get_bcd_device_n(void);
+extern int utc_usb_host_device_get_num_configurations_n(void);
+extern int utc_usb_host_is_device_opened_n(void);
+extern int utc_usb_host_device_get_manufacturer_str_n(void);
+extern int utc_usb_host_device_get_product_str_n(void);
+extern int utc_usb_host_device_get_serial_number_str_n(void);
+extern int utc_usb_host_config_destroy_n(void);
+extern int utc_usb_host_config_get_num_interfaces_n(void);
+extern int utc_usb_host_config_is_self_powered_n(void);
+extern int utc_usb_host_config_support_remote_wakeup_n(void);
+extern int utc_usb_host_config_get_max_power_n(void);
+extern int utc_usb_host_config_get_interface_n(void);
+extern int utc_usb_host_claim_interface_n(void);
+extern int utc_usb_host_release_interface_n(void);
+extern int utc_usb_host_interface_get_number_n(void);
+extern int utc_usb_host_interface_get_num_endpoints_n(void);
+extern int utc_usb_host_interface_get_endpoint_n(void);
+extern int utc_usb_host_interface_get_str_n(void);
+extern int utc_usb_host_endpoint_get_number_n(void);
+extern int utc_usb_host_endpoint_get_direction_n(void);
+extern int utc_usb_host_endpoint_get_transfer_type_n(void);
+extern int utc_usb_host_endpoint_get_synch_type_n(void);
+extern int utc_usb_host_endpoint_get_usage_type_n(void);
+extern int utc_usb_host_endpoint_get_max_packet_size_n(void);
+extern int utc_usb_host_endpoint_get_interval_n(void);
+extern int utc_usb_host_destroy_n(void);
+extern int utc_usb_host_device_get_port_numbers_n(void);
+extern int utc_usb_host_set_config_n(void);
+extern int utc_usb_host_device_get_config_str_n(void);
+extern int utc_usb_host_interface_set_altsetting_n(void);
+extern int utc_usb_host_device_get_config_n(void);
+extern int utc_usb_host_control_transfer_n(void);
+extern int utc_usb_host_transfer_n(void);
+
+testcase tc_array[] = {
+       {"utc_usb_host_claim_interface_n", utc_usb_host_claim_interface_n, NULL, NULL},
+       {"utc_usb_host_config_destroy_n", utc_usb_host_config_destroy_n, NULL, NULL},
+       {"utc_usb_host_config_get_interface_n", utc_usb_host_config_get_interface_n, NULL, NULL},
+       {"utc_usb_host_config_get_max_power_n", utc_usb_host_config_get_max_power_n, NULL, NULL},
+       {"utc_usb_host_config_get_num_interfaces_n", utc_usb_host_config_get_num_interfaces_n, NULL, NULL},
+       {"utc_usb_host_config_is_self_powered_n", utc_usb_host_config_is_self_powered_n, NULL, NULL},
+       {"utc_usb_host_config_support_remote_wakeup_n", utc_usb_host_config_support_remote_wakeup_n, NULL, NULL},
+       {"utc_usb_host_control_transfer_n", utc_usb_host_control_transfer_n, NULL, NULL},
+       {"utc_usb_host_create_n", utc_usb_host_create_n, NULL, NULL},
+       {"utc_usb_host_destroy_n", utc_usb_host_destroy_n, NULL, NULL},
+       {"utc_usb_host_device_close_n", utc_usb_host_device_close_n, NULL, NULL},
+       {"utc_usb_host_device_get_address_n", utc_usb_host_device_get_address_n, NULL, NULL},
+       {"utc_usb_host_device_get_bcd_device_n", utc_usb_host_device_get_bcd_device_n, NULL, NULL},
+       {"utc_usb_host_device_get_bcd_usb_n", utc_usb_host_device_get_bcd_usb_n, NULL, NULL},
+       {"utc_usb_host_device_get_bus_number_n", utc_usb_host_device_get_bus_number_n, NULL, NULL},
+       {"utc_usb_host_device_get_class_n", utc_usb_host_device_get_class_n, NULL, NULL},
+       {"utc_usb_host_device_get_config_n", utc_usb_host_device_get_config_n, NULL, NULL},
+       {"utc_usb_host_device_get_config_str_n", utc_usb_host_device_get_config_str_n, NULL, NULL},
+       {"utc_usb_host_device_get_id_product_n", utc_usb_host_device_get_id_product_n, NULL, NULL},
+       {"utc_usb_host_device_get_id_vendor_n", utc_usb_host_device_get_id_vendor_n, NULL, NULL},
+       {"utc_usb_host_device_get_manufacturer_str_n", utc_usb_host_device_get_manufacturer_str_n, NULL, NULL},
+       {"utc_usb_host_device_get_max_packet_size_0_n", utc_usb_host_device_get_max_packet_size_0_n, NULL, NULL},
+       {"utc_usb_host_device_get_num_configurations_n", utc_usb_host_device_get_num_configurations_n, NULL, NULL},
+       {"utc_usb_host_device_get_port_numbers_n", utc_usb_host_device_get_port_numbers_n, NULL, NULL},
+       {"utc_usb_host_device_get_product_str_n", utc_usb_host_device_get_product_str_n, NULL, NULL},
+       {"utc_usb_host_device_get_protocol_n", utc_usb_host_device_get_protocol_n, NULL, NULL},
+       {"utc_usb_host_device_get_serial_number_str_n", utc_usb_host_device_get_serial_number_str_n, NULL, NULL},
+       {"utc_usb_host_device_get_sub_class_n", utc_usb_host_device_get_sub_class_n, NULL, NULL},
+       {"utc_usb_host_device_open_n", utc_usb_host_device_open_n, NULL, NULL},
+       {"utc_usb_host_device_open_with_vid_pid_n", utc_usb_host_device_open_with_vid_pid_n, NULL, NULL},
+       {"utc_usb_host_endpoint_get_direction_n", utc_usb_host_endpoint_get_direction_n, NULL, NULL},
+       {"utc_usb_host_endpoint_get_interval_n", utc_usb_host_endpoint_get_interval_n, NULL, NULL},
+       {"utc_usb_host_endpoint_get_max_packet_size_n", utc_usb_host_endpoint_get_max_packet_size_n, NULL, NULL},
+       {"utc_usb_host_endpoint_get_number_n", utc_usb_host_endpoint_get_number_n, NULL, NULL},
+       {"utc_usb_host_endpoint_get_synch_type_n", utc_usb_host_endpoint_get_synch_type_n, NULL, NULL},
+       {"utc_usb_host_endpoint_get_transfer_type_n", utc_usb_host_endpoint_get_transfer_type_n, NULL, NULL},
+       {"utc_usb_host_endpoint_get_usage_type_n", utc_usb_host_endpoint_get_usage_type_n, NULL, NULL},
+       {"utc_usb_host_free_device_list_n", utc_usb_host_free_device_list_n, NULL, NULL},
+       {"utc_usb_host_get_active_config_n", utc_usb_host_get_active_config_n, NULL, NULL},
+       {"utc_usb_host_get_device_list_n", utc_usb_host_get_device_list_n, NULL, NULL},
+       {"utc_usb_host_interface_get_endpoint_n", utc_usb_host_interface_get_endpoint_n, NULL, NULL},
+       {"utc_usb_host_interface_get_number_n", utc_usb_host_interface_get_number_n, NULL, NULL},
+       {"utc_usb_host_interface_get_num_endpoints_n", utc_usb_host_interface_get_num_endpoints_n, NULL, NULL},
+       {"utc_usb_host_interface_get_str_n", utc_usb_host_interface_get_str_n, NULL, NULL},
+       {"utc_usb_host_interface_set_altsetting_n", utc_usb_host_interface_set_altsetting_n, NULL, NULL},
+       {"utc_usb_host_is_device_opened_n", utc_usb_host_is_device_opened_n, NULL, NULL},
+       {"utc_usb_host_ref_device_n", utc_usb_host_ref_device_n, NULL, NULL},
+       {"utc_usb_host_release_interface_n", utc_usb_host_release_interface_n, NULL, NULL},
+       {"utc_usb_host_set_config_n", utc_usb_host_set_config_n, NULL, NULL},
+       {"utc_usb_host_transfer_n", utc_usb_host_transfer_n, NULL, NULL},
+       {"utc_usb_host_unref_device_n", utc_usb_host_unref_device_n, NULL, NULL},
+       {NULL, NULL}
+};
+
+#endif // __TCT_USB_HOST_NATIVE_H__
diff --git a/src/utc/usb-host/utc-usb-host.c b/src/utc/usb-host/utc-usb-host.c
new file mode 100644 (file)
index 0000000..d306b47
--- /dev/null
@@ -0,0 +1,1392 @@
+//
+// Copyright (c) 2014 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.h"
+
+#include <usb_host.h>
+#include <string.h>
+#include <stdbool.h>
+#include <system_info.h>
+
+//& set: UsbHost
+
+#define assert_streq(var, ref) \
+    do { \\
+        if (strcmp(var, ref)) { \
+            fprintf(stderr, \
+                "\\n[TCT][%s][Line : %d] Assert fail; Values (%s == %s) is not equal to (%s == %s)\\n", \
+                __FILE__, __LINE__,  #var, var, #ref, ref); \
+            return 1; \
+        } \
+    } while (0);
+
+
+/**
+ * @testcase           utc_usb_host_create_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Initialize context of usb-host
+ * @scenario           Calling usb_host_create with NULL parameter should end with error.
+ */
+int utc_usb_host_create_n(void)
+{
+       int ret;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_create(NULL);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_usb_host_get_device_list_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get list of all connected devices
+ * @scenario           Calling usb_host_get_device_list with NULL should result
+ * in INVALID_PARAMETER error.
+ */
+int utc_usb_host_get_device_list_n(void)
+{
+       int ret;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_get_device_list(NULL, NULL, NULL);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_usb_host_free_device_list_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Free list of devices
+ * @scenario           Calling usb_host_free_device_list with NULL should result
+ * in INVALID_PARAMETER error.
+ */
+int utc_usb_host_free_device_list_n(void)
+{
+       int ret;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_free_device_list(NULL, 0);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_usb_host_device_open_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Open a device
+ * @scenario           Opening NULL device should end with ERROR_INVALID
+ */
+int utc_usb_host_device_open_n(void)
+{
+       int ret;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_device_open(NULL);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_device_close_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Close a device
+ * @scenario           Closing NULL shoud end with ERROR_INVALID_PARAMETER
+ */
+int utc_usb_host_device_close_n(void)
+{
+       int ret;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_device_close(NULL);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_device_open_with_vid_pid_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Open a device with give vid and pid
+ * @scenario           Opening device with NULL parameter should result in error
+ */
+int utc_usb_host_device_open_with_vid_pid_n(void)
+{
+       int ret;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_device_open_with_vid_pid(NULL, 0, 0, NULL);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_ref_device_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Increase device refcount
+ * @scenario           Check if passing NULL as parameter ends with INVALID_PARAMETER error
+ */
+int utc_usb_host_ref_device_n(void)
+{
+       int ret;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_ref_device(NULL);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+
+/**
+ * @testcase           utc_usb_host_unref_device_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Decrease device refcount
+ * @scenario           Check if passing NULL as parameter ends with INVALID_PARAMETER error
+ */
+int utc_usb_host_unref_device_n(void)
+{
+       int ret;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_unref_device(NULL);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_device_get_bus_number_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get device bus number
+ * @scenario           Function should end with error when NULL is passed as parameter
+ */
+int utc_usb_host_device_get_bus_number_n(void)
+{
+       int ret;
+       int bus_number;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_device_get_bus_number(NULL, &bus_number);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_device_get_address_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get device address
+ * @scenario           Function should end with error when NULL is passed as parameter
+ */
+int utc_usb_host_device_get_address_n(void)
+{
+       int ret;
+       int addr;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_device_get_address(NULL, &addr);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_device_get_active_config_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get configuration
+ * @scenario           Function should return error when NULL parameter is passed
+ */
+int utc_usb_host_get_active_config_n(void)
+{
+       usb_host_config_h config;
+       int ret;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_get_active_config(NULL, &config);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_usb_host_config_destroy_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Destroy configuration
+ * @scenario           Passing NULL configuration should end with ERROR_INVALID_PARAMETER
+ */
+int utc_usb_host_config_destroy_n(void)
+{
+       int ret;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_config_destroy(NULL);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_device_get_bcd_usb_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get bcdUSB field from device
+ * @scenario           Function should end with error when NULL parameter is passed
+ */
+int utc_usb_host_device_get_bcd_usb_n(void)
+{
+       int bcd_usb;
+       int ret;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_device_get_bcd_usb(NULL, &bcd_usb);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_device_get_class_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get bDeviceClass value from device
+ * @scenario           Checks if passing NULL as parameter result in INVALID_PARAMETER error
+ */
+int utc_usb_host_device_get_class_n(void)
+{
+       int ret;
+       int device_class;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_device_get_class(NULL, &device_class);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_device_get_sub_class_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get bDeviceSubClass value from device
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_device_get_sub_class_n(void)
+{
+       int ret;
+       int sub_class;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_device_get_sub_class(NULL, &sub_class);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_device_get_protocol_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get bDeviceProtocol value from device
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_device_get_protocol_n(void)
+{
+       int ret;
+       int protocol;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_device_get_class(NULL, &protocol);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_device_get_max_packet_size_0_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get bDeviceMaxPacketSize0 value from device
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_device_get_max_packet_size_0_n(void)
+{
+       int ret;
+       int size;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_device_get_max_packet_size_0(NULL, &size);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_device_get_id_vendor_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get idVendor value from device
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_device_get_id_vendor_n(void)
+{
+       int ret;
+       int vid;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_device_get_id_vendor(NULL, &vid);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_device_get_id_product_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get idProduct value from device
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_device_get_id_product_n(void)
+{
+       int ret;
+       int pid;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_device_get_id_product(NULL, &pid);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_device_get_bcd_device_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get bcdDevice value from device
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_device_get_bcd_device_n(void)
+{
+       int ret;
+       int bcd;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_device_get_bcd_device(NULL, &bcd);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_device_get_num_configurations_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get number of configurations from device
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_device_get_num_configurations_n(void)
+{
+       int ret;
+       int num;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_device_get_num_configurations(NULL, &num);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_device_is_device_opened_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Check if device is opened
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_is_device_opened_n(void)
+{
+       int ret;
+       bool opened;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_is_device_opened(NULL, &opened);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_get_manufacturer_str_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get manufacturer string
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_device_get_manufacturer_str_n(void)
+{
+       int ret;
+       unsigned char buffer[256];
+       int len = 256;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_device_get_manufacturer_str(NULL, &len, buffer);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_get_product_str_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get product string
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_device_get_product_str_n(void)
+{
+       int ret;
+       unsigned char buffer[256];
+       int len = 256;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_device_get_product_str(NULL, &len, buffer);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_get_product_str_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get product string
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_device_get_serial_number_str_n(void)
+{
+       int ret;
+       unsigned char buffer[256];
+       int len = 256;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_device_get_serial_number_str(NULL, &len, buffer);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_usb_host_get_num_interfaces_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get number of interfaces
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_config_get_num_interfaces_n(void)
+{
+       int ret;
+       int num;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_config_get_num_interfaces(NULL, &num);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_is_self_powered_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Check if device is self-powered
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_config_is_self_powered_n(void)
+{
+       int ret;
+       bool self_powered;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_config_is_self_powered(NULL, &self_powered);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_config_support_remote_wakeup_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Check if device supports remote wakeup
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_config_support_remote_wakeup_n(void)
+{
+       int ret;
+       bool support;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_config_support_remote_wakeup(NULL, &support);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_config_get_max_power_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get max power in given configuration
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_config_get_max_power_n(void)
+{
+       int ret;
+       int max_power;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_config_get_max_power(NULL, &max_power);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_config_get_str_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get config string
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_device_get_config_str_n(void)
+{
+       int ret;
+       unsigned char buffer[256];
+       int len = 256;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_device_get_config_str(NULL, &len, buffer);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_config_get_interface_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get an interface
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_config_get_interface_n(void)
+{
+       int ret;
+       usb_host_interface_h iface;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_config_get_interface(NULL, 0, &iface);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_claim_interface_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Claim an interface
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_claim_interface_n(void)
+{
+       int ret;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_claim_interface(NULL, 0);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_release_interface_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Release an interface
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_release_interface_n(void)
+{
+       int ret;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_release_interface(NULL);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_interface_get_number_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get an interface number
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_interface_get_number_n(void)
+{
+       int ret;
+       int number;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_interface_get_number(NULL, &number);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_interface_get_num_endpoints_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get number of endpoints in interface
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_interface_get_num_endpoints_n(void)
+{
+       int ret;
+       int num;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_interface_get_num_endpoints(NULL, &num);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_interface_get_endpoint_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get an endpoint from interface
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_interface_get_endpoint_n(void)
+{
+       int ret;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_interface_get_endpoint(NULL, 1, NULL);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_interface_get_str_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get an interface string
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_interface_get_str_n(void)
+{
+       int ret;
+       unsigned char buffer[256];
+       int len = 256;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_interface_get_str(NULL, &len, buffer);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_usb_host_endpoint_get_number_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get an endpoint number
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_endpoint_get_number_n(void)
+{
+       int ret;
+       int num;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_endpoint_get_number(NULL, &num);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_endpoint_get_direction_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get an endpoint direction
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_endpoint_get_direction_n(void)
+{
+       int ret;
+       int dir;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_endpoint_get_direction(NULL, &dir);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_endpoint_get_transfer_type_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get an endpoint transfer type
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_endpoint_get_transfer_type_n(void)
+{
+       int ret;
+       int type;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_endpoint_get_transfer_type(NULL, &type);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_endpoint_get_synch_type_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get an endpoint synchronization type
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_endpoint_get_synch_type_n(void)
+{
+       int ret;
+       int type;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_endpoint_get_synch_type(NULL, &type);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_endpoint_get_usage_type_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get an endpoint usage type
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_endpoint_get_usage_type_n(void)
+{
+       int ret;
+       int type;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_endpoint_get_usage_type(NULL, &type);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_endpoint_get_max_packet_size_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get an endpoint max packet size
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_endpoint_get_max_packet_size_n(void)
+{
+       int ret;
+       int size;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_endpoint_get_max_packet_size(NULL, &size);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_endpoint_get_interval_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get an endpoint interval
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_endpoint_get_interval_n(void)
+{
+       int ret;
+       int interval;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_endpoint_get_interval(NULL, &interval);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_usb_host_destroy_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Destroy given host
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_destroy_n(void)
+{
+       int ret;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_destroy(NULL);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_device_get_port_numbers_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get device port numbers
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_device_get_port_numbers_n(void)
+{
+       int ret;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_device_get_port_numbers(NULL, NULL, 1, NULL);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_set_config_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Set given config
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_set_config_n(void)
+{
+       int ret;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_set_config(NULL);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_interface_set_altsetting_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Set alternative settings
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_interface_set_altsetting_n(void)
+{
+       int ret;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_interface_set_altsetting(NULL, 1);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_device_get_config_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Get config of given device
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_device_get_config_n(void)
+{
+       int ret;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_device_get_config(NULL, 1, NULL);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_control_transfer_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Perform control transfer
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_control_transfer_n(void)
+{
+       int ret;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_control_transfer(NULL, 0, 0, 0, 0, NULL, 0, 0, NULL);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}
+
+
+/**
+ * @testcase           utc_usb_host_transfer_n
+ * @since_tizen                3.0
+ * @type               negative
+ * @description                Perform transfer
+ * @scenario           Checks if passing NULL as parameter results in INVALID_PARAMETER error
+ */
+int utc_usb_host_transfer_n(void)
+{
+       int ret;
+       bool is_support;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &is_support);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               is_support = false;
+
+       ret = usb_host_transfer(NULL, NULL, 0, NULL, 0);
+       if (is_support)
+               assert_eq(ret, USB_HOST_ERROR_INVALID_PARAMETER);
+       else
+               assert_eq(ret, USB_HOST_ERROR_NOT_SUPPORTED);
+
+       return 0;
+}