#include "hw/usb_gadget.h"
#include "hw/bezel.h"
#include "hw/touchsensitivity.h"
+#include "hw/board.h"
using namespace std;
#define LOWBATTERY "LowBattery"
struct hw_info *info;
+struct hw_board *board_dev;
struct battery_device *battery_dev;
struct cpu_device *cpu_dev;
struct display_device *display_dev;
}
};
+class BOARDHalTest : public testing::Test
+{
+ public:
+ virtual void SetUp()
+ {
+
+ }
+
+ virtual void TearDown()
+ {
+
+ }
+};
+
class BEZELHalTest : public testing::Test
{
public:
}
/*
+ * Testcase for Board
+ */
+TEST_F(BOARDHalTest, InitP)
+{
+ int ret;
+
+ info = NULL;
+ ret = hw_get_info(BOARD_HARDWARE_DEVICE_ID,
+ (const struct hw_info **)&info);
+ if (ret < 0) {
+ cout << "There is no device for board " << ret << endl;
+ return;
+ } else {
+ EXPECT_EQ(ret, 0) << "Fail to get hal for board (" << ret << ")";
+ }
+
+ if (!info || !info->open) {
+ cout << "There is no function for info open" << endl;
+ return;
+ }
+ ret = info->open(info, NULL, (struct hw_common**)&board_dev);
+ EXPECT_EQ(ret, 0) << "Fail to open board device (" << ret << ")";
+}
+
+TEST_F(BOARDHalTest, GetDeviceSerialP)
+{
+ int ret;
+ char *serial;
+
+ if (!board_dev || !board_dev->get_device_serial) {
+ cout << "There is no function for get_device_serial" << endl;
+ return;
+ }
+ ret = board_dev->get_device_serial(&serial);
+ EXPECT_EQ(ret, 0) << "Fail to get device serial (" << ret << ")";
+}
+
+TEST_F(BOARDHalTest, GetDeviceRevisionP)
+{
+ int ret, revision;
+
+ if (!board_dev || !board_dev->get_device_revision) {
+ cout << "There is no function for get_device_revision" << endl;
+ return;
+ }
+ ret = board_dev->get_device_revision(&revision);
+ EXPECT_EQ(ret, 0) << "Fail to get device revision (" << ret << ")";
+}
+
+TEST_F(BOARDHalTest, DeinitP)
+{
+ int ret;
+
+ if (!info || !info->close) {
+ cout << "There is no function for info close" << endl;
+ return;
+ }
+ ret = info->close((struct hw_common *)board_dev);
+ EXPECT_EQ(ret, 0) << "Fail to close board device (" << ret << ")";
+}
+
+/*
* Testcase for Bezel
*/
TEST_F(BEZELHalTest, InitP)