| Index: sandbox/linux/seccomp-bpf/bpf_tests_unittest.cc
|
| diff --git a/sandbox/linux/seccomp-bpf/bpf_tests_unittest.cc b/sandbox/linux/seccomp-bpf/bpf_tests_unittest.cc
|
| index eaa9ff3cbf336a5b3446e8d4e87979242ffbfe92..6a4cea39fbf698d5270edff12f93b92bd2216197 100644
|
| --- a/sandbox/linux/seccomp-bpf/bpf_tests_unittest.cc
|
| +++ b/sandbox/linux/seccomp-bpf/bpf_tests_unittest.cc
|
| @@ -33,22 +33,24 @@ class FourtyTwo {
|
| DISALLOW_COPY_AND_ASSIGN(FourtyTwo);
|
| };
|
|
|
| -ErrorCode EmptyPolicyTakesClass(SandboxBPF* sandbox,
|
| - int sysno,
|
| - FourtyTwo* fourty_two) {
|
| - // |aux| should point to an instance of FourtyTwo.
|
| - BPF_ASSERT(fourty_two);
|
| - BPF_ASSERT(FourtyTwo::kMagicValue == fourty_two->value());
|
| - if (!SandboxBPF::IsValidSyscallNumber(sysno)) {
|
| - return ErrorCode(ENOSYS);
|
| - } else {
|
| +class EmptyClassTakingPolicy : public SandboxBPFPolicy {
|
| + public:
|
| + explicit EmptyClassTakingPolicy(FourtyTwo* fourty_two) {
|
| + BPF_ASSERT(fourty_two);
|
| + BPF_ASSERT(FourtyTwo::kMagicValue == fourty_two->value());
|
| + }
|
| + virtual ~EmptyClassTakingPolicy() {}
|
| +
|
| + virtual ErrorCode EvaluateSyscall(SandboxBPF* sandbox,
|
| + int sysno) const OVERRIDE {
|
| + DCHECK(SandboxBPF::IsValidSyscallNumber(sysno));
|
| return ErrorCode(ErrorCode::ERR_ALLOWED);
|
| }
|
| -}
|
| +};
|
|
|
| BPF_TEST(BPFTest,
|
| BPFAUXPointsToClass,
|
| - EmptyPolicyTakesClass,
|
| + EmptyClassTakingPolicy,
|
| FourtyTwo /* *BPF_AUX */) {
|
| // BPF_AUX should point to an instance of FourtyTwo.
|
| BPF_ASSERT(BPF_AUX);
|
| @@ -62,14 +64,14 @@ TEST(BPFTest, BPFTesterCompatibilityDelegateLeakTest) {
|
| // Don't do anything, simply gives dynamic tools an opportunity to detect
|
| // leaks.
|
| {
|
| - BPFTesterCompatibilityDelegate<FourtyTwo> simple_delegate(
|
| - DummyTestFunction, EmptyPolicyTakesClass);
|
| + BPFTesterCompatibilityDelegate<EmptyClassTakingPolicy, FourtyTwo>
|
| + simple_delegate(DummyTestFunction);
|
| }
|
| {
|
| // Test polymorphism.
|
| scoped_ptr<BPFTesterDelegate> simple_delegate(
|
| - new BPFTesterCompatibilityDelegate<FourtyTwo>(DummyTestFunction,
|
| - EmptyPolicyTakesClass));
|
| + new BPFTesterCompatibilityDelegate<EmptyClassTakingPolicy, FourtyTwo>(
|
| + DummyTestFunction));
|
| }
|
| }
|
|
|
|
|