From 678b6f1237a83b642de2356a20eee55da85ae38b Mon Sep 17 00:00:00 2001 From: Jett Rink Date: Wed, 5 Feb 2020 10:16:10 -0700 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2039038 Commit-Queue: Craig Hesling Reviewed-by: Craig Hesling --- include/mock/tcpc_mock.h | 25 +++++++++++++++++++++++++ include/mock/usb_mux_mock.h | 19 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 include/mock/tcpc_mock.h create mode 100644 include/mock/usb_mux_mock.h (limited to 'include') 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; -- cgit v1.2.1