1 // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef LIBBRILLO_BRILLO_PROCESS_MOCK_H_ 6 #define LIBBRILLO_BRILLO_PROCESS_MOCK_H_ 7 8 #include <string> 9 10 #include <gmock/gmock.h> 11 12 #include "brillo/process.h" 13 14 namespace brillo { 15 16 class ProcessMock : public Process { 17 public: ProcessMock()18 ProcessMock() {} ~ProcessMock()19 virtual ~ProcessMock() {} 20 21 MOCK_METHOD1(AddArg, void(const std::string& arg)); 22 MOCK_METHOD1(RedirectOutput, void(const std::string& output_file)); 23 MOCK_METHOD2(RedirectUsingPipe, void(int child_fd, bool is_input)); 24 MOCK_METHOD2(BindFd, void(int parent_fd, int child_fd)); 25 MOCK_METHOD1(SetUid, void(uid_t)); 26 MOCK_METHOD1(SetGid, void(gid_t)); 27 MOCK_METHOD1(SetCapabilities, void(uint64_t capmask)); 28 MOCK_METHOD1(ApplySyscallFilter, void(const std::string& path)); 29 MOCK_METHOD0(EnterNewPidNamespace, void()); 30 MOCK_METHOD1(SetInheritParentSignalMask, void(bool)); 31 MOCK_METHOD1(SetPreExecCallback, void(const PreExecCallback&)); 32 MOCK_METHOD1(SetSearchPath, void(bool)); 33 MOCK_METHOD1(GetPipe, int(int child_fd)); 34 MOCK_METHOD0(Start, bool()); 35 MOCK_METHOD0(Wait, int()); 36 MOCK_METHOD0(Run, int()); 37 MOCK_METHOD0(pid, pid_t()); 38 MOCK_METHOD2(Kill, bool(int signal, int timeout)); 39 MOCK_METHOD1(Reset, void(pid_t)); 40 MOCK_METHOD1(ResetPidByFile, bool(const std::string& pid_file)); 41 MOCK_METHOD0(Release, pid_t()); 42 MOCK_METHOD1(SetCloseUnusedFileDescriptors, void(bool close_unused_fds)); 43 }; 44 45 } // namespace brillo 46 47 #endif // LIBBRILLO_BRILLO_PROCESS_MOCK_H_ 48