OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/bpf_dsl/test_trap_registry.h" | 5 #include "sandbox/linux/bpf_dsl/test_trap_registry.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
8 | 10 |
9 namespace sandbox { | 11 namespace sandbox { |
10 namespace bpf_dsl { | 12 namespace bpf_dsl { |
11 | 13 |
12 TestTrapRegistry::TestTrapRegistry() : map_() {} | 14 TestTrapRegistry::TestTrapRegistry() : map_() {} |
13 TestTrapRegistry::~TestTrapRegistry() {} | 15 TestTrapRegistry::~TestTrapRegistry() {} |
14 | 16 |
15 uint16_t TestTrapRegistry::Add(TrapFnc fnc, const void* aux, bool safe) { | 17 uint16_t TestTrapRegistry::Add(TrapFnc fnc, const void* aux, bool safe) { |
16 EXPECT_TRUE(safe); | 18 EXPECT_TRUE(safe); |
17 | 19 |
18 const uint16_t next_id = map_.size() + 1; | 20 const uint16_t next_id = map_.size() + 1; |
19 return map_.insert(std::make_pair(Key(fnc, aux), next_id)).first->second; | 21 return map_.insert(std::make_pair(Key(fnc, aux), next_id)).first->second; |
20 } | 22 } |
21 | 23 |
22 bool TestTrapRegistry::EnableUnsafeTraps() { | 24 bool TestTrapRegistry::EnableUnsafeTraps() { |
23 ADD_FAILURE() << "Unimplemented"; | 25 ADD_FAILURE() << "Unimplemented"; |
24 return false; | 26 return false; |
25 } | 27 } |
26 | 28 |
27 } // namespace bpf_dsl | 29 } // namespace bpf_dsl |
28 } // namespace sandbox | 30 } // namespace sandbox |
OLD | NEW |