summaryrefslogtreecommitdiff
path: root/unittest/gtest_hal_extcon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unittest/gtest_hal_extcon.cpp')
-rwxr-xr-xunittest/gtest_hal_extcon.cpp107
1 files changed, 0 insertions, 107 deletions
diff --git a/unittest/gtest_hal_extcon.cpp b/unittest/gtest_hal_extcon.cpp
deleted file mode 100755
index cfb8c0f..0000000
--- a/unittest/gtest_hal_extcon.cpp
+++ /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();
-}