summaryrefslogtreecommitdiff
path: root/zephyr/test/ap_power/src/test_mocks.c
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr/test/ap_power/src/test_mocks.c')
-rw-r--r--zephyr/test/ap_power/src/test_mocks.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/zephyr/test/ap_power/src/test_mocks.c b/zephyr/test/ap_power/src/test_mocks.c
new file mode 100644
index 0000000000..9eb8834ff5
--- /dev/null
+++ b/zephyr/test/ap_power/src/test_mocks.c
@@ -0,0 +1,30 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "test_mocks.h"
+
+#include <zephyr/fff.h>
+#include <zephyr/ztest.h>
+
+/* Mocks for common/extpower_gpio.c */
+DEFINE_FAKE_VALUE_FUNC(int, extpower_is_present);
+
+/* Mocks for common/system.c */
+DEFINE_FAKE_VOID_FUNC(system_hibernate, uint32_t, uint32_t);
+
+/**
+ * @brief Reset all the fakes before each test.
+ */
+static void fff_reset_rule_before(const struct ztest_unit_test *test,
+ void *data)
+{
+ ARG_UNUSED(test);
+ ARG_UNUSED(data);
+
+ RESET_FAKE(extpower_is_present);
+ RESET_FAKE(system_hibernate);
+}
+
+ZTEST_RULE(fff_reset_rule, fff_reset_rule_before, NULL);