OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "base/strings/stringprintf.h" | 26 #include "base/strings/stringprintf.h" |
27 #include "gtest/gtest.h" | 27 #include "gtest/gtest.h" |
28 #include "util/file/fd_io.h" | 28 #include "util/file/fd_io.h" |
29 #include "util/mach/exc_server_variants.h" | 29 #include "util/mach/exc_server_variants.h" |
30 #include "util/mach/mach_extensions.h" | 30 #include "util/mach/mach_extensions.h" |
31 #include "util/misc/scoped_forbid_return.h" | 31 #include "util/misc/scoped_forbid_return.h" |
32 #include "util/synchronization/semaphore.h" | 32 #include "util/synchronization/semaphore.h" |
33 #include "util/test/mac/mach_errors.h" | 33 #include "util/test/mac/mach_errors.h" |
34 #include "util/test/mac/mach_multiprocess.h" | 34 #include "util/test/mac/mach_multiprocess.h" |
35 | 35 |
| 36 namespace crashpad { |
| 37 namespace test { |
36 namespace { | 38 namespace { |
37 | 39 |
38 using namespace crashpad; | |
39 using namespace crashpad::test; | |
40 | |
41 // Calls GetExceptionPorts() on its |exception_ports| argument to look up the | 40 // Calls GetExceptionPorts() on its |exception_ports| argument to look up the |
42 // EXC_MASK_CRASH handler. If |expect_port| is not MACH_PORT_NULL, it expects to | 41 // EXC_MASK_CRASH handler. If |expect_port| is not MACH_PORT_NULL, it expects to |
43 // find a handler for this mask whose port matches |expect_port| and whose | 42 // find a handler for this mask whose port matches |expect_port| and whose |
44 // behavior matches |expect_behavior| exactly. In this case, if | 43 // behavior matches |expect_behavior| exactly. In this case, if |
45 // |expect_behavior| is a state-carrying behavior, the looked-up thread state | 44 // |expect_behavior| is a state-carrying behavior, the looked-up thread state |
46 // flavor is expected to be MACHINE_THREAD_STATE, otherwise, it is expected to | 45 // flavor is expected to be MACHINE_THREAD_STATE, otherwise, it is expected to |
47 // be THREAD_STATE_NONE. If |expect_port| is MACH_PORT_NULL, no handler for | 46 // be THREAD_STATE_NONE. If |expect_port| is MACH_PORT_NULL, no handler for |
48 // EXC_MASK_CRASH is expected to be found. | 47 // EXC_MASK_CRASH is expected to be found. |
49 // | 48 // |
50 // A second GetExceptionPorts() lookup is also performed on a wider exception | 49 // A second GetExceptionPorts() lookup is also performed on a wider exception |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 rv = implicit_host_ports.GetExceptionPorts( | 566 rv = implicit_host_ports.GetExceptionPorts( |
568 ExcMaskAll() | EXC_MASK_CRASH, &handlers); | 567 ExcMaskAll() | EXC_MASK_CRASH, &handlers); |
569 if (geteuid() == 0) { | 568 if (geteuid() == 0) { |
570 EXPECT_TRUE(rv); | 569 EXPECT_TRUE(rv); |
571 } else { | 570 } else { |
572 EXPECT_FALSE(rv); | 571 EXPECT_FALSE(rv); |
573 } | 572 } |
574 } | 573 } |
575 | 574 |
576 } // namespace | 575 } // namespace |
| 576 } // namespace test |
| 577 } // namespace crashpad |
OLD | NEW |