summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJett Rink <jettrink@chromium.org>2020-02-05 10:16:10 -0700
committerCommit Bot <commit-bot@chromium.org>2020-02-05 20:29:07 +0000
commit678b6f1237a83b642de2356a20eee55da85ae38b (patch)
treee90dd990b4cd74e656eca577dceefb830a549b0e /include
parent1f3f4e74576669a1c791cbb1d45bbd3a410a085d (diff)
downloadchrome-ec-678b6f1237a83b642de2356a20eee55da85ae38b.tar.gz
test: move mock header files
Move header files for mocks into the include/mocks folder. These header files aren't just private to the common/mock implementation as the test/ files also need access to these defines. BRANCH=none BUG=none TEST=buildall Change-Id: I25d03d194ab46b7665f54175979577aa90af814f Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2039038 Commit-Queue: Craig Hesling <hesling@chromium.org> Reviewed-by: Craig Hesling <hesling@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/mock/tcpc_mock.h25
-rw-r--r--include/mock/usb_mux_mock.h19
2 files changed, 44 insertions, 0 deletions
diff --git a/include/mock/tcpc_mock.h b/include/mock/tcpc_mock.h
new file mode 100644
index 0000000000..0cea10412a
--- /dev/null
+++ b/include/mock/tcpc_mock.h
@@ -0,0 +1,25 @@
+/* Copyright 2019 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.
+ */
+ /* Mock for the TCPC interface */
+
+#include "usb_pd_tcpm.h"
+#include "usb_pd.h"
+
+/* Controller for TCPC state */
+struct mock_tcpc_ctrl {
+ enum tcpc_cc_voltage_status cc1;
+ enum tcpc_cc_voltage_status cc2;
+ int vbus_level;
+ enum pd_power_role power_role;
+ enum pd_data_role data_role;
+ int num_calls_to_set_header;
+ int should_print_header_changes;
+};
+
+/* Reset this TCPC mock */
+void mock_tcpc_reset(void);
+
+extern const struct tcpm_drv mock_tcpc_driver;
+extern struct mock_tcpc_ctrl mock_tcpc;
diff --git a/include/mock/usb_mux_mock.h b/include/mock/usb_mux_mock.h
new file mode 100644
index 0000000000..128286796b
--- /dev/null
+++ b/include/mock/usb_mux_mock.h
@@ -0,0 +1,19 @@
+/* Copyright 2019 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.
+ */
+/* Mock USB Type-C mux */
+
+#include "usb_mux.h"
+
+/* Controller for mux state */
+struct mock_usb_mux_ctrl {
+ mux_state_t state;
+ int num_set_calls;
+};
+
+/* Resets the state of the mock */
+void mock_usb_mux_reset(void);
+
+extern const struct usb_mux_driver mock_usb_mux_driver;
+extern struct mock_usb_mux_ctrl mock_usb_mux;