| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "sandbox/linux/seccomp-bpf/errorcode.h" | 5 #include "sandbox/linux/seccomp-bpf/errorcode.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "sandbox/linux/bpf_dsl/bpf_dsl.h" | 10 #include "sandbox/linux/bpf_dsl/bpf_dsl.h" |
| 11 #include "sandbox/linux/bpf_dsl/policy.h" | 11 #include "sandbox/linux/bpf_dsl/policy.h" |
| 12 #include "sandbox/linux/bpf_dsl/policy_compiler.h" | 12 #include "sandbox/linux/bpf_dsl/policy_compiler.h" |
| 13 #include "sandbox/linux/seccomp-bpf/linux_seccomp.h" | 13 #include "sandbox/linux/seccomp-bpf/linux_seccomp.h" |
| 14 #include "sandbox/linux/seccomp-bpf/trap.h" | 14 #include "sandbox/linux/seccomp-bpf/trap.h" |
| 15 #include "sandbox/linux/tests/unit_tests.h" | 15 #include "sandbox/linux/tests/unit_tests.h" |
| 16 | 16 |
| 17 namespace sandbox { | 17 namespace sandbox { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 class DummyPolicy : public bpf_dsl::Policy { | 21 class DummyPolicy : public bpf_dsl::Policy { |
| 22 public: | 22 public: |
| 23 DummyPolicy() {} | 23 DummyPolicy() {} |
| 24 virtual ~DummyPolicy() {} | 24 ~DummyPolicy() override {} |
| 25 | 25 |
| 26 virtual bpf_dsl::ResultExpr EvaluateSyscall(int sysno) const override { | 26 bpf_dsl::ResultExpr EvaluateSyscall(int sysno) const override { |
| 27 return bpf_dsl::Allow(); | 27 return bpf_dsl::Allow(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 DISALLOW_COPY_AND_ASSIGN(DummyPolicy); | 31 DISALLOW_COPY_AND_ASSIGN(DummyPolicy); |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 SANDBOX_TEST(ErrorCode, ErrnoConstructor) { | 34 SANDBOX_TEST(ErrorCode, ErrnoConstructor) { |
| 35 ErrorCode e0; | 35 ErrorCode e0; |
| 36 SANDBOX_ASSERT(e0.err() == SECCOMP_RET_INVALID); | 36 SANDBOX_ASSERT(e0.err() == SECCOMP_RET_INVALID); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 SANDBOX_ASSERT(e1.LessThan(e4)); | 111 SANDBOX_ASSERT(e1.LessThan(e4)); |
| 112 SANDBOX_ASSERT(e3.LessThan(e4)); | 112 SANDBOX_ASSERT(e3.LessThan(e4)); |
| 113 SANDBOX_ASSERT(e4.LessThan(e5)); | 113 SANDBOX_ASSERT(e4.LessThan(e5)); |
| 114 SANDBOX_ASSERT(!e4.LessThan(e6)); | 114 SANDBOX_ASSERT(!e4.LessThan(e6)); |
| 115 SANDBOX_ASSERT(!e6.LessThan(e4)); | 115 SANDBOX_ASSERT(!e6.LessThan(e4)); |
| 116 } | 116 } |
| 117 | 117 |
| 118 } // namespace | 118 } // namespace |
| 119 | 119 |
| 120 } // namespace sandbox | 120 } // namespace sandbox |
| OLD | NEW |