diff options
author | Vic Yang <victoryang@chromium.org> | 2013-06-16 21:36:16 +0800 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-06-17 20:27:27 -0700 |
commit | 7de03b0f0eba113681a8b41971b4c17dd04bf8fd (patch) | |
tree | 26586f92133d099eb48a766897b6ab186c216b56 /common/test_util.c | |
parent | b93658ba02cf381e2a0e20c4d7128814d685e502 (diff) | |
download | chrome-ec-7de03b0f0eba113681a8b41971b4c17dd04bf8fd.tar.gz |
A method to mock host command
This will be used often, so let's move it to test_util.c.
BUG=chrome-os-partner:19235
TEST=Pass flash test.
BRANCH=None
Change-Id: I2f685f657f8742c2b29e3b9c88ba01daacf982f8
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/58793
Diffstat (limited to 'common/test_util.c')
-rw-r--r-- | common/test_util.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/common/test_util.c b/common/test_util.c index b9b6a7a13f..c133ac9d24 100644 --- a/common/test_util.c +++ b/common/test_util.c @@ -9,6 +9,7 @@ #include <stdlib.h> #include "console.h" +#include "host_command.h" #include "test_util.h" #include "util.h" @@ -64,6 +65,24 @@ int test_get_error_count(void) return __test_error_count; } +#ifdef HAS_TASK_HOSTCMD +int test_send_host_command(int command, int version, const void *params, + int params_size, void *resp, int resp_size) +{ + struct host_cmd_handler_args args; + + args.version = version; + args.command = command; + args.params = params; + args.params_size = params_size; + args.response = resp; + args.response_max = resp_size; + args.response_size = 0; + + return host_command_process(&args); +} +#endif /* TASK_HAS_HOSTCMD */ + static int command_run_test(int argc, char **argv) { run_test(); |