• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /*
18  * Generated mock file from original source file
19  *   Functions generated:6
20  *
21  *  mockcify.pl ver 0.3.0
22  */
23 
24 #include <cstdint>
25 #include <functional>
26 #include <map>
27 #include <string>
28 
29 // Original included files, if any
30 // NOTE: Since this is a mock file with mock definitions some number of
31 //       include files may not be required.  The include-what-you-use
32 //       still applies, but crafting proper inclusion is out of scope
33 //       for this effort.  This compilation unit may compile as-is, or
34 //       may need attention to prune from (or add to ) the inclusion set.
35 #include <errno.h>
36 #include <fcntl.h>
37 #include <hardware/bluetooth.h>
38 #include <inttypes.h>
39 #include <limits.h>
40 #include <pthread.h>
41 #include <string.h>
42 #include <sys/stat.h>
43 #include <sys/types.h>
44 #include <time.h>
45 #include <unistd.h>
46 
47 #include <mutex>
48 #include <string>
49 
50 #include "base/logging.h"
51 #include "check.h"
52 #include "common/metrics.h"
53 #include "osi/include/alarm.h"
54 #include "osi/include/allocator.h"
55 #include "osi/include/log.h"
56 #include "osi/include/osi.h"
57 #include "osi/include/thread.h"
58 #include "osi/include/wakelock.h"
59 #include "test/common/mock_functions.h"
60 
61 // Mocked compile conditionals, if any
62 
63 namespace test {
64 namespace mock {
65 namespace osi_wakelock {
66 
67 // Shared state between mocked functions and tests
68 // Name: wakelock_acquire
69 // Params: void
70 // Return: bool
71 struct wakelock_acquire {
72   bool return_value{false};
73   std::function<bool(void)> body{[this](void) { return return_value; }};
operatorwakelock_acquire74   bool operator()(void) { return body(); };
75 };
76 extern struct wakelock_acquire wakelock_acquire;
77 
78 // Name: wakelock_cleanup
79 // Params: void
80 // Return: void
81 struct wakelock_cleanup {
82   std::function<void(void)> body{[](void) {}};
operatorwakelock_cleanup83   void operator()(void) { body(); };
84 };
85 extern struct wakelock_cleanup wakelock_cleanup;
86 
87 // Name: wakelock_debug_dump
88 // Params: int fd
89 // Return: void
90 struct wakelock_debug_dump {
91   std::function<void(int fd)> body{[](int fd) {}};
operatorwakelock_debug_dump92   void operator()(int fd) { body(fd); };
93 };
94 extern struct wakelock_debug_dump wakelock_debug_dump;
95 
96 // Name: wakelock_release
97 // Params: void
98 // Return: bool
99 struct wakelock_release {
100   bool return_value{false};
101   std::function<bool(void)> body{[this](void) { return return_value; }};
operatorwakelock_release102   bool operator()(void) { return body(); };
103 };
104 extern struct wakelock_release wakelock_release;
105 
106 // Name: wakelock_set_os_callouts
107 // Params: bt_os_callouts_t* callouts
108 // Return: void
109 struct wakelock_set_os_callouts {
110   std::function<void(bt_os_callouts_t* callouts)> body{
111       [](bt_os_callouts_t* callouts) {}};
operatorwakelock_set_os_callouts112   void operator()(bt_os_callouts_t* callouts) { body(callouts); };
113 };
114 extern struct wakelock_set_os_callouts wakelock_set_os_callouts;
115 
116 // Name: wakelock_set_paths
117 // Params: const char* lock_path, const char* unlock_path
118 // Return: void
119 struct wakelock_set_paths {
120   std::function<void(const char* lock_path, const char* unlock_path)> body{
121       [](const char* lock_path, const char* unlock_path) {}};
operatorwakelock_set_paths122   void operator()(const char* lock_path, const char* unlock_path) {
123     body(lock_path, unlock_path);
124   };
125 };
126 extern struct wakelock_set_paths wakelock_set_paths;
127 
128 }  // namespace osi_wakelock
129 }  // namespace mock
130 }  // namespace test
131 
132 // END mockcify generation