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