summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDoug Anderson <dianders@chromium.org>2013-12-05 15:44:43 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-12-10 03:26:43 +0000
commit1d24f4d661473223fd5eaf60a62ec0f1068d58f2 (patch)
tree285fa05df6755c7f304637187ccd0ee848bcd74c /test
parent9f40f11fe815f2b8034d1863a35c0ba1854bdcba (diff)
downloadchrome-ec-1d24f4d661473223fd5eaf60a62ec0f1068d58f2.tar.gz
keyboard: Improve kbpress reliability for automation
The "kbpress" command had a few issues if you wanted to reliably use it for automation. Specifically it was not possible to guarantee how much time would pass between the press of a key and the release of a key. Sometimes you might press and release before the key was officially "there" and sometimes you might get a press and hold of a key. Fix this: 1. Make it so that kbpress with no press/release parameter gives a press and release (and guarantees that the press / release will actually take effect). 2. Make it so that kbpress guarantees that when it finishes that the key has actually been pressed or released. BRANCH=pit BUG=chrome-os-partner:24249 TEST=kbtype is (https://chromium-review.googlesource.com/178680) reliable TEST=make -j32 BOARD=bds tests && make BOARD=bds runtests TEST=Pick Ibe00a796bde7d06416889b621359671a2f68e162 and test. Change-Id: Ia213ab2e8d8da273e3ac4876d97d5452df88f47d Signed-off-by: Doug Anderson <dianders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/178983 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit 247650ecc90385417f5dcb2d60bb6ae1e5cfa32f) Reviewed-on: https://chromium-review.googlesource.com/179325 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/kb_scan.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/kb_scan.c b/test/kb_scan.c
index a273a20466..e0e73d17f5 100644
--- a/test/kb_scan.c
+++ b/test/kb_scan.c
@@ -253,10 +253,14 @@ static int debounce_test(void)
static int simulate_key_test(void)
{
+ int old_count;
+
+ old_count = fifo_add_count;
host_command_simulate(1, 1, 1);
- TEST_ASSERT(expect_keychange() == EC_SUCCESS);
+ TEST_ASSERT(fifo_add_count > old_count);
+ old_count = fifo_add_count;
host_command_simulate(1, 1, 0);
- TEST_ASSERT(expect_keychange() == EC_SUCCESS);
+ TEST_ASSERT(fifo_add_count > old_count);
return EC_SUCCESS;
}