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 <base/files/file_path.h> 11 #include <gmock/gmock.h> 12 13 #include "brillo/process.h" 14 15 namespace brillo { 16 17 class ProcessMock : public Process { 18 public: ProcessMock()19 ProcessMock() {} ~ProcessMock()20 virtual ~ProcessMock() {} 21 22 MOCK_METHOD1(AddArg, void(const std::string& arg)); 23 MOCK_METHOD1(RedirectInput, void(const std::string& input_file)); 24 MOCK_METHOD1(RedirectOutput, void(const std::string& output_file)); 25 MOCK_METHOD2(RedirectUsingPipe, void(int child_fd, bool is_input)); 26 MOCK_METHOD2(BindFd, void(int parent_fd, int child_fd)); 27 MOCK_METHOD1(SetUid, void(uid_t)); 28 MOCK_METHOD1(SetGid, void(gid_t)); 29 MOCK_METHOD1(SetCapabilities, void(uint64_t capmask)); 30 MOCK_METHOD1(ApplySyscallFilter, void(const std::string& path)); 31 MOCK_METHOD0(EnterNewPidNamespace, void()); 32 MOCK_METHOD1(SetInheritParentSignalMask, void(bool)); 33 MOCK_METHOD1(SetPreExecCallback, void(const PreExecCallback&)); 34 MOCK_METHOD1(SetSearchPath, void(bool)); 35 MOCK_METHOD1(GetPipe, int(int child_fd)); 36 MOCK_METHOD0(Start, bool()); 37 MOCK_METHOD0(Wait, int()); 38 MOCK_METHOD0(Run, int()); 39 MOCK_METHOD0(pid, pid_t()); 40 MOCK_METHOD2(Kill, bool(int signal, int timeout)); 41 MOCK_METHOD1(Reset, void(pid_t)); 42 MOCK_METHOD1(ResetPidByFile, bool(const std::string& pid_file)); 43 MOCK_METHOD0(Release, pid_t()); 44 MOCK_METHOD1(SetCloseUnusedFileDescriptors, void(bool close_unused_fds)); 45 }; 46 47 } // namespace brillo 48 49 #endif // LIBBRILLO_BRILLO_PROCESS_MOCK_H_ 50