refractor hub api
fix all test build errors
This commit is contained in:
@@ -61,11 +61,11 @@
|
||||
//------------- hidh -------------//
|
||||
void tusbh_hid_keyboard_isr(uint8_t dev_addr, tusb_event_t event);
|
||||
void tusbh_hid_keyboard_mounted_cb(uint8_t dev_addr);
|
||||
void tusbh_hid_keyboard_unmounted_isr(uint8_t dev_addr);
|
||||
void tusbh_hid_keyboard_unmounted_cb(uint8_t dev_addr);
|
||||
|
||||
void tusbh_hid_mouse_isr(uint8_t dev_addr, tusb_event_t event);
|
||||
void tusbh_hid_mouse_mounted_cb(uint8_t dev_addr);
|
||||
void tusbh_hid_mouse_unmounted_isr(uint8_t dev_addr);
|
||||
void tusbh_hid_mouse_unmounted_cb(uint8_t dev_addr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ void test_hidh_close(void)
|
||||
keyboardh_data[dev_addr-1].report_size = 8;
|
||||
|
||||
hcd_pipe_close_ExpectAndReturn(pipe_hdl, TUSB_ERROR_NONE);
|
||||
tusbh_hid_keyboard_unmounted_isr_Expect(dev_addr);
|
||||
tusbh_hid_keyboard_unmounted_cb_Expect(dev_addr);
|
||||
|
||||
//------------- Code Under TEST -------------//
|
||||
hidh_close(dev_addr);
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include "mock_osal.h"
|
||||
#include "mock_cdc_host.h"
|
||||
#include "mock_msc_host.h"
|
||||
#include "mock_hub.h"
|
||||
|
||||
#include "mock_hcd.h"
|
||||
#include "usbh.h"
|
||||
|
||||
@@ -160,7 +160,7 @@ void test_keyboard_open_ok(void)
|
||||
|
||||
tusbh_device_get_state_IgnoreAndReturn(TUSB_DEVICE_STATE_CONFIGURED);
|
||||
TEST_ASSERT_TRUE( tusbh_hid_keyboard_is_mounted(dev_addr) );
|
||||
TEST_ASSERT_EQUAL(TUSB_INTERFACE_STATUS_READY, p_hidh_kbd->status);
|
||||
TEST_ASSERT_FALSE( tusbh_hid_keyboard_is_busy(dev_addr) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
@@ -196,7 +196,8 @@ void test_keyboard_get_report_xfer_failed()
|
||||
void test_keyboard_get_report_xfer_failed_busy()
|
||||
{
|
||||
tusbh_device_get_state_IgnoreAndReturn(TUSB_DEVICE_STATE_CONFIGURED);
|
||||
p_hidh_kbd->status = TUSB_INTERFACE_STATUS_BUSY;
|
||||
hcd_pipe_is_busy_ExpectAndReturn(p_hidh_kbd->pipe_hdl, true);
|
||||
|
||||
TEST_ASSERT_EQUAL(TUSB_ERROR_INTERFACE_IS_BUSY, tusbh_hid_keyboard_get_report(dev_addr, &report));
|
||||
}
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ void test_mouse_open_ok(void)
|
||||
|
||||
tusbh_device_get_state_IgnoreAndReturn(TUSB_DEVICE_STATE_CONFIGURED);
|
||||
TEST_ASSERT_TRUE( tusbh_hid_mouse_is_mounted(dev_addr) );
|
||||
TEST_ASSERT_EQUAL(TUSB_INTERFACE_STATUS_READY, p_hidh_mouse->status);
|
||||
TEST_ASSERT_FALSE( tusbh_hid_mouse_is_busy(dev_addr) );
|
||||
|
||||
}
|
||||
|
||||
@@ -168,7 +168,8 @@ void test_mouse_get_report_xfer_failed()
|
||||
void test_mouse_get_report_xfer_failed_busy()
|
||||
{
|
||||
tusbh_device_get_state_IgnoreAndReturn(TUSB_DEVICE_STATE_CONFIGURED);
|
||||
p_hidh_mouse->status = TUSB_INTERFACE_STATUS_BUSY;
|
||||
hcd_pipe_is_busy_ExpectAndReturn(p_hidh_mouse->pipe_hdl, true);
|
||||
|
||||
TEST_ASSERT_EQUAL(TUSB_ERROR_INTERFACE_IS_BUSY, tusbh_hid_mouse_get_report(dev_addr, &report));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user