mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
Add test for keyboard disabling when lid closed
BUG=chrome-os-partner:17653 TEST=Run on Spring BRANCH=none Change-Id: Ib01f6f4cac3b0ef3039bb1e1daf3dd9c6c8e44c4 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/48895
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "console.h"
|
||||
#include "gpio.h"
|
||||
#include "keyboard_raw.h"
|
||||
#include "keyboard_scan.h"
|
||||
#include "task.h"
|
||||
@@ -49,6 +50,14 @@ static uint8_t mock_state[KEYBOARD_COLS];
|
||||
static int column_driven;
|
||||
static int fifo_add_count;
|
||||
static int error_count;
|
||||
static int lid_open;
|
||||
|
||||
int gpio_get_level(enum gpio_signal signal)
|
||||
{
|
||||
if (signal == GPIO_LID_OPEN)
|
||||
return lid_open;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void keyboard_raw_drive_column(int out)
|
||||
{
|
||||
@@ -227,12 +236,31 @@ int debounce_test(void)
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
|
||||
int lid_test(void)
|
||||
{
|
||||
lid_open = 0;
|
||||
mock_key(1, 1, 1);
|
||||
TEST_ASSERT(expect_no_keychange);
|
||||
mock_key(1, 1, 0);
|
||||
TEST_ASSERT(expect_no_keychange);
|
||||
|
||||
lid_open = 1;
|
||||
mock_key(1, 1, 1);
|
||||
TEST_ASSERT(expect_keychange);
|
||||
mock_key(1, 1, 0);
|
||||
TEST_ASSERT(expect_keychange);
|
||||
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
|
||||
static int command_run_test(int argc, char **argv)
|
||||
{
|
||||
error_count = 0;
|
||||
lid_open = 1;
|
||||
|
||||
RUN_TEST(deghost_test);
|
||||
RUN_TEST(debounce_test);
|
||||
RUN_TEST(lid_test);
|
||||
|
||||
if (error_count == 0) {
|
||||
ccprintf("Pass!\n");
|
||||
|
||||
Reference in New Issue
Block a user