[OS Detection] Fix unit tests
This commit is contained in:
parent
cbb8b0de36
commit
cae37c241c
1 changed files with 8 additions and 8 deletions
|
@ -329,13 +329,13 @@ TEST_F(OsDetectionTest, TestReportAfterDebounce) {
|
||||||
EXPECT_EQ(detected_host_os(), OS_HANDHELD);
|
EXPECT_EQ(detected_host_os(), OS_HANDHELD);
|
||||||
// the task will cause a report
|
// the task will cause a report
|
||||||
os_detection_task();
|
os_detection_task();
|
||||||
assert_reported(OS_LINUX);
|
assert_reported(OS_HANDHELD);
|
||||||
EXPECT_EQ(detected_host_os(), OS_LINUX);
|
EXPECT_EQ(detected_host_os(), OS_HANDHELD);
|
||||||
|
|
||||||
// check that it remains the same after a long time
|
// check that it remains the same after a long time
|
||||||
advance_time(OS_DETECTION_DEBOUNCE * 15);
|
advance_time(OS_DETECTION_DEBOUNCE * 15);
|
||||||
assert_reported(OS_LINUX);
|
assert_reported(OS_HANDHELD);
|
||||||
EXPECT_EQ(detected_host_os(), OS_LINUX);
|
EXPECT_EQ(detected_host_os(), OS_HANDHELD);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(OsDetectionTest, TestReportAfterDebounceLongWait) {
|
TEST_F(OsDetectionTest, TestReportAfterDebounceLongWait) {
|
||||||
|
@ -404,13 +404,13 @@ TEST_F(OsDetectionTest, TestDoNotReportIntermediateResults) {
|
||||||
EXPECT_EQ(detected_host_os(), OS_UNSURE);
|
EXPECT_EQ(detected_host_os(), OS_UNSURE);
|
||||||
|
|
||||||
// at this stage, the final result has not been reached yet
|
// at this stage, the final result has not been reached yet
|
||||||
EXPECT_EQ(check_sequence({0xFF}), OS_LINUX);
|
EXPECT_EQ(check_sequence({0xFF}), OS_HANDHELD);
|
||||||
os_detection_notify_usb_device_state_change(usb_device_state_configured);
|
os_detection_notify_usb_device_state_change(usb_device_state_configured);
|
||||||
advance_time(OS_DETECTION_DEBOUNCE - 1);
|
advance_time(OS_DETECTION_DEBOUNCE - 1);
|
||||||
os_detection_task();
|
os_detection_task();
|
||||||
assert_not_reported();
|
assert_not_reported();
|
||||||
// the intermedite but yet unstable result is exposed through detected_host_os()
|
// the intermedite but yet unstable result is exposed through detected_host_os()
|
||||||
EXPECT_EQ(detected_host_os(), OS_LINUX);
|
EXPECT_EQ(detected_host_os(), OS_HANDHELD);
|
||||||
|
|
||||||
// the remainder is processed
|
// the remainder is processed
|
||||||
EXPECT_EQ(check_sequence({0x4, 0x10, 0xFF, 0xFF, 0xFF, 0x4, 0x10, 0x20A, 0x20A, 0x20A, 0x20A, 0x20A, 0x20A}), OS_WINDOWS);
|
EXPECT_EQ(check_sequence({0x4, 0x10, 0xFF, 0xFF, 0xFF, 0x4, 0x10, 0x20A, 0x20A, 0x20A, 0x20A, 0x20A, 0x20A}), OS_WINDOWS);
|
||||||
|
@ -438,8 +438,8 @@ TEST_F(OsDetectionTest, TestDoNotReportIntermediateResults) {
|
||||||
|
|
||||||
TEST_F(OsDetectionTest, TestDoNotGoBackToUnsure) {
|
TEST_F(OsDetectionTest, TestDoNotGoBackToUnsure) {
|
||||||
// 0x02 would cause it to go back to Unsure, so check that it does not
|
// 0x02 would cause it to go back to Unsure, so check that it does not
|
||||||
EXPECT_EQ(check_sequence({0xFF, 0xFF, 0xFF, 0xFE, 0x02}), OS_LINUX);
|
EXPECT_EQ(check_sequence({0xFF, 0xFF, 0xFF, 0xFE, 0x02}), OS_HANDHELD);
|
||||||
os_detection_task();
|
os_detection_task();
|
||||||
assert_not_reported();
|
assert_not_reported();
|
||||||
EXPECT_EQ(check_sequence({0x2, 0x4, 0x2, 0x28, 0x2, 0x24}), OS_PS5);
|
EXPECT_EQ(check_sequence({0x2, 0x4, 0x2, 0x28, 0x2, 0x24}), OS_WINDOWS);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue