summaryrefslogtreecommitdiff
path: root/test/motion_lid.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/motion_lid.c')
-rw-r--r--test/motion_lid.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/motion_lid.c b/test/motion_lid.c
index d25de9e3fe..45d14189bb 100644
--- a/test/motion_lid.c
+++ b/test/motion_lid.c
@@ -21,6 +21,7 @@
#include "util.h"
extern enum chipset_state_mask sensor_active;
+extern int wait_us;
/*
* Period in us for the motion task period.
@@ -182,6 +183,9 @@ static int test_lid_angle(void)
hook_notify(HOOK_CHIPSET_SHUTDOWN);
TEST_ASSERT(sensor_active == SENSOR_ACTIVE_S5);
TEST_ASSERT(accel_get_data_rate(lid) == 0);
+ TEST_ASSERT(base->collection_rate == 0);
+ TEST_ASSERT(lid->collection_rate == 0);
+ TEST_ASSERT(wait_us == -1);
/* Go to S0 state */
hook_notify(HOOK_CHIPSET_SUSPEND);
@@ -189,6 +193,9 @@ static int test_lid_angle(void)
msleep(1000);
TEST_ASSERT(sensor_active == SENSOR_ACTIVE_S0);
TEST_ASSERT(accel_get_data_rate(lid) == 119000);
+ TEST_ASSERT(base->collection_rate != 0);
+ TEST_ASSERT(lid->collection_rate != 0);
+ TEST_ASSERT(wait_us > 0);
/*
* Set the base accelerometer as if it were sitting flat on a desk
@@ -328,6 +335,15 @@ static int test_lid_angle(void)
wait_for_valid_sample();
TEST_ASSERT(motion_lid_get_angle() == 10);
+ hook_notify(HOOK_CHIPSET_SHUTDOWN);
+ msleep(1000);
+ TEST_ASSERT(sensor_active == SENSOR_ACTIVE_S5);
+ /* Base ODR is 0, collection rate is 0. */
+ TEST_ASSERT(base->collection_rate == 0);
+ /* Lid is powered off, collection rate is 0. */
+ TEST_ASSERT(lid->collection_rate == 0);
+ TEST_ASSERT(wait_us == -1);
+
return EC_SUCCESS;
}