Unify cpp files to one 58/187058/1
authorlokilee73 <changjoo.lee@samsung.com>
Fri, 17 Aug 2018 11:35:40 +0000 (20:35 +0900)
committerlokilee73 <changjoo.lee@samsung.com>
Fri, 17 Aug 2018 11:35:52 +0000 (20:35 +0900)
Merge below cpp files to device_haltests.cpp
gtest_hal_battery.cpp
gtest_hal_cpu.cpp
gtest_hal_display.cpp
gtest_hal_extcon.cpp
gtest_hal_ir.cpp
gtest_hal_rgb.cpp
gtest_hal_thermal.cpp
gtest_hal_touchscreen.cpp
gtest_hal_usb_client.cpp
gtest_hal_gadget.cpp

Change-Id: I20a155136b21e6b2a4a86daeb24f2592dc281b22
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
12 files changed:
packaging/libdevice-node.spec
unittest/device_haltests.cpp [new file with mode: 0755]
unittest/gtest_hal_battery.cpp [deleted file]
unittest/gtest_hal_cpu.cpp [deleted file]
unittest/gtest_hal_display.cpp [deleted file]
unittest/gtest_hal_extcon.cpp [deleted file]
unittest/gtest_hal_ir.cpp [deleted file]
unittest/gtest_hal_rgb.cpp [deleted file]
unittest/gtest_hal_thermal.cpp [deleted file]
unittest/gtest_hal_touchscreen.cpp [deleted file]
unittest/gtest_hal_usb_client.cpp [deleted file]
unittest/gtest_hal_usb_gadget.cpp [deleted file]

index e97c5ec86ea608bb434cd3117153828eba2a29d5..d97946ffab16a487e0db4d93faf27ec0dede0234 100755 (executable)
@@ -61,4 +61,4 @@ make %{?jobs:-j%jobs}
 %{_libdir}/pkgconfig/*.pc
 
 %files -n device-haltests
-%{_bindir}/gtest*
+%{_bindir}/device_haltests
diff --git a/unittest/device_haltests.cpp b/unittest/device_haltests.cpp
new file mode 100755 (executable)
index 0000000..175049f
--- /dev/null
@@ -0,0 +1,1100 @@
+
+#include <iostream>
+#include <gtest/gtest.h>
+#include <system_info.h>
+#include "unittest.h"
+#include "hw/battery.h"
+#include "hw/cpu.h"
+#include "hw/display.h"
+#include "hw/external_connection.h"
+#include "hw/ir.h"
+#include "hw/led.h"
+#include "hw/thermal.h"
+#include "hw/touchscreen.h"
+#include "hw/usb_client.h"
+#include "hw/usb_gadget.h"
+
+using namespace std;
+
+/*
+ * main class
+ */
+#define MODEL_NAME      "http://tizen.org/system/model_name"
+#define LOWBATTERY "LowBattery"
+
+struct hw_info *info;
+struct battery_device *battery_dev;
+struct cpu_device *cpu_dev;
+struct display_device *display_dev;
+struct external_connection_device *ext_dev;
+struct ir_device *ir_dev;
+struct led_device *rgb_dev;
+struct thermal_device *thermal_dev;
+struct touchscreen_device *touchscreen_dev;
+struct usb_client *client_dev;
+struct usb_gadget *gadget_dev;
+struct usb_gadget_id gadget_id;
+struct usb_gadget_translator *gadget_translator;
+
+/* Define Classes */
+class BATTERYHalTest : public testing::Test
+{
+       public:
+               virtual void SetUp()
+               {
+                       int ret;
+
+                       ret = system_info_get_platform_bool(FEATURE_BATTERY, &supported);
+                       EXPECT_EQ(SYSTEM_INFO_ERROR_NONE, ret) << "system_info_get_platform_bool failed";
+
+               }
+
+               virtual void TearDown()
+               {
+
+               }
+};
+
+class CPUHalTest : public testing::Test
+{
+       public:
+               virtual void SetUp()
+               {
+
+               }
+
+               virtual void TearDown()
+               {
+
+               }
+};
+
+class DISPLAYHalTest : public testing::Test
+{
+       public:
+               virtual void SetUp()
+               {
+
+               }
+
+               virtual void TearDown()
+               {
+
+               }
+};
+
+class EXTCONHalTest : public testing::Test
+{
+       public:
+               virtual void SetUp()
+               {
+
+               }
+
+               virtual void TearDown()
+               {
+
+               }
+};
+
+class IRHalTest : public testing::Test
+{
+       public:
+               virtual void SetUp()
+               {
+                       int ret;
+
+                       ret = system_info_get_platform_bool(FEATURE_IR, &supported);
+                       EXPECT_EQ(SYSTEM_INFO_ERROR_NONE, ret) << "system_info_get_platform_bool failed";
+               }
+
+               virtual void TearDown()
+               {
+
+               }
+};
+
+class RGBHalTest : public testing::Test
+{
+       public:
+               virtual void SetUp()
+               {
+                       int ret;
+
+                       ret = system_info_get_platform_bool(FEATURE_LED, &supported);
+                       EXPECT_EQ(SYSTEM_INFO_ERROR_NONE, ret) << "system_info_get_platform_bool failed";
+               }
+
+               virtual void TearDown()
+               {
+
+               }
+};
+
+class THERMALHalTest : public testing::Test
+{
+       public:
+               virtual void SetUp()
+               {
+
+               }
+
+               virtual void TearDown()
+               {
+
+               }
+};
+
+class TOUCHSCREENHalTest : public testing::Test
+{
+       public:
+               virtual void SetUp()
+               {
+
+               }
+
+               virtual void TearDown()
+               {
+
+               }
+};
+
+class USBCLIENTHalTest : public testing::Test
+{
+       public:
+               virtual void SetUp()
+               {
+                       int ret;
+                       char *model_name = NULL;
+
+                       ret = system_info_get_platform_string(MODEL_NAME, &model_name);
+                       EXPECT_EQ(SYSTEM_INFO_ERROR_NONE, ret) << "system_info_get_platform_bool failed";
+
+                       if (!strncmp(model_name, "artik", 5)) {
+                               supported = true;
+                       } else {
+                               supported = false;
+                       }
+                       cout << "supported " << supported << endl;
+                       free(model_name);
+               }
+
+               virtual void TearDown()
+               {
+
+               }
+};
+
+class USBGADGETHalTest : public testing::Test
+{
+       public:
+               virtual void SetUp()
+               {
+
+               }
+
+               virtual void TearDown()
+               {
+
+               }
+};
+
+/*
+ * Testcase for Battery
+ */
+TEST_F(BATTERYHalTest, InitP)
+{
+       int ret;
+
+       if (!supported)
+               return;
+
+       ret = hw_get_info(BATTERY_HARDWARE_DEVICE_ID,
+                       (const struct hw_info **)&info);
+       EXPECT_EQ(ret, 0) << "Fail to load battery hal (" << ret << ")";
+
+       if (!info->open) {
+               cout << "There is no function for info open" << endl;
+               return;
+       }
+       ret = info->open(info, NULL, (struct hw_common**)&battery_dev);
+       EXPECT_EQ(ret, 0) << "Fail to open battery device(" << ret << ")";
+}
+
+static void updated_cb(struct battery_info *info, void *data)
+{
+
+}
+
+TEST_F(BATTERYHalTest, RegisterChangedEventP)
+{
+       int ret;
+
+       if (!supported)
+               return;
+
+       if (!battery_dev->register_changed_event) {
+               cout << "There is no function for register_changed_event" << endl;
+               return;
+       }
+       ret = battery_dev->register_changed_event(updated_cb, NULL);
+       EXPECT_EQ(ret, 0) << "Fail to register_changed_event (" << ret << ")";
+}
+
+TEST_F(BATTERYHalTest, UnregisterChangedEventP)
+{
+       if (!supported)
+               return;
+
+       if (!battery_dev->unregister_changed_event) {
+               cout << "There is no function for unregister_changed_event" << endl;
+               return;
+       }
+       battery_dev->unregister_changed_event(updated_cb);
+}
+
+TEST_F(BATTERYHalTest, GetCurrentStateP)
+{
+       int ret;
+
+       if (!supported)
+               return;
+
+       if (!battery_dev->get_current_state) {
+               cout << "There is no function for get_current_state" << endl;
+               return;
+       }
+       ret = battery_dev->get_current_state(updated_cb, NULL);
+       EXPECT_EQ(ret, 0) << "Fail to get_current_state (" << ret << ")";
+}
+
+TEST_F(BATTERYHalTest, DeinitP)
+{
+       int ret;
+
+       if (!supported)
+               return;
+
+       if (!info->close) {
+               cout << "There is no function for info close" << endl;
+               return;
+       }
+       ret = info->close((struct hw_common *)battery_dev);
+       EXPECT_EQ(ret, 0) << "Fail to close battery device(" << ret << ")";
+}
+
+/*
+ * Testcase for Cpu
+ */
+TEST_F(CPUHalTest, InitP)
+{
+       int ret;
+
+       ret = hw_get_info(CPU_HARDWARE_DEVICE_ID,
+                       (const struct hw_info **)&info);
+       if (ret < 0) {
+               cout << "There is no device for cpu " << ret << endl;
+               return;
+       } else {
+               EXPECT_EQ(ret, 0) << "Fail to load cpu hal (" << ret << ")";
+       }
+       if (!info || !info->open) {
+               cout << "There is no function for info open" << endl;
+               return;
+       }
+       ret = info->open(info, NULL, (struct hw_common**)&cpu_dev);
+       EXPECT_EQ(ret, 0) << "Fail to open cpu device (" << ret << ")";
+}
+
+TEST_F(CPUHalTest, StartBoostP)
+{
+       int ret;
+
+       if (!cpu_dev || !cpu_dev->start_boost) {
+               cout << "There is no function for start_boost" << endl;
+               return;
+       }
+
+       // prprpr TODO
+       ret = cpu_dev->start_boost((void *)LOWBATTERY);
+       EXPECT_EQ(ret, 0) << "Fail to start_boost (" << ret << ")";
+}
+
+TEST_F(CPUHalTest, StopBoostP)
+{
+       int ret;
+
+       if (!cpu_dev || !cpu_dev->stop_boost) {
+               cout << "There is no function for stop_boost" << endl;
+               return;
+       }
+
+       // prprpr TODO
+       ret = cpu_dev->stop_boost((void *)LOWBATTERY);
+       EXPECT_EQ(ret, 0) << "Fail to stop_boost (" << ret << ")";
+}
+
+TEST_F(CPUHalTest, DeinitP)
+{
+       int ret;
+
+       if (!info || !info->close) {
+               cout << "There is no function for info close" << endl;
+               return;
+       }
+
+       ret = info->close((struct hw_common *)cpu_dev);
+       EXPECT_EQ(ret, 0) << "Fail to open cpu device (" << ret << ")";
+}
+
+/*
+ * Testcase for Display
+ */
+TEST_F(DISPLAYHalTest, InitP)
+{
+       int ret;
+
+       ret = hw_get_info(DISPLAY_HARDWARE_DEVICE_ID,
+                       (const struct hw_info **)&info);
+       if (ret < 0) {
+               cout << "There is no device for display" << ret << endl;
+               return;
+       } else {
+               EXPECT_EQ(ret, 0) << "Fail to load display hal (" << ret << ")";
+       }
+
+       if (!info || !info->open) {
+               cout << "There is no function for info open" << endl;
+               return;
+       }
+       ret = info->open(info, NULL, (struct hw_common**)&display_dev);
+       EXPECT_EQ(ret, 0) << "Fail to open display device (" << ret << ")";
+}
+
+TEST_F(DISPLAYHalTest, GetMaxBrightnessP)
+{
+       int ret;
+       int max;
+
+       if (!display_dev || !display_dev->get_max_brightness) {
+               cout << "There is no function for get_max_brightness" << endl;
+               return;
+       }
+       ret = display_dev->get_max_brightness(&max);
+       EXPECT_EQ(ret, 0) << "Fail to get_max_brightness (" << ret << ")";
+}
+
+TEST_F(DISPLAYHalTest, GetBrightnessP)
+{
+       int ret;
+       int brt;
+
+       if (!display_dev || !display_dev->get_brightness) {
+               cout << "There is no function for get_brightness" << endl;
+               return;
+       }
+       ret = display_dev->get_brightness(&brt);
+       EXPECT_EQ(ret, 0) << "Fail to get_brightness (" << ret << ")";
+}
+
+TEST_F(DISPLAYHalTest, SetBrightnessP)
+{
+       int ret;
+       int max;
+
+       if (!display_dev || !display_dev->get_max_brightness) {
+               cout << "There is no function for get_max_brightness" << endl;
+               return;
+       }
+       ret = display_dev->get_max_brightness(&max);
+       EXPECT_EQ(ret, 0) << "Fail to get_max_brightness (" << ret << ")";
+
+       if (!display_dev || !display_dev->set_brightness) {
+               cout << "There is no function for set_brightness" << endl;
+               return;
+       }
+       ret = display_dev->set_brightness(max);
+       EXPECT_EQ(ret, 0) << "Fail to set_brightness (" << ret << ")";
+}
+
+TEST_F(DISPLAYHalTest, GetAutoBrightnessP)
+{
+       int ret;
+       int brt;
+       float lmax = 0, lmin = 0, light = 0;
+
+       if (!display_dev || !display_dev->get_auto_brightness) {
+               cout << "There is no function for get_auto_brightness" << endl;
+               return;
+       }
+       ret = display_dev->get_auto_brightness(lmax, lmin, light, &brt);
+       EXPECT_GE(ret, 0) << "Fail to set_brightness (" << ret << ")";
+}
+
+TEST_F(DISPLAYHalTest, GetStateP)
+{
+       int ret;
+       enum display_state state;
+
+       if (!display_dev || !display_dev->get_state) {
+               cout << "There is no function for get_state" << endl;
+               return;
+       }
+       ret = display_dev->get_state(&state);
+       EXPECT_GE(ret, 0) << "Fail to get_state (" << ret << ")";
+}
+
+TEST_F(DISPLAYHalTest, SetStateP)
+{
+       int ret;
+
+       if (!display_dev || !display_dev->set_state) {
+               cout << "There is no function for set_state" << endl;
+               return;
+       }
+       ret = display_dev->set_state(DISPLAY_ON);
+       EXPECT_GE(ret, 0) << "Fail to set_state (" << ret << ")";
+}
+
+TEST_F(DISPLAYHalTest, GetMaxFrameRateP)
+{
+       int ret;
+       int max;
+
+       if (!display_dev || !display_dev->get_max_frame_rate) {
+               cout << "There is no function for get_max_frame_rate" << endl;
+               return;
+       }
+       ret = display_dev->get_max_frame_rate(&max);
+       EXPECT_GE(ret, 0) << "Fail to get_max_frame_rate (" << ret << ")";
+}
+
+TEST_F(DISPLAYHalTest, GetMinFrameRateP)
+{
+       int ret;
+       int min;
+
+       if (!display_dev || !display_dev->get_min_frame_rate) {
+               cout << "There is no function for get_min_frame_rate" << endl;
+               return;
+       }
+       ret = display_dev->get_min_frame_rate(&min);
+       EXPECT_GE(ret, 0) << "Fail to get_min_frame_rate (" << ret << ")";
+}
+
+TEST_F(DISPLAYHalTest, GetFrameRateP)
+{
+       int ret, rate;
+
+       if (!display_dev || !display_dev->get_frame_rate) {
+               cout << "There is no function for get_frame_rate" << endl;
+               return;
+       }
+       ret = display_dev->get_frame_rate(&rate);
+       EXPECT_GE(ret, 0) << "Fail to get frame rate (" << ret << ")";
+}
+
+TEST_F(DISPLAYHalTest, SetFrameRateP)
+{
+       int ret;
+       int max;
+
+       if (!display_dev || !display_dev->get_max_frame_rate) {
+               cout << "There is no function for get_max_frame_rate" << endl;
+               return;
+       }
+       ret = display_dev->get_max_frame_rate(&max);
+       EXPECT_GE(ret, 0) << "Fail to get_max_frame_rate (" << ret << ")";
+
+       if (!display_dev->set_frame_rate) {
+               cout << "There is no function for set_frame_rate" << endl;
+               return;
+       }
+       ret = display_dev->set_frame_rate(max);
+       EXPECT_GE(ret, 0) << "Fail to set_frame_rate (" << ret << ")";
+}
+
+TEST_F(DISPLAYHalTest, DeinitP)
+{
+       int ret;
+
+       if (!info || !info->close) {
+               cout << "There is no function for info close" << endl;
+               return;
+       }
+       ret = info->close((struct hw_common *)display_dev);
+       EXPECT_GE(ret, 0) << "Fail to close display device (" << ret << ")";
+}
+
+/*
+ * Testcase for Extcon
+ */
+TEST_F(EXTCONHalTest, InitP)
+{
+       int ret;
+
+       ret = hw_get_info(EXTERNAL_CONNECTION_HARDWARE_DEVICE_ID,
+                       (const struct hw_info **)&info);
+       if (ret < 0) {
+               cout << "There is no device for extcon" << ret << endl;
+               return;
+       } else {
+               EXPECT_EQ(ret, 0) << "Fail to load extcon hal (" << ret << ")";
+       }
+
+       if (!info || !info->open) {
+               cout << "There is no function for info open" << endl;
+               return;
+       }
+       ret = info->open(info, NULL, (struct hw_common**)&ext_dev);
+       EXPECT_EQ(ret, 0) << "Fail to open extcon device(" << ret << ")";
+}
+
+static void updated_cb(struct connection_info *info, void *data)
+{
+
+}
+
+TEST_F(EXTCONHalTest, RegisterChangedEventP)
+{
+       int ret;
+
+       if (!ext_dev || !ext_dev->register_changed_event) {
+               cout << "There is no function for register_changed_event" << endl;
+               return;
+       }
+       ret = ext_dev->register_changed_event(updated_cb, NULL);
+       EXPECT_EQ(ret, 0) << "Fail to register_changed_event (" << ret << ")";
+}
+
+TEST_F(EXTCONHalTest, UnregisterChangedEventP)
+{
+       if (!ext_dev || !ext_dev->unregister_changed_event) {
+               cout << "There is no function for unregister_changed_event" << endl;
+               return;
+       }
+       ext_dev->unregister_changed_event(updated_cb);
+}
+
+TEST_F(EXTCONHalTest, GetCurrentStateP)
+{
+       int ret;
+
+       if (!ext_dev || !ext_dev->get_current_state) {
+               cout << "There is no function for unregister_changed_event" << endl;
+               return;
+       }
+       ret = ext_dev->get_current_state(updated_cb, NULL);
+       EXPECT_EQ(ret, 0) << "Fail to unregister_changed_event (" << ret << ")";
+}
+
+TEST_F(EXTCONHalTest, DeinitP)
+{
+       int ret;
+
+       if (!info || !info->close) {
+               cout << "There is no function for info close" << endl;
+               return;
+       }
+       ret = info->close((struct hw_common *)ext_dev);
+       EXPECT_EQ(ret, 0) << "Fail to close extcon device(" << ret << ")";
+}
+
+/*
+ * Testcase for Ir
+ */
+TEST_F(IRHalTest, InitP)
+{
+       int ret;
+
+       if (!supported)
+               return;
+
+       ret = hw_get_info(IR_HARDWARE_DEVICE_ID,
+                       (const struct hw_info **)&info);
+       EXPECT_EQ(ret, 0) << "Fail to get hal for ir (" << ret << ")";
+
+       if (!info->open) {
+               cout << "There is no function for info open" << endl;
+               return;
+       }
+       ret = info->open(info, NULL, (struct hw_common**)&ir_dev);
+       EXPECT_EQ(ret, 0) << "Fail to open ir device (" << ret << ")";
+}
+
+TEST_F(IRHalTest, IsAvailableP)
+{
+       int ret;
+       bool val;
+
+       if (!supported)
+               return;
+
+       if (!ir_dev->is_available) {
+               cout << "There is no function for is_available" << endl;
+               return;
+       }
+       ret = ir_dev->is_available(&val);
+       EXPECT_EQ(ret, 0) << "Fail to is_available (" << ret << ")";
+}
+
+TEST_F(IRHalTest, TransmitP)
+{
+       int ret;
+       int pattern[5] = {100, 200, 300, 400, 500};
+
+       if (!supported)
+               return;
+
+       if (!ir_dev->transmit) {
+               cout << "There is no function for transmit" << endl;
+               return;
+       }
+       ret = ir_dev->transmit(pattern, 5);
+       EXPECT_EQ(ret, 0) << "Fail to transmit (" << ret << ")";
+}
+
+TEST_F(IRHalTest, DeinitP)
+{
+       int ret;
+
+       if (!supported)
+               return;
+
+       if (!info->close) {
+               cout << "There is no function for info close" << endl;
+               return;
+       }
+       ret = info->close((struct hw_common *)ir_dev);
+       EXPECT_EQ(ret, 0) << "Fail to close ir device (" << ret << ")";
+}
+
+/*
+ * Testcase for Rgb
+ */
+TEST_F(RGBHalTest, InitP)
+{
+       int ret;
+
+       if (!supported)
+               return;
+
+       ret = hw_get_info(LED_HARDWARE_DEVICE_ID,
+                       (const struct hw_info **)&info);
+       EXPECT_EQ(ret, 0) << "Fail to get hal for rgb (" << ret << ")";
+
+       if (!info->open) {
+               cout << "There is no function for info open" << endl;
+               return;
+       }
+       ret = info->open(info, LED_ID_NOTIFICATION, (struct hw_common**)&rgb_dev);
+       EXPECT_EQ(ret, 0) << "Fail to open rgb device (" << ret << ")";
+}
+
+TEST_F(RGBHalTest, SetStateP)
+{
+       struct led_state state;
+       int ret;
+
+       if (!supported)
+               return;
+
+       if (!rgb_dev->set_state) {
+               cout << "There is no function for set_state" << endl;
+               return;
+       }
+
+       state.type = LED_TYPE_BLINK;
+       state.color = 0xFFFFFF;
+       state.duty_on = 500;
+       state.duty_off = 500;
+       ret = rgb_dev->set_state(&state);
+       EXPECT_GE(ret, 0) << "Fail to set_state (" << ret << ")";
+}
+
+TEST_F(RGBHalTest, DeinitP)
+{
+       int ret;
+
+       if (!supported)
+               return;
+
+       if (!info->close) {
+               cout << "There is no function for info close" << endl;
+               return;
+       }
+       ret = info->close((struct hw_common *)rgb_dev);
+       EXPECT_GE(ret, 0) << "Fail to close rgb device (" << ret << ")";
+}
+
+/*
+ * Testcase for Thermal
+ */
+TEST_F(THERMALHalTest, InitP)
+{
+       int ret;
+
+       ret = hw_get_info(THERMAL_HARDWARE_DEVICE_ID,
+                               (const struct hw_info **)&info);
+       if (ret < 0) {
+               cout << "There is no device for thermal" << ret << endl;
+               return;
+       } else {
+               EXPECT_EQ(ret, 0) << "Fail to get hal for thermal (" << ret << ")";
+       }
+
+       if (!info || !info->open) {
+               cout << "There is no function for info open" << endl;
+               return;
+       }
+       ret = info->open(info, NULL, (struct hw_common**)&thermal_dev);
+       EXPECT_EQ(ret, 0) << "Fail to open thermal device (" << ret << ")";
+}
+
+TEST_F(THERMALHalTest, GetStateP)
+{
+       struct thermal_info thermal;
+       int ret;
+
+       if (!thermal_dev || !thermal_dev->get_state) {
+               cout << "There is no function for get_state" << endl;
+               return;
+       }
+       ret = thermal_dev->get_state(&thermal);
+       EXPECT_EQ(ret, 0) << "Fail to get_state (" << ret << ")";
+}
+
+static void updated_cb(struct thermal_info *info, void *data)
+{
+
+}
+
+TEST_F(THERMALHalTest, RegisterChangedEventP)
+{
+       int ret;
+
+       if (!thermal_dev || !thermal_dev->register_changed_event) {
+               cout << "There is no function for register_changed_event" << endl;
+               return;
+       }
+       ret = thermal_dev->register_changed_event(updated_cb, NULL);
+       EXPECT_EQ(ret, 0) << "Fail to register_changed_event (" << ret << ")";
+}
+
+TEST_F(THERMALHalTest, UnregisterChangedEventP)
+{
+       if (!thermal_dev || !thermal_dev->unregister_changed_event) {
+               cout << "There is no function for unregister_changed_event" << endl;
+               return;
+       }
+       thermal_dev->unregister_changed_event(updated_cb);
+}
+
+TEST_F(THERMALHalTest, DeinitP)
+{
+       int ret;
+
+       if (!info || !info->close) {
+               cout << "There is no function for info close" << endl;
+               return;
+       }
+       ret = info->close((struct hw_common *)thermal_dev);
+       EXPECT_EQ(ret, 0) << "Fail to close thermal device (" << ret << ")";
+}
+
+/*
+ * Testcase for Touchscreen
+ */
+TEST_F(TOUCHSCREENHalTest, InitP)
+{
+       int ret;
+
+       ret = hw_get_info(TOUCHSCREEN_HARDWARE_DEVICE_ID,
+                       (const struct hw_info **)&info);
+       if (ret < 0) {
+               cout << "There is no device for touchscreen " << ret << endl;
+               return;
+       } else {
+               EXPECT_EQ(ret, 0) << "Fail to get hal for touchscreen (" << ret << ")";
+       }
+
+       if (!info || !info->open) {
+               cout << "There is no function for info open" << endl;
+               return;
+       }
+       ret = info->open(info, NULL, (struct hw_common**)&touchscreen_dev);
+       EXPECT_EQ(ret, 0) << "Fail to open touchscreen device (" << ret << ")";
+}
+
+TEST_F(TOUCHSCREENHalTest, SetstateP)
+{
+       enum touchscreen_state state = TOUCHSCREEN_ON;
+       int ret;
+
+       if (!touchscreen_dev || !touchscreen_dev->set_state) {
+               cout << "There is no function for set_state" << endl;
+               return;
+       }
+       ret = touchscreen_dev->set_state(state);
+       EXPECT_EQ(ret, 0) << "Fail to set_state (" << ret << ")";
+}
+
+TEST_F(TOUCHSCREENHalTest, DeinitP)
+{
+       int ret;
+
+       if (!info || !info->close) {
+               cout << "There is no function for info close" << endl;
+               return;
+       }
+       ret = info->close((struct hw_common *)touchscreen_dev);
+       EXPECT_EQ(ret, 0) << "Fail to close touchscreen device (" << ret << ")";
+}
+
+/*
+ * Testcase for Client
+ */
+TEST_F(USBCLIENTHalTest, InitP)
+{
+       int ret;
+
+       if (!supported)
+               return;
+
+       ret = hw_get_info(USB_CLIENT_HARDWARE_DEVICE_ID,
+                       (const struct hw_info **)&info);
+       if (ret < 0) {
+               cout << "There is no device for usb client" << ret << endl;
+               return;
+       } else {
+               EXPECT_EQ(ret, 0) << "Fail to get hal for usb client (" << ret << ")";
+       }
+       if (!info || !info->open) {
+               cout << "There is no function for info open" << endl;
+               return;
+       }
+       ret = info->open(info, NULL, (struct hw_common**)&client_dev);
+       EXPECT_EQ(ret, 0) << "Fail to open usb client device (" << ret << ")";
+       EXPECT_NE(client_dev, nullptr) << "Fail to get usb client device structure";
+
+       ret = hw_get_info(USB_GADGET_DEVICE_ID,
+                       (const struct hw_info **)&info);
+       if (ret < 0) {
+               cout << "There is no device for usb gadget" << ret << endl;
+               return;
+       } else {
+               EXPECT_EQ(ret, 0) << "Fail to get hal for usb gadget (" << ret << ")";
+       }
+
+       if (!info || !info->open) {
+               cout << "There is no function for info open" << endl;
+               return;
+       }
+       ret = info->open(info, NULL, (struct hw_common**)&gadget_translator);
+       EXPECT_EQ(ret, 0) << "Fail to open usb gadget device (" << ret << ")";
+}
+
+TEST_F(USBCLIENTHalTest, EnableP)
+{
+       int ret;
+       char str[256];
+
+       if (!supported)
+               return;
+
+       //dummy code to prevent error for not used function
+       snprintf(str, 255, "%s,", _available_funcs[2]->name);
+
+       if (!client_dev || !client_dev->enable) {
+               cout << "There is no function for enable" << endl;
+               return;
+       }
+       ret = client_dev->enable(client_dev);
+       EXPECT_EQ(ret, 0) << "Fail to enable (" << ret << ")";
+}
+
+TEST_F(USBCLIENTHalTest, ReConfigureGadgetP)
+{
+       int ret;
+
+       if (!supported)
+               return;
+
+       if (!gadget_translator || !gadget_translator->id_to_gadget) {
+               cout << "There is no function for id_to_gadget" << endl;
+               return;
+       }
+       gadget_id.function_mask = 7;
+       ret = gadget_translator->id_to_gadget(&gadget_id, &gadget_dev);
+       EXPECT_EQ(ret, 0) << "Fail to id_to_gadget (" << ret << ")";
+
+       if (!client_dev || !client_dev->disable) {
+               cout << "There is no function for disable" << endl;
+               return;
+       }
+       ret = client_dev->disable(client_dev);
+       EXPECT_EQ(ret, 0) << "Fail to disable (" << ret << ")";
+
+       if (!client_dev || !client_dev->reconfigure_gadget) {
+               cout << "There is no function for reconfigure_gadget" << endl;
+               return;
+       }
+       ret = client_dev->reconfigure_gadget(client_dev, gadget_dev);
+       EXPECT_EQ(ret, 0) << "Fail to reconfigure_gadget (" << ret << ")";
+}
+
+TEST_F(USBCLIENTHalTest, IsGadgetSupportedP)
+{
+       bool flag;
+
+       if (!supported)
+               return;
+
+       if (!client_dev || !client_dev->is_gadget_supported) {
+               cout << "There is no function for is_gadget_supported" << endl;
+               return;
+       }
+       flag = client_dev->is_gadget_supported(client_dev, gadget_dev);
+       EXPECT_EQ(flag, true) << "Fail to is_gadget_supported (" << flag << ")";
+}
+
+TEST_F(USBCLIENTHalTest, IsFunctionSupportedP)
+{
+       bool flag;
+
+       if (!supported)
+               return;
+
+       if (!client_dev || !client_dev->is_function_supported) {
+               cout << "There is no function for is_function_supported" << endl;
+               return;
+       }
+       flag = client_dev->is_function_supported(client_dev, *gadget_dev->funcs);
+       EXPECT_EQ(flag, true) << "Fail to is_function_supported (" << flag << ")";
+}
+
+TEST_F(USBCLIENTHalTest, GetCurrentGadgetP)
+{
+       int ret;
+
+       if (!supported)
+               return;
+
+       if (!client_dev || !client_dev->get_current_gadget) {
+               cout << "There is no function for get_current_gadget" << endl;
+               return;
+       }
+       ret = client_dev->get_current_gadget(client_dev, &gadget_dev);
+       EXPECT_EQ(ret, 0) << "Fail to get_current_gadget (" << ret << ")";
+}
+
+TEST_F(USBCLIENTHalTest, DisableP)
+{
+       int ret;
+
+       if (!supported)
+               return;
+
+       if (!client_dev || !client_dev->disable) {
+               cout << "There is no function for disable" << endl;
+               return;
+       }
+       ret = client_dev->disable(client_dev);
+       EXPECT_EQ(ret, 0) << "Fail to disable (" << ret << ")";
+}
+
+TEST_F(USBCLIENTHalTest, FreeGadgetP)
+{
+       if (!supported)
+               return;
+
+       if (!client_dev || !client_dev->free_gadget) {
+               cout << "There is no function for free_gadget" << endl;
+               return;
+       }
+       client_dev->free_gadget(gadget_dev);
+}
+
+TEST_F(USBCLIENTHalTest, DeinitP)
+{
+       int ret;
+
+       if (!supported)
+               return;
+
+       if (!info || !info->close) {
+               cout << "There is no function for info close" << endl;
+               return;
+       }
+       ret = info->close((struct hw_common *)client_dev);
+       EXPECT_EQ(ret, 0) << "Fail to close usb client device (" << ret << ")";
+}
+
+/*
+ * Testcase for Gadget
+ */
+TEST_F(USBGADGETHalTest, InitP)
+{
+       int ret;
+
+       ret = hw_get_info(USB_GADGET_DEVICE_ID,
+                       (const struct hw_info **)&info);
+       if (ret < 0) {
+               cout << "There is no device for usb gadget" << ret << endl;
+               return;
+       } else {
+               EXPECT_EQ(ret, 0) << "Fail to get hal for usb gadget (" << ret << ")";
+       }
+
+       if (!info || !info->open) {
+               cout << "There is no function for info open" << endl;
+               return;
+       }
+       ret = info->open(info, NULL, (struct hw_common**)&gadget_translator);
+       EXPECT_EQ(ret, 0) << "Fail to open usb gadget device (" << ret << ")";
+}
+
+TEST_F(USBGADGETHalTest, IdToGadget)
+{
+       struct usb_gadget_id gadget_id;
+       int ret;
+       char str[256];
+
+       if (!gadget_translator || !gadget_translator->id_to_gadget) {
+               cout << "There is no function for id_to_gadget" << endl;
+               return;
+       }
+       //dummy code to prevent error for not used function
+       snprintf(str, 255, "%s,", _available_funcs[2]->name);
+       gadget_id.function_mask = 7;
+       ret = gadget_translator->id_to_gadget(&gadget_id, &gadget_dev);
+       EXPECT_EQ(ret, 0) << "Fail to id_to_gadget (" << ret << ")";
+}
+
+TEST_F(USBGADGETHalTest, CleanUpGadget)
+{
+       if (!gadget_translator || !gadget_translator->cleanup_gadget) {
+               cout << "There is no function for cleanup_gadget" << endl;
+               return;
+       }
+       gadget_translator->cleanup_gadget(gadget_dev);
+}
+
+TEST_F(USBGADGETHalTest, DeinitP)
+{
+       int ret;
+
+       if (!info || !info->close) {
+               cout << "There is no function for info close" << endl;
+               return;
+       }
+       ret = info->close((struct hw_common *)gadget_translator);
+       EXPECT_EQ(ret, 0) << "Fail to close usb gadget device (" << ret << ")";
+}
+
+int main(int argc, char **argv)
+{
+       testing::InitGoogleTest(&argc, argv);
+
+       return RUN_ALL_TESTS();
+}
diff --git a/unittest/gtest_hal_battery.cpp b/unittest/gtest_hal_battery.cpp
deleted file mode 100755 (executable)
index b7a5946..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-
-#include <iostream>
-#include <gtest/gtest.h>
-#include <system_info.h>
-#include "hw/battery.h"
-#include "unittest.h"
-
-using namespace std;
-
-/*
- * main class
- */
-struct hw_info *info;
-struct battery_device *battery_dev;
-static bool need_featurecheck = true;
-
-class BATTERYHalTest : public testing::Test
-{
-       public:
-               virtual void SetUp()
-               {
-                       int ret;
-
-                       if (need_featurecheck) {
-                               ret = system_info_get_platform_bool(FEATURE_BATTERY, &supported);
-                               EXPECT_EQ(SYSTEM_INFO_ERROR_NONE, ret) << "system_info_get_platform_bool failed";
-                               need_featurecheck = false;
-                       }
-               }
-
-               virtual void TearDown()
-               {
-
-               }
-};
-
-/*
- * testcase
- */
-TEST_F(BATTERYHalTest, InitP)
-{
-       int ret;
-
-       if (!supported)
-               return;
-
-       ret = hw_get_info(BATTERY_HARDWARE_DEVICE_ID,
-                       (const struct hw_info **)&info);
-       EXPECT_EQ(ret, 0) << "Fail to load battery hal (" << ret << ")";
-
-       if (!info->open) {
-               cout << "There is no function for info open" << endl;
-               return;
-       }
-       ret = info->open(info, NULL, (struct hw_common**)&battery_dev);
-       EXPECT_EQ(ret, 0) << "Fail to open battery device(" << ret << ")";
-}
-
-static void updated_cb(struct battery_info *info, void *data)
-{
-
-}
-
-TEST_F(BATTERYHalTest, RegisterChangedEventP)
-{
-       int ret;
-
-       if (!supported)
-               return;
-
-       if (!battery_dev->register_changed_event) {
-               cout << "There is no function for register_changed_event" << endl;
-               return;
-       }
-       ret = battery_dev->register_changed_event(updated_cb, NULL);
-       EXPECT_EQ(ret, 0) << "Fail to register_changed_event (" << ret << ")";
-}
-
-TEST_F(BATTERYHalTest, UnregisterChangedEventP)
-{
-       if (!supported)
-               return;
-
-       if (!battery_dev->unregister_changed_event) {
-               cout << "There is no function for unregister_changed_event" << endl;
-               return;
-       }
-       battery_dev->unregister_changed_event(updated_cb);
-}
-
-TEST_F(BATTERYHalTest, GetCurrentStateP)
-{
-       int ret;
-
-       if (!supported)
-               return;
-
-       if (!battery_dev->get_current_state) {
-               cout << "There is no function for get_current_state" << endl;
-               return;
-       }
-       ret = battery_dev->get_current_state(updated_cb, NULL);
-       EXPECT_EQ(ret, 0) << "Fail to get_current_state (" << ret << ")";
-}
-
-TEST_F(BATTERYHalTest, DeinitP)
-{
-       int ret;
-
-       if (!supported)
-               return;
-
-       if (!info->close) {
-               cout << "There is no function for info close" << endl;
-               return;
-       }
-       ret = info->close((struct hw_common *)battery_dev);
-       EXPECT_EQ(ret, 0) << "Fail to close battery device(" << ret << ")";
-}
-
-int main(int argc, char **argv)
-{
-       testing::InitGoogleTest(&argc, argv);
-
-       return RUN_ALL_TESTS();
-}
diff --git a/unittest/gtest_hal_cpu.cpp b/unittest/gtest_hal_cpu.cpp
deleted file mode 100755 (executable)
index e1541fa..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-
-#include <iostream>
-#include <gtest/gtest.h>
-#include "hw/cpu.h"
-
-using namespace std;
-
-/*
- * main class
- */
-
-#define LOWBATTERY "LowBattery"
-
-struct hw_info *info;
-struct cpu_device *cpu_dev;
-
-class CPUHalTest : public testing::Test
-{
-       public:
-               virtual void SetUp()
-               {
-
-               }
-
-               virtual void TearDown()
-               {
-
-               }
-};
-
-/*
- * testcase
- */
-TEST_F(CPUHalTest, InitP)
-{
-       int ret;
-
-       ret = hw_get_info(CPU_HARDWARE_DEVICE_ID,
-                       (const struct hw_info **)&info);
-       if (ret < 0) {
-               cout << "There is no device for cpu " << ret << endl;
-               return;
-       } else {
-               EXPECT_EQ(ret, 0) << "Fail to load cpu hal (" << ret << ")";
-       }
-       if (!info || !info->open) {
-               cout << "There is no function for info open" << endl;
-               return;
-       }
-       ret = info->open(info, NULL, (struct hw_common**)&cpu_dev);
-       EXPECT_EQ(ret, 0) << "Fail to open cpu device (" << ret << ")";
-}
-
-TEST_F(CPUHalTest, StartBoostP)
-{
-       int ret;
-
-       if (!cpu_dev || !cpu_dev->start_boost) {
-               cout << "There is no function for start_boost" << endl;
-               return;
-       }
-
-       // prprpr TODO
-       ret = cpu_dev->start_boost((void *)LOWBATTERY);
-       EXPECT_EQ(ret, 0) << "Fail to start_boost (" << ret << ")";
-}
-
-TEST_F(CPUHalTest, StopBoostP)
-{
-       int ret;
-
-       if (!cpu_dev || !cpu_dev->stop_boost) {
-               cout << "There is no function for stop_boost" << endl;
-               return;
-       }
-
-       // prprpr TODO
-       ret = cpu_dev->stop_boost((void *)LOWBATTERY);
-       EXPECT_EQ(ret, 0) << "Fail to stop_boost (" << ret << ")";
-}
-
-TEST_F(CPUHalTest, DeinitP)
-{
-       int ret;
-
-       if (!info || !info->close) {
-               cout << "There is no function for info close" << endl;
-               return;
-       }
-
-       ret = info->close((struct hw_common *)cpu_dev);
-       EXPECT_EQ(ret, 0) << "Fail to open cpu device (" << ret << ")";
-}
-
-int main(int argc, char **argv)
-{
-       testing::InitGoogleTest(&argc, argv);
-
-       return RUN_ALL_TESTS();
-}
diff --git a/unittest/gtest_hal_display.cpp b/unittest/gtest_hal_display.cpp
deleted file mode 100755 (executable)
index bb21cb2..0000000
+++ /dev/null
@@ -1,215 +0,0 @@
-
-#include <iostream>
-#include <gtest/gtest.h>
-#include "hw/display.h"
-
-using namespace std;
-
-/*
- * main class
- */
-
-#define LOWBATTERY "LowBattery"
-
-struct hw_info *info;
-struct display_device *display_dev;
-
-class DISPLAYHalTest : public testing::Test
-{
-       public:
-               virtual void SetUp()
-               {
-
-               }
-
-               virtual void TearDown()
-               {
-
-               }
-};
-
-/*
- * testcase
- */
-TEST_F(DISPLAYHalTest, InitP)
-{
-       int ret;
-
-       ret = hw_get_info(DISPLAY_HARDWARE_DEVICE_ID,
-                       (const struct hw_info **)&info);
-       if (ret < 0) {
-               cout << "There is no device for display" << ret << endl;
-               return;
-       } else {
-               EXPECT_EQ(ret, 0) << "Fail to load display hal (" << ret << ")";
-       }
-
-       if (!info || !info->open) {
-               cout << "There is no function for info open" << endl;
-               return;
-       }
-       ret = info->open(info, NULL, (struct hw_common**)&display_dev);
-       EXPECT_EQ(ret, 0) << "Fail to open display device (" << ret << ")";
-}
-
-TEST_F(DISPLAYHalTest, GetMaxBrightnessP)
-{
-       int ret;
-       int max;
-
-       if (!display_dev || !display_dev->get_max_brightness) {
-               cout << "There is no function for get_max_brightness" << endl;
-               return;
-       }
-       ret = display_dev->get_max_brightness(&max);
-       EXPECT_EQ(ret, 0) << "Fail to get_max_brightness (" << ret << ")";
-}
-
-TEST_F(DISPLAYHalTest, GetBrightnessP)
-{
-       int ret;
-       int brt;
-
-       if (!display_dev || !display_dev->get_brightness) {
-               cout << "There is no function for get_brightness" << endl;
-               return;
-       }
-       ret = display_dev->get_brightness(&brt);
-       EXPECT_EQ(ret, 0) << "Fail to get_brightness (" << ret << ")";
-}
-
-TEST_F(DISPLAYHalTest, SetBrightnessP)
-{
-       int ret;
-       int max;
-
-       if (!display_dev || !display_dev->get_max_brightness) {
-               cout << "There is no function for get_max_brightness" << endl;
-               return;
-       }
-       ret = display_dev->get_max_brightness(&max);
-       EXPECT_EQ(ret, 0) << "Fail to get_max_brightness (" << ret << ")";
-
-       if (!display_dev || !display_dev->set_brightness) {
-               cout << "There is no function for set_brightness" << endl;
-               return;
-       }
-       ret = display_dev->set_brightness(max);
-       EXPECT_EQ(ret, 0) << "Fail to set_brightness (" << ret << ")";
-}
-
-TEST_F(DISPLAYHalTest, GetAutoBrightnessP)
-{
-       int ret;
-       int brt;
-       float lmax = 0, lmin = 0, light = 0;
-
-       if (!display_dev || !display_dev->get_auto_brightness) {
-               cout << "There is no function for get_auto_brightness" << endl;
-               return;
-       }
-       ret = display_dev->get_auto_brightness(lmax, lmin, light, &brt);
-       EXPECT_GE(ret, 0) << "Fail to set_brightness (" << ret << ")";
-}
-
-TEST_F(DISPLAYHalTest, GetStateP)
-{
-       int ret;
-       enum display_state state;
-
-       if (!display_dev || !display_dev->get_state) {
-               cout << "There is no function for get_state" << endl;
-               return;
-       }
-       ret = display_dev->get_state(&state);
-       EXPECT_GE(ret, 0) << "Fail to get_state (" << ret << ")";
-}
-
-TEST_F(DISPLAYHalTest, SetStateP)
-{
-       int ret;
-
-       if (!display_dev || !display_dev->set_state) {
-               cout << "There is no function for set_state" << endl;
-               return;
-       }
-       ret = display_dev->set_state(DISPLAY_ON);
-       EXPECT_GE(ret, 0) << "Fail to set_state (" << ret << ")";
-}
-
-TEST_F(DISPLAYHalTest, GetMaxFrameRateP)
-{
-       int ret;
-       int max;
-
-       if (!display_dev || !display_dev->get_max_frame_rate) {
-               cout << "There is no function for get_max_frame_rate" << endl;
-               return;
-       }
-       ret = display_dev->get_max_frame_rate(&max);
-       EXPECT_GE(ret, 0) << "Fail to get_max_frame_rate (" << ret << ")";
-}
-
-TEST_F(DISPLAYHalTest, GetMinFrameRateP)
-{
-       int ret;
-       int min;
-
-       if (!display_dev || !display_dev->get_min_frame_rate) {
-               cout << "There is no function for get_min_frame_rate" << endl;
-               return;
-       }
-       ret = display_dev->get_min_frame_rate(&min);
-       EXPECT_GE(ret, 0) << "Fail to get_min_frame_rate (" << ret << ")";
-}
-
-TEST_F(DISPLAYHalTest, GetFrameRateP)
-{
-       int ret, rate;
-
-       if (!display_dev || !display_dev->get_frame_rate) {
-               cout << "There is no function for get_frame_rate" << endl;
-               return;
-       }
-       ret = display_dev->get_frame_rate(&rate);
-       EXPECT_GE(ret, 0) << "Fail to get frame rate (" << ret << ")";
-}
-
-TEST_F(DISPLAYHalTest, SetFrameRateP)
-{
-       int ret;
-       int max;
-
-       if (!display_dev || !display_dev->get_max_frame_rate) {
-               cout << "There is no function for get_max_frame_rate" << endl;
-               return;
-       }
-       ret = display_dev->get_max_frame_rate(&max);
-       EXPECT_GE(ret, 0) << "Fail to get_max_frame_rate (" << ret << ")";
-
-       if (!display_dev->set_frame_rate) {
-               cout << "There is no function for set_frame_rate" << endl;
-               return;
-       }
-       ret = display_dev->set_frame_rate(max);
-       EXPECT_GE(ret, 0) << "Fail to set_frame_rate (" << ret << ")";
-}
-
-TEST_F(DISPLAYHalTest, DeinitP)
-{
-       int ret;
-
-       if (!info || !info->close) {
-               cout << "There is no function for info close" << endl;
-               return;
-       }
-       ret = info->close((struct hw_common *)display_dev);
-       EXPECT_GE(ret, 0) << "Fail to close display device (" << ret << ")";
-}
-
-int main(int argc, char **argv)
-{
-       testing::InitGoogleTest(&argc, argv);
-
-       return RUN_ALL_TESTS();
-}
diff --git a/unittest/gtest_hal_extcon.cpp b/unittest/gtest_hal_extcon.cpp
deleted file mode 100755 (executable)
index cfb8c0f..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-
-#include <iostream>
-#include <gtest/gtest.h>
-#include "hw/external_connection.h"
-
-using namespace std;
-
-/*
- * main class
- */
-struct hw_info *info;
-struct external_connection_device *ext_dev;
-
-class EXTCONHalTest : public testing::Test
-{
-       public:
-               virtual void SetUp()
-               {
-
-               }
-
-               virtual void TearDown()
-               {
-
-               }
-};
-
-/*
- * testcase
- */
-TEST_F(EXTCONHalTest, InitP)
-{
-       int ret;
-
-       ret = hw_get_info(EXTERNAL_CONNECTION_HARDWARE_DEVICE_ID,
-                       (const struct hw_info **)&info);
-       if (ret < 0) {
-               cout << "There is no device for extcon" << ret << endl;
-               return;
-       } else {
-               EXPECT_EQ(ret, 0) << "Fail to load extcon hal (" << ret << ")";
-       }
-
-       if (!info || !info->open) {
-               cout << "There is no function for info open" << endl;
-               return;
-       }
-       ret = info->open(info, NULL, (struct hw_common**)&ext_dev);
-       EXPECT_EQ(ret, 0) << "Fail to open extcon device(" << ret << ")";
-}
-
-static void updated_cb(struct connection_info *info, void *data)
-{
-
-}
-
-TEST_F(EXTCONHalTest, RegisterChangedEventP)
-{
-       int ret;
-
-       if (!ext_dev || !ext_dev->register_changed_event) {
-               cout << "There is no function for register_changed_event" << endl;
-               return;
-       }
-       ret = ext_dev->register_changed_event(updated_cb, NULL);
-       EXPECT_EQ(ret, 0) << "Fail to register_changed_event (" << ret << ")";
-}
-
-TEST_F(EXTCONHalTest, UnregisterChangedEventP)
-{
-       if (!ext_dev || !ext_dev->unregister_changed_event) {
-               cout << "There is no function for unregister_changed_event" << endl;
-               return;
-       }
-       ext_dev->unregister_changed_event(updated_cb);
-}
-
-TEST_F(EXTCONHalTest, GetCurrentStateP)
-{
-       int ret;
-
-       if (!ext_dev || !ext_dev->get_current_state) {
-               cout << "There is no function for unregister_changed_event" << endl;
-               return;
-       }
-       ret = ext_dev->get_current_state(updated_cb, NULL);
-       EXPECT_EQ(ret, 0) << "Fail to unregister_changed_event (" << ret << ")";
-}
-
-TEST_F(EXTCONHalTest, DeinitP)
-{
-       int ret;
-
-       if (!info || !info->close) {
-               cout << "There is no function for info close" << endl;
-               return;
-       }
-       ret = info->close((struct hw_common *)ext_dev);
-       EXPECT_EQ(ret, 0) << "Fail to close extcon device(" << ret << ")";
-}
-
-int main(int argc, char **argv)
-{
-       testing::InitGoogleTest(&argc, argv);
-
-       return RUN_ALL_TESTS();
-}
diff --git a/unittest/gtest_hal_ir.cpp b/unittest/gtest_hal_ir.cpp
deleted file mode 100755 (executable)
index 4b77f20..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-
-#include <iostream>
-#include <gtest/gtest.h>
-#include <system_info.h>
-#include "hw/ir.h"
-#include "unittest.h"
-
-using namespace std;
-
-/*
- * main class
- */
-struct hw_info *info;
-struct ir_device *ir_dev;
-static bool need_featurecheck = true;
-
-class IRHalTest : public testing::Test
-{
-       public:
-               virtual void SetUp()
-               {
-                       int ret;
-
-                       if (need_featurecheck) {
-                               ret = system_info_get_platform_bool(FEATURE_IR, &supported);
-                               EXPECT_EQ(SYSTEM_INFO_ERROR_NONE, ret) << "system_info_get_platform_bool failed";
-                               need_featurecheck = false;
-                       }
-               }
-
-               virtual void TearDown()
-               {
-
-               }
-};
-
-/*
- * testcase
- */
-TEST_F(IRHalTest, InitP)
-{
-       int ret;
-
-       if (!supported)
-               return;
-
-       ret = hw_get_info(IR_HARDWARE_DEVICE_ID,
-                       (const struct hw_info **)&info);
-       EXPECT_EQ(ret, 0) << "Fail to get hal for ir (" << ret << ")";
-
-       if (!info->open) {
-               cout << "There is no function for info open" << endl;
-               return;
-       }
-       ret = info->open(info, NULL, (struct hw_common**)&ir_dev);
-       EXPECT_EQ(ret, 0) << "Fail to open ir device (" << ret << ")";
-}
-
-TEST_F(IRHalTest, IsAvailableP)
-{
-       int ret;
-       bool val;
-
-       if (!supported)
-               return;
-
-       if (!ir_dev->is_available) {
-               cout << "There is no function for is_available" << endl;
-               return;
-       }
-       ret = ir_dev->is_available(&val);
-       EXPECT_EQ(ret, 0) << "Fail to is_available (" << ret << ")";
-}
-
-TEST_F(IRHalTest, TransmitP)
-{
-       int ret;
-       int pattern[5] = {100, 200, 300, 400, 500};
-
-       if (!supported)
-               return;
-
-       if (!ir_dev->transmit) {
-               cout << "There is no function for transmit" << endl;
-               return;
-       }
-       ret = ir_dev->transmit(pattern, 5);
-       EXPECT_EQ(ret, 0) << "Fail to transmit (" << ret << ")";
-}
-
-TEST_F(IRHalTest, DeinitP)
-{
-       int ret;
-
-       if (!supported)
-               return;
-
-       if (!info->close) {
-               cout << "There is no function for info close" << endl;
-               return;
-       }
-       ret = info->close((struct hw_common *)ir_dev);
-       EXPECT_EQ(ret, 0) << "Fail to close ir device (" << ret << ")";
-}
-
-int main(int argc, char **argv)
-{
-       testing::InitGoogleTest(&argc, argv);
-
-       return RUN_ALL_TESTS();
-}
diff --git a/unittest/gtest_hal_rgb.cpp b/unittest/gtest_hal_rgb.cpp
deleted file mode 100755 (executable)
index d3325be..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-
-#include <iostream>
-#include <gtest/gtest.h>
-#include <system_info.h>
-#include "hw/led.h"
-#include "unittest.h"
-
-using namespace std;
-
-/*
- * main class
- */
-struct hw_info *info;
-struct led_device *rgb_dev;
-static bool need_featurecheck = true;
-
-class RGBHalTest : public testing::Test
-{
-       public:
-               virtual void SetUp()
-               {
-                       int ret;
-
-                       if (need_featurecheck) {
-                               ret = system_info_get_platform_bool(FEATURE_LED, &supported);
-                               EXPECT_EQ(SYSTEM_INFO_ERROR_NONE, ret) << "system_info_get_platform_bool failed";
-                               need_featurecheck = false;
-                       }
-               }
-
-               virtual void TearDown()
-               {
-
-               }
-};
-
-/*
- * testcase
- */
-TEST_F(RGBHalTest, InitP)
-{
-       int ret;
-
-       if (!supported)
-               return;
-
-       ret = hw_get_info(LED_HARDWARE_DEVICE_ID,
-                       (const struct hw_info **)&info);
-       EXPECT_EQ(ret, 0) << "Fail to get hal for rgb (" << ret << ")";
-
-       if (!info->open) {
-               cout << "There is no function for info open" << endl;
-               return;
-       }
-       ret = info->open(info, LED_ID_NOTIFICATION, (struct hw_common**)&rgb_dev);
-       EXPECT_EQ(ret, 0) << "Fail to open rgb device (" << ret << ")";
-}
-
-TEST_F(RGBHalTest, SetStateP)
-{
-       struct led_state state;
-       int ret;
-
-       if (!supported)
-               return;
-
-       if (!rgb_dev->set_state) {
-               cout << "There is no function for set_state" << endl;
-               return;
-       }
-
-       state.type = LED_TYPE_BLINK;
-       state.color = 0xFFFFFF;
-       state.duty_on = 500;
-       state.duty_off = 500;
-       ret = rgb_dev->set_state(&state);
-       EXPECT_GE(ret, 0) << "Fail to set_state (" << ret << ")";
-}
-
-TEST_F(RGBHalTest, DeinitP)
-{
-       int ret;
-
-       if (!supported)
-               return;
-
-       if (!info->close) {
-               cout << "There is no function for info close" << endl;
-               return;
-       }
-       ret = info->close((struct hw_common *)rgb_dev);
-       EXPECT_GE(ret, 0) << "Fail to close rgb device (" << ret << ")";
-}
-
-int main(int argc, char **argv)
-{
-       testing::InitGoogleTest(&argc, argv);
-
-       return RUN_ALL_TESTS();
-}
diff --git a/unittest/gtest_hal_thermal.cpp b/unittest/gtest_hal_thermal.cpp
deleted file mode 100755 (executable)
index 9d0838b..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-
-#include <iostream>
-#include <gtest/gtest.h>
-#include <system_info.h>
-#include "hw/thermal.h"
-#include "unittest.h"
-
-using namespace std;
-
-/*
- * main class
- */
-struct hw_info *info;
-struct thermal_device *thermal_dev;
-
-class THERMALHalTest : public testing::Test
-{
-       public:
-               virtual void SetUp()
-               {
-
-               }
-
-               virtual void TearDown()
-               {
-
-               }
-};
-
-/*
- * testcase
- */
-TEST_F(THERMALHalTest, InitP)
-{
-       int ret;
-
-       ret = hw_get_info(THERMAL_HARDWARE_DEVICE_ID,
-                       (const struct hw_info **)&info);
-       if (ret < 0) {
-               cout << "There is no device for thermal" << ret << endl;
-               return;
-       } else {
-               EXPECT_EQ(ret, 0) << "Fail to get hal for thermal (" << ret << ")";
-       }
-
-       if (!info || !info->open) {
-               cout << "There is no function for info open" << endl;
-               return;
-       }
-       ret = info->open(info, NULL, (struct hw_common**)&thermal_dev);
-       EXPECT_EQ(ret, 0) << "Fail to open thermal device (" << ret << ")";
-}
-
-TEST_F(THERMALHalTest, GetStateP)
-{
-       struct thermal_info thermal;
-       int ret;
-
-       if (!thermal_dev || !thermal_dev->get_state) {
-               cout << "There is no function for get_state" << endl;
-               return;
-       }
-       ret = thermal_dev->get_state(&thermal);
-       EXPECT_EQ(ret, 0) << "Fail to get_state (" << ret << ")";
-}
-
-static void updated_cb(struct thermal_info *info, void *data)
-{
-
-}
-
-TEST_F(THERMALHalTest, RegisterChangedEventP)
-{
-       int ret;
-
-       if (!thermal_dev || !thermal_dev->register_changed_event) {
-               cout << "There is no function for register_changed_event" << endl;
-               return;
-       }
-       ret = thermal_dev->register_changed_event(updated_cb, NULL);
-       EXPECT_EQ(ret, 0) << "Fail to register_changed_event (" << ret << ")";
-}
-
-TEST_F(THERMALHalTest, UnregisterChangedEventP)
-{
-       if (!thermal_dev || !thermal_dev->unregister_changed_event) {
-               cout << "There is no function for unregister_changed_event" << endl;
-               return;
-       }
-       thermal_dev->unregister_changed_event(updated_cb);
-}
-
-TEST_F(THERMALHalTest, DeinitP)
-{
-       int ret;
-
-       if (!info || !info->close) {
-               cout << "There is no function for info close" << endl;
-               return;
-       }
-       ret = info->close((struct hw_common *)thermal_dev);
-       EXPECT_EQ(ret, 0) << "Fail to close thermal device (" << ret << ")";
-}
-
-int main(int argc, char **argv)
-{
-       testing::InitGoogleTest(&argc, argv);
-
-       return RUN_ALL_TESTS();
-}
diff --git a/unittest/gtest_hal_touchscreen.cpp b/unittest/gtest_hal_touchscreen.cpp
deleted file mode 100755 (executable)
index 046cef8..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-
-#include <iostream>
-#include <gtest/gtest.h>
-#include "hw/common.h"
-#include "hw/touchscreen.h"
-
-using namespace std;
-
-/*
- * main class
- */
-struct hw_info *info;
-struct touchscreen_device *touchscreen_dev;
-
-class TOUCHSCREENHalTest : public testing::Test
-{
-       public:
-               virtual void SetUp()
-               {
-
-               }
-
-               virtual void TearDown()
-               {
-
-               }
-};
-
-/*
- * testcase
- */
-TEST_F(TOUCHSCREENHalTest, InitP)
-{
-       int ret;
-
-       ret = hw_get_info(TOUCHSCREEN_HARDWARE_DEVICE_ID,
-                       (const struct hw_info **)&info);
-       if (ret < 0) {
-               cout << "There is no device for touchscreen" << ret << endl;
-               return;
-       } else {
-               EXPECT_EQ(ret, 0) << "Fail to get hal for touchscreen (" << ret << ")";
-       }
-
-       if (!info || !info->open) {
-               cout << "There is no function for info open" << endl;
-               return;
-       }
-       ret = info->open(info, NULL, (struct hw_common**)&touchscreen_dev);
-       EXPECT_EQ(ret, 0) << "Fail to open touchscreen device (" << ret << ")";
-}
-
-TEST_F(TOUCHSCREENHalTest, SetstateP)
-{
-       enum touchscreen_state state = TOUCHSCREEN_ON;
-       int ret;
-
-       if (!touchscreen_dev || !touchscreen_dev->set_state) {
-               cout << "There is no function for set_state" << endl;
-               return;
-       }
-       ret = touchscreen_dev->set_state(state);
-       EXPECT_EQ(ret, 0) << "Fail to set_state (" << ret << ")";
-}
-
-TEST_F(TOUCHSCREENHalTest, DeinitP)
-{
-       int ret;
-
-       if (!info || !info->close) {
-               cout << "There is no function for info close" << endl;
-               return;
-       }
-       ret = info->close((struct hw_common *)touchscreen_dev);
-       EXPECT_EQ(ret, 0) << "Fail to close touchscreen device (" << ret << ")";
-}
-
-int main(int argc, char **argv)
-{
-       testing::InitGoogleTest(&argc, argv);
-
-       return RUN_ALL_TESTS();
-}
diff --git a/unittest/gtest_hal_usb_client.cpp b/unittest/gtest_hal_usb_client.cpp
deleted file mode 100755 (executable)
index 597823c..0000000
+++ /dev/null
@@ -1,236 +0,0 @@
-
-#include <iostream>
-#include <gtest/gtest.h>
-#include <system_info.h>
-#include "hw/usb_client.h"
-#include "unittest.h"
-
-using namespace std;
-
-/*
- * main class
- */
-struct hw_info *info;
-struct usb_client *client_dev;
-struct usb_gadget *gadget_dev;
-struct usb_gadget_id gadget_id;
-struct usb_gadget_translator *gadget_translator;
-static bool need_modelcheck = true;
-
-#define MODEL_NAME      "http://tizen.org/system/model_name"
-
-class USBCLIENTHalTest : public testing::Test
-{
-       public:
-               virtual void SetUp()
-               {
-                       int ret;
-                       char *model_name = NULL;
-
-                       if (need_modelcheck) {
-                               ret = system_info_get_platform_string(MODEL_NAME, &model_name);
-                               EXPECT_EQ(SYSTEM_INFO_ERROR_NONE, ret) << "system_info_get_platform_bool failed";
-
-                               if (!strncmp(model_name, "artik", 5)) {
-                                       supported = true;
-                               } else {
-                                       supported = false;
-                               }
-                               cout << "supported " << supported << endl;
-                               need_modelcheck = false;
-                               free(model_name);
-                       }
-               }
-
-               virtual void TearDown()
-               {
-
-               }
-};
-
-/*
- * testcase
- */
-TEST_F(USBCLIENTHalTest, InitP)
-{
-       int ret;
-
-       if (!supported)
-               return;
-
-       ret = hw_get_info(USB_CLIENT_HARDWARE_DEVICE_ID,
-                       (const struct hw_info **)&info);
-       if (ret < 0) {
-               cout << "There is no device for usb client" << ret << endl;
-               return;
-       } else {
-               EXPECT_EQ(ret, 0) << "Fail to get hal for usb client (" << ret << ")";
-       }
-       if (!info || !info->open) {
-               cout << "There is no function for info open" << endl;
-               return;
-       }
-       ret = info->open(info, NULL, (struct hw_common**)&client_dev);
-       EXPECT_EQ(ret, 0) << "Fail to open usb client device (" << ret << ")";
-       EXPECT_NE(client_dev, nullptr) << "Fail to get usb client device structure";
-
-       ret = hw_get_info(USB_GADGET_DEVICE_ID,
-                       (const struct hw_info **)&info);
-       if (ret < 0) {
-               cout << "There is no device for usb gadget" << ret << endl;
-               return;
-       } else {
-               EXPECT_EQ(ret, 0) << "Fail to get hal for usb gadget (" << ret << ")";
-       }
-
-       if (!info || !info->open) {
-               cout << "There is no function for info open" << endl;
-               return;
-       }
-       ret = info->open(info, NULL, (struct hw_common**)&gadget_translator);
-       EXPECT_EQ(ret, 0) << "Fail to open usb gadget device (" << ret << ")";
-}
-
-TEST_F(USBCLIENTHalTest, EnableP)
-{
-       int ret;
-       char str[256];
-
-       if (!supported)
-               return;
-
-       //dummy code to prevent error for not used function
-       snprintf(str, 255, "%s,", _available_funcs[2]->name);
-
-       if (!client_dev || !client_dev->enable) {
-               cout << "There is no function for enable" << endl;
-               return;
-       }
-       ret = client_dev->enable(client_dev);
-       EXPECT_EQ(ret, 0) << "Fail to enable (" << ret << ")";
-}
-
-TEST_F(USBCLIENTHalTest, ReConfigureGadgetP)
-{
-       int ret;
-
-       if (!supported)
-               return;
-
-       if (!gadget_translator || !gadget_translator->id_to_gadget) {
-               cout << "There is no function for id_to_gadget" << endl;
-               return;
-       }
-       gadget_id.function_mask = 7;
-       ret = gadget_translator->id_to_gadget(&gadget_id, &gadget_dev);
-       EXPECT_EQ(ret, 0) << "Fail to id_to_gadget (" << ret << ")";
-
-       if (!client_dev || !client_dev->disable) {
-               cout << "There is no function for disable" << endl;
-               return;
-       }
-       ret = client_dev->disable(client_dev);
-       EXPECT_EQ(ret, 0) << "Fail to disable (" << ret << ")";
-
-       if (!client_dev || !client_dev->reconfigure_gadget) {
-               cout << "There is no function for reconfigure_gadget" << endl;
-               return;
-       }
-       ret = client_dev->reconfigure_gadget(client_dev, gadget_dev);
-       EXPECT_EQ(ret, 0) << "Fail to reconfigure_gadget (" << ret << ")";
-}
-
-TEST_F(USBCLIENTHalTest, IsGadgetSupportedP)
-{
-       bool flag;
-
-       if (!supported)
-               return;
-
-       if (!client_dev || !client_dev->is_gadget_supported) {
-               cout << "There is no function for is_gadget_supported" << endl;
-               return;
-       }
-       flag = client_dev->is_gadget_supported(client_dev, gadget_dev);
-       EXPECT_EQ(flag, true) << "Fail to is_gadget_supported (" << flag << ")";
-}
-
-TEST_F(USBCLIENTHalTest, IsFunctionSupportedP)
-{
-       bool flag;
-
-       if (!supported)
-               return;
-
-       if (!client_dev || !client_dev->is_function_supported) {
-               cout << "There is no function for is_function_supported" << endl;
-               return;
-       }
-       flag = client_dev->is_function_supported(client_dev, *gadget_dev->funcs);
-       EXPECT_EQ(flag, true) << "Fail to is_function_supported (" << flag << ")";
-}
-
-TEST_F(USBCLIENTHalTest, GetCurrentGadgetP)
-{
-       int ret;
-
-       if (!supported)
-               return;
-
-       if (!client_dev || !client_dev->get_current_gadget) {
-               cout << "There is no function for get_current_gadget" << endl;
-               return;
-       }
-       ret = client_dev->get_current_gadget(client_dev, &gadget_dev);
-       EXPECT_EQ(ret, 0) << "Fail to get_current_gadget (" << ret << ")";
-}
-
-TEST_F(USBCLIENTHalTest, DisableP)
-{
-       int ret;
-
-       if (!supported)
-               return;
-
-       if (!client_dev || !client_dev->disable) {
-               cout << "There is no function for disable" << endl;
-               return;
-       }
-       ret = client_dev->disable(client_dev);
-       EXPECT_EQ(ret, 0) << "Fail to disable (" << ret << ")";
-}
-
-TEST_F(USBCLIENTHalTest, FreeGadgetP)
-{
-       if (!supported)
-               return;
-
-       if (!client_dev || !client_dev->free_gadget) {
-               cout << "There is no function for free_gadget" << endl;
-               return;
-       }
-       client_dev->free_gadget(gadget_dev);
-}
-
-TEST_F(USBCLIENTHalTest, DeinitP)
-{
-       int ret;
-
-       if (!supported)
-               return;
-
-       if (!info || !info->close) {
-               cout << "There is no function for info close" << endl;
-               return;
-       }
-       ret = info->close((struct hw_common *)client_dev);
-       EXPECT_EQ(ret, 0) << "Fail to close usb client device (" << ret << ")";
-}
-
-int main(int argc, char **argv)
-{
-       testing::InitGoogleTest(&argc, argv);
-
-       return RUN_ALL_TESTS();
-}
-
diff --git a/unittest/gtest_hal_usb_gadget.cpp b/unittest/gtest_hal_usb_gadget.cpp
deleted file mode 100755 (executable)
index 4b567c2..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-
-#include <iostream>
-#include <gtest/gtest.h>
-#include <system_info.h>
-#include "hw/usb_gadget.h"
-#include "unittest.h"
-
-using namespace std;
-
-/*
- * main class
- */
-struct hw_info *info;
-struct usb_gadget *gadget_dev;
-struct usb_gadget_translator *gadget_translator;
-
-class USBGADGETHalTest : public testing::Test
-{
-       public:
-               virtual void SetUp()
-               {
-
-               }
-
-               virtual void TearDown()
-               {
-
-               }
-};
-
-/*
- * testcase
- */
-TEST_F(USBGADGETHalTest, InitP)
-{
-       int ret;
-
-       ret = hw_get_info(USB_GADGET_DEVICE_ID,
-                       (const struct hw_info **)&info);
-       if (ret < 0) {
-               cout << "There is no device for usb gadget" << ret << endl;
-               return;
-       } else {
-               EXPECT_EQ(ret, 0) << "Fail to get hal for usb gadget (" << ret << ")";
-       }
-
-       if (!info || !info->open) {
-               cout << "There is no function for info open" << endl;
-               return;
-       }
-       ret = info->open(info, NULL, (struct hw_common**)&gadget_translator);
-       EXPECT_EQ(ret, 0) << "Fail to open usb gadget device (" << ret << ")";
-}
-
-TEST_F(USBGADGETHalTest, IdToGadget)
-{
-       struct usb_gadget_id gadget_id;
-       int ret;
-       char str[256];
-
-       if (!gadget_translator || !gadget_translator->id_to_gadget) {
-               cout << "There is no function for id_to_gadget" << endl;
-               return;
-       }
-       //dummy code to prevent error for not used function
-       snprintf(str, 255, "%s,", _available_funcs[2]->name);
-       gadget_id.function_mask = 7;
-       ret = gadget_translator->id_to_gadget(&gadget_id, &gadget_dev);
-       EXPECT_EQ(ret, 0) << "Fail to id_to_gadget (" << ret << ")";
-}
-
-TEST_F(USBGADGETHalTest, CleanUpGadget)
-{
-       if (!gadget_translator || !gadget_translator->cleanup_gadget) {
-               cout << "There is no function for cleanup_gadget" << endl;
-               return;
-       }
-       gadget_translator->cleanup_gadget(gadget_dev);
-}
-
-TEST_F(USBGADGETHalTest, DeinitP)
-{
-       int ret;
-
-       if (!info || !info->close) {
-               cout << "There is no function for info close" << endl;
-               return;
-       }
-       ret = info->close((struct hw_common *)gadget_translator);
-       EXPECT_EQ(ret, 0) << "Fail to close usb gadget device (" << ret << ")";
-}
-
-int main(int argc, char **argv)
-{
-       testing::InitGoogleTest(&argc, argv);
-
-       return RUN_ALL_TESTS();
-}