summaryrefslogtreecommitdiff
path: root/zephyr/test/drivers/default/src/usb_pd_host_cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr/test/drivers/default/src/usb_pd_host_cmd.c')
-rw-r--r--zephyr/test/drivers/default/src/usb_pd_host_cmd.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/zephyr/test/drivers/default/src/usb_pd_host_cmd.c b/zephyr/test/drivers/default/src/usb_pd_host_cmd.c
new file mode 100644
index 0000000000..bd421e7537
--- /dev/null
+++ b/zephyr/test/drivers/default/src/usb_pd_host_cmd.c
@@ -0,0 +1,26 @@
+/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <zephyr/zephyr.h>
+#include <ztest.h>
+
+#include "ec_commands.h"
+#include "host_command.h"
+#include "test/drivers/test_state.h"
+
+ZTEST_USER(usb_pd_host_cmd, test_host_command_hc_pd_ports)
+{
+ struct ec_response_usb_pd_ports response;
+ struct host_cmd_handler_args args =
+ BUILD_HOST_COMMAND_RESPONSE(EC_CMD_USB_PD_PORTS, 0, response);
+
+ zassert_ok(host_command_process(&args), NULL);
+ zassert_ok(args.result, NULL);
+ zassert_equal(args.response_size, sizeof(response), NULL);
+ zassert_equal(response.num_ports, CONFIG_USB_PD_PORT_MAX_COUNT, NULL);
+}
+
+ZTEST_SUITE(usb_pd_host_cmd, drivers_predicate_post_main, NULL, NULL, NULL,
+ NULL);