OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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 // Options mock class |
| 6 #ifndef __CHROMEOS_OPTIONS_MOCK_OPTIONS_H |
| 7 #define __CHROMEOS_OPTIONS_MOCK_OPTIONS_H |
| 8 |
| 9 #include "options.h" |
| 10 |
| 11 #include <gmock/gmock.h> |
| 12 #include <gtest/gtest.h> |
| 13 |
| 14 namespace chromeos { |
| 15 namespace minijail { |
| 16 |
| 17 class MockOptions : public Options { |
| 18 public: |
| 19 MockOptions() { } |
| 20 ~MockOptions() { } |
| 21 MOCK_CONST_METHOD0(env, const Env *()); |
| 22 MOCK_METHOD1(set_env, void(Env *)); |
| 23 MOCK_METHOD1(set_executable_path, void(const char*)); |
| 24 MOCK_CONST_METHOD0(executable_path, const char *()); |
| 25 MOCK_METHOD2(set_arguments, void(char * const *, int)); |
| 26 MOCK_CONST_METHOD0(arguments, char * const *()); |
| 27 MOCK_CONST_METHOD0(argument_count, int()); |
| 28 MOCK_METHOD1(set_environment, void(char * const *)); |
| 29 MOCK_CONST_METHOD0(environment, char * const *()); |
| 30 |
| 31 MOCK_METHOD1(set_add_readonly_mounts, void(bool)); |
| 32 MOCK_METHOD1(set_disable_tracing, void(bool)); |
| 33 MOCK_METHOD1(set_enforce_syscalls_benchmark, void(bool)); |
| 34 MOCK_METHOD1(set_enforce_syscalls_by_source, void(bool)); |
| 35 MOCK_METHOD1(set_gid, void(gid_t)); |
| 36 MOCK_METHOD1(set_namespace_vfs, void(bool)); |
| 37 MOCK_METHOD1(set_namespace_pid, void(bool)); |
| 38 MOCK_METHOD1(set_sanitize_environment, void(bool)); |
| 39 MOCK_METHOD1(set_uid, void(uid_t)); |
| 40 MOCK_METHOD1(set_use_capabilities, void(bool)); |
| 41 |
| 42 MOCK_CONST_METHOD0(add_readonly_mounts, bool()); |
| 43 MOCK_CONST_METHOD0(disable_tracing, bool()); |
| 44 MOCK_CONST_METHOD0(enforce_syscalls_benchmark, bool()); |
| 45 MOCK_CONST_METHOD0(enforce_syscalls_by_source, bool()); |
| 46 MOCK_CONST_METHOD0(gid, gid_t()); |
| 47 MOCK_CONST_METHOD0(namespace_vfs, bool()); |
| 48 MOCK_CONST_METHOD0(namespace_pid, bool()); |
| 49 MOCK_CONST_METHOD0(sanitize_environment, bool()); |
| 50 MOCK_CONST_METHOD0(uid, uid_t()); |
| 51 MOCK_CONST_METHOD0(use_capabilities, bool()); |
| 52 |
| 53 MOCK_CONST_METHOD0(change_uid, bool()); |
| 54 MOCK_CONST_METHOD0(change_gid, bool()); |
| 55 MOCK_METHOD0(FixUpDependencies, bool()); |
| 56 |
| 57 // Concrete call to the parent class fo easy self-testing of the |
| 58 // default implementation. To use: |
| 59 // EXPECT_CALL(*mockopt, FixUpDependencies()) |
| 60 // .WillOnce(Invoke(mockopt, &MockOptions::OptionsFixUpDependencies)); |
| 61 bool OptionsFixUpDependencies() { return Options::FixUpDependencies(); } |
| 62 }; |
| 63 |
| 64 } // namespace minijail |
| 65 } // namespace chromeos |
| 66 |
| 67 #endif // __CHROMEOS_OPTIONS_MOCK_OPTIONS_H |
OLD | NEW |